apollo/services/logging.js

15 lines
445 B
JavaScript
Raw Permalink Normal View History

2024-12-06 01:57:10 -05:00
const docker = require("../utils/docker");
const path = require("path");
const pino = require("pino");
2024-12-06 01:57:10 -05:00
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;