Loggie is a lovely logger for node.js which is SMART, SMALL, and EASY-TO-USE.
Loggie has few options, which makes it work at your will.
npm install loggie --save
For most cases, you could use loggie immediately with no extra configurations
var loggie = ;logger = ;logger; // will print a cyan 'install', space, and 'loggie'.
You could use typo template here to format your output.
There're several built-in log methods.
|Method)||Enabled By default)||Binded Argv)||Leading String)|
logger; // will do nothing
'debug' is not enabled by default.
But if you start your app with
logger.debug will be activated. Or, you could add
'debug' into log levels in loggie options or with
Will create a new loggie instance
options.level is just the loggie methods you want to activate. For example:
var logger =;
logger.warn('blah-blah') will be deactivated and do nothing.
If set to
'*', Loggie will enable all log methods.
If set to
true, Loggie will detect
'exit' event of process, if process exited without
logger.end() method, it will be considered as a failure.
var logger =;
And your environment variables (maybe on Mac OS) could be:
# file: ~/.profileexport MY_LOG_LEVEL=debug,info,error,warn
So, you can use local settings for debugging and development, and will never worry about the possible forgetness of changing debug configurations to production.
Then, we defined a log method
logger; // might print a bold cyan 'detail' with a underline, a whitespace, and an 'a'
logger.detail() will do nothing because it is not in the log level list(
options.level), but it will be activated if your app is started with '--detail' argument.
You can also use
logger.addLevel('detail') to add
'detail' to level list.
Define your own log method. You can also use this method to override existing log methods.
The name of the log method you want. If you
name = 'verbose', there will be a
A typo syntax template.
There are several built-in template parameters to be used:
'arguments': arguments joined by a single whitespace (
number: such as
'0', the argument at index
If you use the template, all arguments will be stringified
Will print: verbose(gray) mylabel mylabel blah error:blah-blah
The log method.
Notice that if
setting.template is defined,
setting.fn will be overridden.