Logging is an important part of any application. It outputs in a readable form the things that happen inside your
application. As Node.js has its default
console logger, thorin provides the default
logging functionality and uses the console to output data.
You can always use loglet.io as the centralized logging storage, by using the loglet plugin.
Thorin enables you to create namespaced loggers for various parts of your application, and enable you
to manually configure every one of them. As an example, you might want to create a
for when you process payments, so that if you use centralized logging, it would be easier for you to search
after the payment logger name.
The thorin logger can be viewed as a continuous stream of events, with a default handler that outputs to the console.
If you want to pipe your log entries to a separate target, you can just use
log.pipe() and receive
the stream of log events.
As previously said, you can create as many namespaced loggers as you wish, calling the function below.
'use strict'; const thorin = require('thorin'); const pLogger = thorin.logger('payment'); pLogger.info(`This is my payment logger`); // outputs [INFO] [2016-08-01 18:16:19.935] [payment] This is my payment logger log.info(`This is the default logger`); // outputs [INFO] [2016-08-01 18:16:19.935] [default] This is the default logger
Console logging can be globally enabled or disabled by calling
console.loglogs with the default logger.
Logs can be piped either from the global logger or for specific namespaces by calling
You can always create a new issue on GitHub or contact one of the core founders by chat.