@@ -4,6 +4,8 @@ const { inspect } = require('util')
44
55const { bold, dim, inverse } = require ( 'chalk' )
66
7+ const { LEVELS } = require ( './level' )
8+
79// Retrieve `message` which sums up all information that can be gathered about
810// the event.
911const getMessage = function ( {
@@ -13,7 +15,7 @@ const getMessage = function({
1315 secondPromiseState,
1416 secondPromiseValue,
1517 error,
16- levelInfo ,
18+ level ,
1719} ) {
1820 const message = MESSAGES [ eventName ] ( {
1921 promiseState,
@@ -23,7 +25,7 @@ const getMessage = function({
2325 error,
2426 } )
2527
26- const messageA = prettify ( { message, eventName, levelInfo } )
28+ const messageA = prettify ( { message, eventName, level } )
2729 return messageA
2830}
2931
@@ -85,10 +87,11 @@ const printValue = function(value) {
8587 return inspect ( value )
8688}
8789
88- const prettify = function ( { message, eventName, levelInfo : { COLOR , SIGN } } ) {
90+ const prettify = function ( { message, eventName, level } ) {
8991 const [ header , ...lines ] = message . split ( '\n' )
9092
9193 // Add color, icon and `eventName` to first message line.
94+ const { COLOR , SIGN } = LEVELS [ level ]
9295 const headerA = COLOR ( `${ bold ( inverse ( ` ${ SIGN } ${ eventName } ` ) ) } ${ header } ` )
9396 // Add gray color and indentation to other lines.
9497 const linesA = lines . map ( line => dim ( `\t${ VERTICAL_BAR } ${ line } ` ) )
0 commit comments