mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-03 22:32:42 +00:00
🗂️ feat: Allow Disabling File Log Transports (#13215)
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
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
This commit is contained in:
parent
8310e9a840
commit
799a080479
7 changed files with 182 additions and 68 deletions
|
|
@ -1,12 +1,18 @@
|
|||
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: [
|
||||
new winston.transports.Console(),
|
||||
new winston.transports.File({ filename: 'login-logs.log' }),
|
||||
],
|
||||
transports,
|
||||
});
|
||||
|
||||
module.exports = logger;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue