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

Addition of Logger.getAll() method as discussed in #970 #2515

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update lib/winston/container.js
DABH authored Oct 14, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 67e07299e5905051e7f95fbeae260383af41abf5
2 changes: 1 addition & 1 deletion lib/winston/container.js
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ module.exports = class Container {
* @returns {Map<Logger>} - A Map of Logger instances matching the regex.
*/
getAll(regex) {
if(regex) {
if (regex) {
return new Map([...this.loggers].filter(([key]) => key.match(regex)));
}


Unchanged files with check annotations Beta

* @param {!Object} options - TODO: add param description.
* @returns {undefined}
*/
configure({

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

GitHub Actions / Tests (16)

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

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

GitHub Actions / Tests (16)

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

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

GitHub Actions / Tests (18)

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

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

GitHub Actions / Tests (18)

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

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

GitHub Actions / Tests (20)

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

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

GitHub Actions / Tests (20)

Method 'configure' has a complexity of 19. Maximum allowed is 11
silent,
format,
defaultMeta,
*
*/
/* eslint-enable valid-jsdoc */
log(level, msg, ...splat) {

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

GitHub Actions / Tests (16)

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

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

GitHub Actions / Tests (16)

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

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

GitHub Actions / Tests (18)

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

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

GitHub Actions / Tests (18)

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

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

GitHub Actions / Tests (20)

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

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

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) {
return this.logger.write(info);
}
};

Check warning on line 51 in lib/winston/profiler.js

GitHub Actions / Tests (16)

Unnecessary semicolon

Check warning on line 51 in lib/winston/profiler.js

GitHub Actions / Tests (18)

Unnecessary semicolon

Check warning on line 51 in lib/winston/profiler.js

GitHub Actions / Tests (20)

Unnecessary semicolon
module.exports = Profiler;
return;
}
return fs.read(fd, buffer, 0, buffer.length, pos, (error, bytes) => {

Check warning on line 63 in lib/winston/tail-file.js

GitHub Actions / Tests (16)

Arrow function has too many statements (30). Maximum allowed is 15

Check warning on line 63 in lib/winston/tail-file.js

GitHub Actions / Tests (16)

Arrow function has a complexity of 13. Maximum allowed is 11

Check warning on line 63 in lib/winston/tail-file.js

GitHub Actions / Tests (18)

Arrow function has too many statements (30). Maximum allowed is 15

Check warning on line 63 in lib/winston/tail-file.js

GitHub Actions / Tests (18)

Arrow function has a complexity of 13. Maximum allowed is 11

Check warning on line 63 in lib/winston/tail-file.js

GitHub Actions / Tests (20)

Arrow function has too many statements (30). Maximum allowed is 15

Check warning on line 63 in lib/winston/tail-file.js

GitHub Actions / Tests (20)

Arrow function has a complexity of 13. Maximum allowed is 11
if (error) {
if (!iter) {
stream.emit('error', error);
* @param {Function} callback - TODO: add param description.
* @returns {undefined}
*/
log(info, callback) {

Check warning on line 52 in lib/winston/transports/console.js

GitHub Actions / Tests (16)

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

Check warning on line 52 in lib/winston/transports/console.js

GitHub Actions / Tests (16)

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

Check warning on line 52 in lib/winston/transports/console.js

GitHub Actions / Tests (18)

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

Check warning on line 52 in lib/winston/transports/console.js

GitHub Actions / Tests (18)

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

Check warning on line 52 in lib/winston/transports/console.js

GitHub Actions / Tests (20)

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

Check warning on line 52 in lib/winston/transports/console.js

GitHub Actions / Tests (20)

Method 'log' has a complexity of 12. Maximum allowed is 11
setImmediate(() => this.emit('logged', info));
// Remark: what if there is no raw...?
if (callback) callback(null, results);
});
function add(buff, attempt) {

Check warning on line 300 in lib/winston/transports/file.js

GitHub Actions / Tests (16)

'buff' is already declared in the upper scope on line 254 column 9

Check warning on line 300 in lib/winston/transports/file.js

GitHub Actions / Tests (18)

'buff' is already declared in the upper scope on line 254 column 9

Check warning on line 300 in lib/winston/transports/file.js

GitHub Actions / Tests (20)

'buff' is already declared in the upper scope on line 254 column 9
try {
const log = JSON.parse(buff);
if (check(log)) {