Added logging service and emailing function

This commit is contained in:
veyselboybay committed 2024-05-13 19:20:56 -04:00
1 parent cca454b447
commit ad2b48bb41
5 files changed
+79 -7

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
const winston = require('winston');
/**
* @module
* @example
* logger.info("Registered a new user!")
* logger.warn("User not found!")
* logger.error("Cannot save")
* @example
* "Specify service and ID in the log if applicable."
* logger.error("Descriptive Message",{"service":"monitor","monitorId":"123456"})
* logger.error("Incorrect Credentials",{"service":"Auth","userId":"654321"})
* logger.error("User not found!",{"service":"Auth"})
*/
const logger = winston.createLogger({
level: 'info',
format: winston.format.combine(
winston.format.timestamp(),
winston.format.json()
),
transports: [
new winston.transports.Console(),
new winston.transports.File({ filename: 'app.log' }),
],
});
module.exports = logger;