From b5f4c286c21b752caa73f07c0cd3bb3342ca7929 Mon Sep 17 00:00:00 2001 From: Bo Borgerson Date: Thu, 6 Apr 2017 16:50:25 -0700 Subject: [PATCH] Allow group selection in `logging.addRewriter` 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. --- packages/react-server/core/logging/server.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/react-server/core/logging/server.js b/packages/react-server/core/logging/server.js index 92a4ce88a..f758f6ff3 100644 --- a/packages/react-server/core/logging/server.js +++ b/packages/react-server/core/logging/server.js @@ -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) {