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 (#2966)

by @marvinthepa
This commit is contained in:
Martin Sander 2022-01-26 20:25:34 +01:00 committed by GitHub
parent c40d01a0ea
commit b964c0d488
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -122,7 +122,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') {
process.emitWarning('rotating-file type is not longer supported, consider use [logrotate] instead');
debug('logging stdout enabled');