This is a example of a very lightweight, stream based, node.js logger. It creates a "record" object for each log call, and pipe it throught the spicified streams. In the streams its possible to modifie the record, format the message, and many more.
Bunyan, there is no one responding on issues, Winstons is way to big and have unecesseray dependencies.
I wanted a lightweight, easy to use, expandable, stream based, logging utily with zero dependencies.
You can all merge this down into a single file. You bascily need class.logger.js
& levels.js
which can simple merged into a single file.
The other files (demo.js
, formatter.js
) are for demonstration & formatting and not needed for the functionality.
To add/remove logging levels, just import/require levels.js
before class.logger.js
and do what ever you want with the logging levels. If you want do that before you include the logger class, it automaticly apply the changes.
I mean... it is very simple, do what ever you want with this snippet ;)
Im thinking about to use utils.format
for the logging message formation when multiple arguments are passed.