This logger is very basic. It does the logging for node.
It supports custom levels and display of file name and function name and line number of output location.
npm install amuyu-logger --savevar logger = require('amuyu-logger')
function test() {
// message -----------+
// level ---+ |
// v v
logger.log('Hello world')
}
test()example output:
// <fileName>: <functionName>(lineNumber) message
test.js: test(10) helloworld
log.level
- log.log(message, ...)
- log.info(message, ...)
- log.warn(message, ...)
- log.error(message, ...)
Sets up a new level
level{String} Level indicatorstyle{Object} Object with fg, bg, inverse, etc.
var logger = require('amuyu-logger')
logger.addLevel('test', { fg: 'green', bg: 'black' })
logger.test('hello')Style objects can have the following fields:
fg{String} Color for the foreground textbg{String} Color for the backgroundbold,inverse,underline{Boolean} Set the associated propertybell{Boolean} Make a noise (This is pretty annoying, probably.)
More features are available in npmlog.