0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

Fix re-opening log files using SIGUSR2 (#2967)

This commit is contained in:
Martin Sander 2022-01-27 16:40:51 +01:00 committed by GitHub
parent 06e400cb34
commit b78f35257e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'@verdaccio/logger': patch
---
Fix re-opening log files using SIGUSR2

View file

@ -141,7 +141,9 @@ export function setup(options: LoggerConfig | LoggerConfigItem = DEFAULT_LOGGER_
const pinoConfig = { level: loggerConfig.level };
if (loggerConfig.type === 'file') {
debug('logging file enabled');
logger = createLogger(pinoConfig, pino.destination(loggerConfig.path), loggerConfig.format);
const destination = pino.destination(loggerConfig.path);
process.on('SIGUSR2', () => destination.reopen());
logger = createLogger(pinoConfig, destination, loggerConfig.format);
} else if (loggerConfig.type === 'rotating-file') {
warningUtils.emit(warningUtils.Codes.VERWAR003);
debug('logging stdout enabled');