Skip to content

Commit

Permalink
updating detaulfs object to a LoggerColorsOption
Browse files Browse the repository at this point in the history
  • Loading branch information
Ernesto Mancebo Tavarez committed May 10, 2017
1 parent 72d3289 commit 74f204d
Showing 1 changed file with 30 additions and 16 deletions.
46 changes: 30 additions & 16 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,38 @@ export const storeLogger = (opts: LoggerOptions = {}) => (reducer: Function) =>
ms_ie = true;
}

const defaults = {
level : `log`,
collapsed : false,
duration : true,
timestamp : true,
stateTransformer : state => state,
actionTransformer : actn => actn,
filter : {
whitelist : [],
blacklist : []
},
colors : ms_ie ? {} : {
let colors: LoggerColorsOption;
if (ms_ie) {
// Setting colors functions to null when it's an IE browser.
colors = {
title: null,
prevState: null,
action: null,
nextState: null,
error: null,
}
} else {
colors = {
title: null,
prevState: () => `#9E9E9E`,
action: () => `#03A9F4`,
nextState: () => `#4CAF50`,
error: () => `#F20404`,
prevState: () => '#9E9E9E',
action: () => '#03A9F4',
nextState: () => '#4CAF50',
error: () => '#F20404',
}
}

const defaults: LoggerOptions = {
level: 'log',
collapsed: false,
duration: true,
timestamp: true,
stateTransformer: state => state,
actionTransformer: actn => actn,
filter: {
whitelist: [],
blacklist: []
},
colors: colors
};

const options = Object.assign({}, defaults, opts);
Expand Down

0 comments on commit 74f204d

Please sign in to comment.