mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-03-25 02:32:52 -05:00
Fix re-opening log files using SIGUSR2 (#2967)
This commit is contained in:
parent
06e400cb34
commit
b78f35257e
2 changed files with 8 additions and 1 deletions
5
.changeset/red-yaks-sell.md
Normal file
5
.changeset/red-yaks-sell.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@verdaccio/logger': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix re-opening log files using SIGUSR2
|
|
@ -141,7 +141,9 @@ export function setup(options: LoggerConfig | LoggerConfigItem = DEFAULT_LOGGER_
|
||||||
const pinoConfig = { level: loggerConfig.level };
|
const pinoConfig = { level: loggerConfig.level };
|
||||||
if (loggerConfig.type === 'file') {
|
if (loggerConfig.type === 'file') {
|
||||||
debug('logging file enabled');
|
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') {
|
} else if (loggerConfig.type === 'rotating-file') {
|
||||||
warningUtils.emit(warningUtils.Codes.VERWAR003);
|
warningUtils.emit(warningUtils.Codes.VERWAR003);
|
||||||
debug('logging stdout enabled');
|
debug('logging stdout enabled');
|
||||||
|
|
Loading…
Add table
Reference in a new issue