@@ -17,25 +17,11 @@ if (typeof process.env.CONFIG_DIR === 'string') {
1717 logPath = path . resolve ( process . env . CONFIG_DIR , './logs' ) ;
1818}
1919
20- // docker stdout only colorizes if run with `-it` flag or `tty: true` in docker-compose
21- // but most common outputs and web log viewers (portainer, dozzle) support colors and using those flags/options is not common for most users
22- // so
23- // set COLORED_CONSOLE=true in Dockerfile to coerce colorizing output when running in our docker container.
24- // and using this instead of FORCE_COLOR (used by colorette) so that we only affect console output instead of all streams
25- const coloredEnv = process . env . COLORED_CONSOLE ;
26- const coloredConsole = ( coloredEnv === undefined || coloredEnv === '' ) ? undefined : parseBool ( process . env . COLORED_CONSOLE ) ;
27- const prettyDefaults : PrettyOptionsExtra = { } ;
28- // colorette only does autodetection if `colorize` prop is not present *at all*, rather than just being undefined
29- // so need to use default object and only add if we detect there is a non-empty value
30- if ( coloredConsole !== undefined ) {
31- prettyDefaults . colorize = coloredConsole ;
32- }
33-
3420export const initLogger = ( ) : [ FoxLogger , Transform ] => {
3521 const opts = parseLogOptions ( { file : false , console : 'debug' } )
3622 const stream = new PassThrough ( { objectMode : true } ) ;
3723 const logger = buildLogger ( 'debug' , [
38- buildDestinationStdout ( opts . console , prettyDefaults ) ,
24+ buildDestinationStdout ( opts . console ) ,
3925 buildDestinationJsonPrettyStream ( opts . console , { destination : stream , object : true , colorize : true } )
4026 ] ) ;
4127 return [ logger , stream ] ;
@@ -54,8 +40,7 @@ export const appLogger = async (config: FoxLogOptions = {}): Promise<[FoxLogger,
5440 logBaseDir : typeof process . env . CONFIG_DIR === 'string' ? process . env . CONFIG_DIR : undefined ,
5541 destinations : [
5642 buildDestinationJsonPrettyStream ( opts . console , { destination : stream , object : true , colorize : true } )
57- ] ,
58- pretty : prettyDefaults
43+ ]
5944 } ) ;
6045 return [ logger , stream ] ;
6146}
0 commit comments