import chalk from "chalk" ; import { EOL } from "os" ; import { Logger , LoggerOptions } from "./types" ; /**
 * Default prefix used when none is provided
 */ export const defaultPrefix = chalk . magenta ( "mono: " ) ; param { string } prefix param { string } message returns { string } const format = ( prefix , message ) : string => message . split ( EOL ) . filter ( ( line , index , array ) => ! ( index === array . length - 1 && line . trim ( ) . length === 0 ) ) . map ( ( line ) : string => `${ prefix }${ line . trimRight ( ) }` ) . join ( EOL ) ; param { Object } options returns { Object } export const createConsoleLogger = ( options = { prefix : defaultPrefix } ) : Logger => ( { error : ( message ) : void => { console . error ( format ( options . prefix , message ) ) ; } , log : ( message ) : void => { console . log ( format ( options . prefix , message ) ) ; } , warn : ( message ) : void => { console . warn ( format ( options . prefix , message ) ) ; } } ) ;