import * as moment from 'moment' ; import { AnyError } from '../models/OtherTypes' ; import CaptainConstants from './CaptainConstants' ; function errorize ( error ) { if ( ! ( error instanceof Error ) ) { return new Error ( `Wrapped: ${ error ? error : 'NULL' }` ) ; } return error ; } function getTime ( ) { return `[36m${ moment ( ) . format ( 'MMMM Do YYYY, h:mm:ss.SSS a    ' ) }[0m` ; } class Logger { static d ( msg ) { console . log ( getTime ( ) + msg + '' ) ; } static w ( msg ) { console . log ( getTime ( ) + msg + '' ) ; } static dev ( msg ) { if ( CaptainConstants . isDebug ) { console . log ( `${ getTime ( ) }########### ${ msg }` ) ; } } static e ( msgOrError ) { const err = errorize ( msgOrError ) ; console . error ( `${ getTime ( ) + err }
${ err . stack }` ) ; } } export default Logger ;