mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-06-09 17:31:19 +00:00
Some checks are pending
Docker Dev Branch Images Build / build (Dockerfile, lc-dev, node) (push) Waiting to run
Docker Dev Branch Images Build / build (Dockerfile.multi, lc-dev-api, api-build) (push) Waiting to run
GitNexus Index / index (push) Waiting to run
GitNexus Index / post-index (push) Blocked by required conditions
* fix: allow disabling file log transports * fix: defer log directory setup when file logging disabled
18 lines
506 B
JavaScript
18 lines
506 B
JavaScript
const winston = require('winston');
|
|
|
|
const useFileLogging =
|
|
typeof process.env.LOG_TO_FILE !== 'string' || process.env.LOG_TO_FILE.toLowerCase() !== 'false';
|
|
|
|
const transports = [new winston.transports.Console()];
|
|
|
|
if (useFileLogging) {
|
|
transports.push(new winston.transports.File({ filename: 'login-logs.log' }));
|
|
}
|
|
|
|
const logger = winston.createLogger({
|
|
level: 'info',
|
|
format: winston.format.combine(winston.format.timestamp(), winston.format.json()),
|
|
transports,
|
|
});
|
|
|
|
module.exports = logger;
|