-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
I was just checking how the dynamic log level change would work and tried below code:
const appLogger = require('simple-node-logger').createSimpleLogger();
appLogger.setLevel('debug');
appLogger.debug('appLogger:debug');
appLogger.info('appLogger:info');
appLogger.warn('appLogger:warn');
appLogger.error('appLogger:error');
appLogger.setLevel('warn');
appLogger.debug('appLogger:debug 2');
appLogger.info('appLogger:info 2');
appLogger.warn('appLogger:warn 2');
appLogger.error('appLogger:error 2');
The expected output was:
16:23:31.737 DEBUG appLogger:debug
16:23:31.737 INFO appLogger:info
16:23:31.737 WARN appLogger:warn
16:23:31.737 ERROR appLogger:error
16:23:31.737 WARN appLogger:warn 2
16:23:31.737 ERROR appLogger:error 2
But what I get is:
16:23:31.737 WARN appLogger:warn
16:23:31.737 ERROR appLogger:error
16:23:31.737 WARN appLogger:warn 2
16:23:31.737 ERROR appLogger:error 2
So it seems the seconds setLevel also affects the statements before it. Or am I doing something wrong?
The package version is: simple-node-logger@18.12.24
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels