Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1491 custom log levels can be silent #2387

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/winston/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
* @param {!Object} options - TODO: add param description.
* @returns {undefined}
*/
configure({

Check warning on line 81 in lib/winston/logger.js

View workflow job for this annotation

GitHub Actions / Tests (16)

Method 'configure' has too many statements (28). Maximum allowed is 15

Check warning on line 81 in lib/winston/logger.js

View workflow job for this annotation

GitHub Actions / Tests (16)

Method 'configure' has a complexity of 20. Maximum allowed is 11

Check warning on line 81 in lib/winston/logger.js

View workflow job for this annotation

GitHub Actions / Tests (18)

Method 'configure' has too many statements (28). Maximum allowed is 15

Check warning on line 81 in lib/winston/logger.js

View workflow job for this annotation

GitHub Actions / Tests (18)

Method 'configure' has a complexity of 20. Maximum allowed is 11

Check warning on line 81 in lib/winston/logger.js

View workflow job for this annotation

GitHub Actions / Tests (20)

Method 'configure' has too many statements (28). Maximum allowed is 15

Check warning on line 81 in lib/winston/logger.js

View workflow job for this annotation

GitHub Actions / Tests (20)

Method 'configure' has a complexity of 20. Maximum allowed is 11
silent,
format,
defaultMeta,
Expand Down Expand Up @@ -141,6 +141,17 @@
);
}

if (!Object.keys(this.levels).includes(this.level)) {
const message = [
'[winston] Log level <${this.level}> is not defined in levels definition.',
'Please double check the setup of your transports and/or custom log levels.',
'This transport will be set to silent.',
'See https://github.com/winstonjs/winston#logging-levels for more information.'
].join('\n');
console.warn(message);

Check warning on line 151 in lib/winston/logger.js

View workflow job for this annotation

GitHub Actions / Tests (16)

Unexpected console statement

Check warning on line 151 in lib/winston/logger.js

View workflow job for this annotation

GitHub Actions / Tests (18)

Unexpected console statement

Check warning on line 151 in lib/winston/logger.js

View workflow job for this annotation

GitHub Actions / Tests (20)

Unexpected console statement
this.silent = true;
}

if (exceptionHandlers) {
this.exceptions.handle(exceptionHandlers);
}
Expand Down Expand Up @@ -204,7 +215,7 @@
*
*/
/* eslint-enable valid-jsdoc */
log(level, msg, ...splat) {

Check warning on line 218 in lib/winston/logger.js

View workflow job for this annotation

GitHub Actions / Tests (16)

Method 'log' has too many statements (26). Maximum allowed is 15

Check warning on line 218 in lib/winston/logger.js

View workflow job for this annotation

GitHub Actions / Tests (16)

Method 'log' has a complexity of 12. Maximum allowed is 11

Check warning on line 218 in lib/winston/logger.js

View workflow job for this annotation

GitHub Actions / Tests (18)

Method 'log' has too many statements (26). Maximum allowed is 15

Check warning on line 218 in lib/winston/logger.js

View workflow job for this annotation

GitHub Actions / Tests (18)

Method 'log' has a complexity of 12. Maximum allowed is 11

Check warning on line 218 in lib/winston/logger.js

View workflow job for this annotation

GitHub Actions / Tests (20)

Method 'log' has too many statements (26). Maximum allowed is 15

Check warning on line 218 in lib/winston/logger.js

View workflow job for this annotation

GitHub Actions / Tests (20)

Method 'log' has a complexity of 12. Maximum allowed is 11
// eslint-disable-line max-params
// Optimize for the hotpath of logging JSON literals
if (arguments.length === 1) {
Expand Down
Loading