Closed rom3r4 closed 3 years ago
That may seem counter-intuitive, but log levels with higher importance have lower values, as defined by:
export enum LogLevel {
Off = 0,
Error, // 1
Warning, // 2
Info, // 3
Debug // 4
}
So the code is actually correct 😉
https://github.com/ngx-rocket/generator-ngx-rocket/blob/e05fee047c6f8e5eafd17c9c063d2ab162d6a572/generators/app/templates/src/app/%40core/logger.service.ts#L106
Not sure about this: when checking the passed log-level against the one in the class, shouldn't we only accept the levels greater than the one in the class?
eg.
if we set a logLevel=Warning in the class, and do a log.debug('msg') we would not expect this message to be printed.
just changing
if (level <= Logger.level) {
forif (level >= Logger.level) {
would make it