Skip to content

Commit

Permalink
Allow group selection in logging.addRewriter (#918)
Browse files Browse the repository at this point in the history
This makes it possible to add a rewriter only for the main logger, for example.

This also makes the interface consistent with `addTransport` and `setLevel`.

This is a breaking change.
  • Loading branch information
gigabo authored Apr 7, 2017
1 parent a43895a commit 8752ce2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/react-server/core/logging/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ function addTransport(group, transport) {
});
}

function addRewriter(rewriter) {
common.forEachLogger(logger => logger.rewriters.push(rewriter));
function addRewriter(group, rewriter) {
common.forEachLogger((logger, loggerGroup) => {
if (loggerGroup === group) logger.rewriters.push(rewriter);
});
}

function setTimestamp(bool) {
Expand Down

0 comments on commit 8752ce2

Please sign in to comment.