15 lines
445 B
JavaScript
15 lines
445 B
JavaScript
const docker = require("../utils/docker");
|
|
const path = require("path");
|
|
const pino = require("pino");
|
|
|
|
const directory = docker.isRunningOnDocker() ? process.env.LOGS_DIR : "logs";
|
|
const logger = pino(pino.destination({ dest: path.join(directory, '.log'), sync: false }));
|
|
|
|
const environment = process.env.NODE_ENV || 'development';
|
|
if (environment == "production") {
|
|
logger.level = 30
|
|
} else {
|
|
logger.level = 20
|
|
}
|
|
|
|
module.exports = logger; |