From 303efac464fca1e86fafd3489cb59e5941387e9c Mon Sep 17 00:00:00 2001 From: Eugene Rodionov Date: Tue, 1 Mar 2016 00:38:17 +0300 Subject: [PATCH] fix: broken level option when specified object or function (#135) --- package.json | 2 +- src/index.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 837a4a7..ffa1125 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redux-logger", - "version": "2.6.0", + "version": "2.6.1", "description": "Logger for redux", "main": "lib/index.js", "scripts": { diff --git a/src/index.js b/src/index.js index efbd33b..f4aa958 100644 --- a/src/index.js +++ b/src/index.js @@ -112,23 +112,23 @@ function createLogger(options = {}) { const nextStateLevel = getLogLevel(level, formattedAction, [nextState], `nextState`); if (prevStateLevel) { - if (colors.prevState) logger[level](`%c prev state`, `color: ${colors.prevState(prevState)}; font-weight: bold`, prevState); - else logger[level](`prev state`, prevState); + if (colors.prevState) logger[prevStateLevel](`%c prev state`, `color: ${colors.prevState(prevState)}; font-weight: bold`, prevState); + else logger[prevStateLevel](`prev state`, prevState); } if (actionLevel) { - if (colors.action) logger[level](`%c action`, `color: ${colors.action(formattedAction)}; font-weight: bold`, formattedAction); - else logger[level](`action`, formattedAction); + if (colors.action) logger[actionLevel](`%c action`, `color: ${colors.action(formattedAction)}; font-weight: bold`, formattedAction); + else logger[actionLevel](`action`, formattedAction); } if (error && errorLevel) { - if (colors.error) logger[level](`%c error`, `color: ${colors.error(error, prevState)}; font-weight: bold`, error); - else logger[level](`error`, error); + if (colors.error) logger[errorLevel](`%c error`, `color: ${colors.error(error, prevState)}; font-weight: bold`, error); + else logger[errorLevel](`error`, error); } if (nextStateLevel) { - if (colors.nextState) logger[level](`%c next state`, `color: ${colors.nextState(nextState)}; font-weight: bold`, nextState); - else logger[level](`next state`, nextState); + if (colors.nextState) logger[nextStateLevel](`%c next state`, `color: ${colors.nextState(nextState)}; font-weight: bold`, nextState); + else logger[nextStateLevel](`next state`, nextState); } try {