From 399dd352cfee10df464dae6abfc28208564db430 Mon Sep 17 00:00:00 2001 From: Josh Delman Date: Thu, 30 Mar 2017 19:36:42 +0200 Subject: [PATCH] fix: ignore color formatting with custom titleFormatter (#216) --- src/core.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core.js b/src/core.js index d51fe33..85b7d9f 100644 --- a/src/core.js +++ b/src/core.js @@ -50,6 +50,8 @@ export function printBuffer(buffer, options) { diff, } = options; + const isUsingDefaultFormatter = typeof options.titleFormatter === `undefined`; + buffer.forEach((logEntry, key) => { const { started, startedTime, action, prevState, error } = logEntry; let { took, nextState } = logEntry; @@ -75,10 +77,10 @@ export function printBuffer(buffer, options) { // Render try { if (isCollapsed) { - if (colors.title) logger.groupCollapsed(`%c ${title}`, ...headerCSS); + if (colors.title && isUsingDefaultFormatter) logger.groupCollapsed(`%c ${title}`, ...headerCSS); else logger.groupCollapsed(title); } else { - if (colors.title) logger.group(`%c ${title}`, ...headerCSS); + if (colors.title && isUsingDefaultFormatter) logger.group(`%c ${title}`, ...headerCSS); else logger.group(title); } } catch (e) {