File tree Expand file tree Collapse file tree 3 files changed +5
-12
lines changed
Expand file tree Collapse file tree 3 files changed +5
-12
lines changed Original file line number Diff line number Diff line change 4141 "test" : " yarn lint && yarn build && yarn test-only"
4242 },
4343 "dependencies" : {
44- "chalk" : " ^4.1.0" ,
4544 "cloneable-readable" : " ^2.0.1" ,
4645 "merge-stream" : " ^2.0.0" ,
4746 "npm-run-path" : " ^4.0.1" ,
Original file line number Diff line number Diff line change 11import { formatWithOptions } from 'util'
2- import { Service } from './Service'
32import mergeStream from 'merge-stream'
4- import chalk from 'chalk '
3+ import { Service } from './Service '
54import {
65 NormalizedCompositeServiceConfig ,
76 validateAndNormalizeConfig ,
@@ -55,11 +54,9 @@ export class CompositeService {
5554 )
5655
5756 outputStream . add (
58- this . services . map ( ( { output, id } , i ) => {
59- // luminosity of 20 because at 256 colors, luminosity from 16 to 24 yields the most colors (12 colors) while keeping high contrast with text
60- const label = chalk . bgHsl ( ( i / this . services . length ) * 360 , 100 , 20 ) ( id )
61- return output . pipe ( mapStreamLines ( line => `${ label } | ${ line } ` ) )
62- } ) ,
57+ this . services . map ( ( { output, id } ) =>
58+ output . pipe ( mapStreamLines ( line => `${ id } | ${ line } ` ) ) ,
59+ ) ,
6360 )
6461
6562 this . logger . log ( 'debug' , 'Starting composite service...' )
Original file line number Diff line number Diff line change 11import { PassThrough } from 'stream'
2- import chalk from 'chalk'
32
43export type LogLevel = 'debug' | 'info' | 'error'
54
65const orderedLogLevels : LogLevel [ ] = [ 'error' , 'info' , 'debug' ]
7- const logLevelColors = { error : 'red' , info : 'teal' , debug : 'yellow' }
86
97export class Logger {
108 private level : LogLevel
@@ -14,9 +12,8 @@ export class Logger {
1412 }
1513 public log ( level : LogLevel , text : string ) {
1614 if ( this . shouldLog ( level ) ) {
17- const label = chalk . keyword ( logLevelColors [ level ] ) ( `(${ level } )` )
1815 for ( const line of text . split ( '\n' ) ) {
19- this . output . write ( ` ${ label } ${ line } \n` )
16+ this . output . write ( ` ( ${ level } ) ${ line } \n` )
2017 }
2118 }
2219 }
You can’t perform that action at this time.
0 commit comments