@@ -23,10 +23,7 @@ function getLogLevel(level, action, payload, type) {
23
23
}
24
24
25
25
function defaultTitleFormatter ( options ) {
26
- const {
27
- timestamp,
28
- duration,
29
- } = options ;
26
+ const { timestamp, duration } = options ;
30
27
31
28
return ( action , time , took ) => {
32
29
const parts = [ 'action' ] ;
@@ -64,7 +61,9 @@ function printBuffer(buffer, options) {
64
61
65
62
// Message
66
63
const formattedAction = actionTransformer ( action ) ;
67
- const isCollapsed = ( typeof collapsed === 'function' ) ? collapsed ( ( ) => nextState , action , logEntry ) : collapsed ;
64
+ const isCollapsed = typeof collapsed === 'function'
65
+ ? collapsed ( ( ) => nextState , action , logEntry )
66
+ : collapsed ;
68
67
69
68
const formattedTime = formatTime ( startedTime ) ;
70
69
const titleCSS = colors . title ? `color: ${ colors . title ( formattedAction ) } ;` : '' ;
@@ -77,8 +76,7 @@ function printBuffer(buffer, options) {
77
76
// Render
78
77
try {
79
78
if ( isCollapsed ) {
80
- if ( colors . title && isUsingDefaultFormatter ) logger . groupCollapsed ( `%c ${ title } ` , ...headerCSS ) ;
81
- else logger . groupCollapsed ( title ) ;
79
+ if ( colors . title && isUsingDefaultFormatter ) { logger . groupCollapsed ( `%c ${ title } ` , ...headerCSS ) ; } else logger . groupCollapsed ( title ) ;
82
80
} else if ( colors . title && isUsingDefaultFormatter ) {
83
81
logger . group ( `%c ${ title } ` , ...headerCSS ) ;
84
82
} else {
@@ -94,23 +92,43 @@ function printBuffer(buffer, options) {
94
92
const nextStateLevel = getLogLevel ( level , formattedAction , [ nextState ] , 'nextState' ) ;
95
93
96
94
if ( prevStateLevel ) {
97
- if ( colors . prevState ) logger [ prevStateLevel ] ( '%c prev state' , `color: ${ colors . prevState ( prevState ) } ; font-weight: bold` , prevState ) ;
98
- else logger [ prevStateLevel ] ( 'prev state' , prevState ) ;
95
+ if ( colors . prevState ) {
96
+ logger [ prevStateLevel ] (
97
+ '%c prev state' ,
98
+ `color: ${ colors . prevState ( prevState ) } ; font-weight: bold` ,
99
+ prevState ,
100
+ ) ;
101
+ } else logger [ prevStateLevel ] ( 'prev state' , prevState ) ;
99
102
}
100
103
101
104
if ( actionLevel ) {
102
- if ( colors . action ) logger [ actionLevel ] ( '%c action ' , `color: ${ colors . action ( formattedAction ) } ; font-weight: bold` , formattedAction ) ;
103
- else logger [ actionLevel ] ( 'action ' , formattedAction ) ;
105
+ if ( colors . action ) {
106
+ logger [ actionLevel ] (
107
+ '%c action ' ,
108
+ `color: ${ colors . action ( formattedAction ) } ; font-weight: bold` ,
109
+ formattedAction ,
110
+ ) ;
111
+ } else logger [ actionLevel ] ( 'action ' , formattedAction ) ;
104
112
}
105
113
106
114
if ( error && errorLevel ) {
107
- if ( colors . error ) logger [ errorLevel ] ( '%c error ' , `color: ${ colors . error ( error , prevState ) } ; font-weight: bold;` , error ) ;
108
- else logger [ errorLevel ] ( 'error ' , error ) ;
115
+ if ( colors . error ) {
116
+ logger [ errorLevel ] (
117
+ '%c error ' ,
118
+ `color: ${ colors . error ( error , prevState ) } ; font-weight: bold;` ,
119
+ error ,
120
+ ) ;
121
+ } else logger [ errorLevel ] ( 'error ' , error ) ;
109
122
}
110
123
111
124
if ( nextStateLevel ) {
112
- if ( colors . nextState ) logger [ nextStateLevel ] ( '%c next state' , `color: ${ colors . nextState ( nextState ) } ; font-weight: bold` , nextState ) ;
113
- else logger [ nextStateLevel ] ( 'next state' , nextState ) ;
125
+ if ( colors . nextState ) {
126
+ logger [ nextStateLevel ] (
127
+ '%c next state' ,
128
+ `color: ${ colors . nextState ( nextState ) } ; font-weight: bold` ,
129
+ nextState ,
130
+ ) ;
131
+ } else logger [ nextStateLevel ] ( 'next state' , nextState ) ;
114
132
}
115
133
116
134
if ( diff ) {
0 commit comments