From 3bf50d7af4b38c910aece7f5da028d4573271d6e Mon Sep 17 00:00:00 2001 From: Vincent Chang Date: Fri, 26 Aug 2016 13:17:16 -0700 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20create=20any=20tuples=20or=20pu?= =?UTF-8?q?sh=20them=20to=20the=20queue=20if=20log()=20is=20not=20called?= =?UTF-8?q?=20within=20the=20context=20of=20a=20request.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react-server/core/logging/response.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/react-server/core/logging/response.js b/packages/react-server/core/logging/response.js index dbf136a1d..67249c326 100644 --- a/packages/react-server/core/logging/response.js +++ b/packages/react-server/core/logging/response.js @@ -13,8 +13,14 @@ var queue = () => { } } -var pushToQueue = (tuple) => { +var pushToQueue = (module, lastModuleToken, key, level, msg, meta) => { if (RLS.isActive() && !!RLS().doLog) { + var tuple = [ + module, + msg, + meta[key], + lastModuleToken, + ]; queue().push(tuple); } } @@ -28,13 +34,7 @@ class ResponseLogger extends SuperLogger { } log(level, msg, meta, callback) { - var tuple = [ - this.module, - msg, - meta[this.key], - this.lastModuleToken, - ]; - pushToQueue(tuple); + pushToQueue(this.module, this.lastModuleToken, this.key, level, msg, meta); // Yield to the next log transport. callback(null, true); } @@ -70,7 +70,7 @@ var getTransportForGroup = function(group, opts) { } } -var flushLogsToResponse = function(res) { +var flushLogsToResponse = function(res) { if (queue().length > 0) { res.write("