import { getPretty } from '@neo-one/logger-config' ; import pino from 'pino' ; const createLogger = ( service , options = { } ) => options . browser !== undefined ? pino ( { ... options , base : { service } , prettyPrint : service === 'cli' ? true : getPretty ( ) } ) : pino ( { ... options , base : { service } , prettyPrint : service === 'cli' ? true : getPretty ( ) } , process . env . NODE_ENV === 'production' ? pino . extreme ( 1 ) : pino . destination ( 1 ) ) ; const browserOptions = typeof window === 'undefined' && typeof origin === 'undefined' ? { } : { browser : { asObject : true } } ; export const editorLogger = createLogger ( 'editor-server' , browserOptions ) ; export const serverLogger = createLogger ( 'server' , browserOptions ) ; export const nodeLogger = createLogger ( 'node' , browserOptions ) ; export const rpcLogger = createLogger ( 'rpc' , browserOptions ) ; export const cliLogger = createLogger ( 'cli' , browserOptions ) ; export const httpLogger = createLogger ( 'http' , browserOptions ) ; export const testLogger = createLogger ( 'test' , browserOptions ) ; let loggers = [ editorLogger , serverLogger , nodeLogger , rpcLogger , cliLogger , httpLogger , testLogger , ] ; export const setGlobalLogLevel = ( level ) => loggers . forEach ( ( logger ) => { logger . level = level ; } ) ; export const getFinalLogger = ( logger ) => pino . final ( logger ) ; export const createChild = ( parent , bindings ) => { const child = parent . child ( bindings ) ; loggers = loggers . concat ( child ) ; return child ; } ;