monkeytype/backend/handlers/logger.js

16 lines
304 B
JavaScript
Raw Normal View History

2021-09-10 00:41:13 +08:00
const { mongoDB } = require("../init/mongodb");
async function log(event, message, uid) {
console.log(new Date(), "\t", event, "\t", uid, "\t", message);
2021-09-10 00:48:53 +08:00
await mongoDB().collection("logs").insertOne({
2021-09-10 00:41:13 +08:00
timestamp: Date.now(),
uid,
event,
message,
});
}
module.exports = {
log,
};