Logging level changes based on environment

This commit is contained in:
Tom 2024-12-04 01:39:35 +00:00
parent cfb63f1e3e
commit ad624172a6

View File

@ -1,4 +1,12 @@
const pino = require("pino");
const logger = pino(pino.destination({ dest: 'logs/.log', sync: false }));
const environment = process.env.NODE_ENV || 'development';
console.log(process.env.NODE_ENV);
if (environment == "production") {
logger.level = 30
} else {
logger.level = 20
}
module.exports = logger;