1.0.1 • Published 6 years ago
my-logger v1.0.1
MyLogger
yarn add my-loggerMy first packages. It prints fat colorized messages to STDOUT if you ask it to do so.
Exports
CusotomLogger- accepts a title (auth-serverorascii-poniesfor example), a type (panicordatafor example), and a message formatter; returns a logger that accepts a message and a message's metadata.Informer,Warning, andPanic- accepts a title (auth-serverorascii-poniesfor example); returns a logger that accepts a message and a message's metadata.
Example
const MyLogger = require('my-logger')
const colors = require('colors')
const infoLogger = MyLogger.Informer('permitLogServer')
const errorLogger = MyLogger.Panic('permitLogServer')
const warnLogger = MyLogger.Warning('permitLogServer')
const debugLogger = MyLogger.CusotomLogger('permitLogServer', 'DEBG', colors.cyan)
infoLogger('main - info', {
desc: 'hi, I\'m a friendly line',
isAllOk: true,
amIFine: true,
bestDay: new Date()
})
warnLogger('main - warn', {
desc: 'Houston, we have a problem',
isWeDieRightNow: false,
isDebugTime: true,
encouragingKitten: ':3'
})
errorLogger('main - error', {
desc: 'Panic, pls somebody halp!',
isAllBad: true
})
debugLogger('main - debug', {
desc: 'non-essential data',
commandArg: {
line: 'hello world',
startIndex: 0,
endIndex: 3
},
callback: 'hello',
error: null
})