Skip to content
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
13 changes: 13 additions & 0 deletions lib/winston/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@ module.exports = class Container {
return this.add(id, options);
}

/**
* Retreives all `winston.Logger` instances for the specified `regex`.
* @param {!string} id - The regrex to match the Loggers to get.
* @returns {Map<Logger>} - A Map of Logger instances matching the regex.
*/
getAll(regex) {
if(regex) {
return new Map([...this.loggers].filter(([key]) => key.match(regex)));
}

return this.loggers;
}

/**
* Check if the container has a logger with the id.
* @param {?string} id - The id of the Logger instance to find.
Expand Down