npm install herodotus
herodotus logger is wrapper over bunyan to allow for easy log management inside of projects that consist of several in house libraries. This library makes sure that logs both end up in the right place and are delivered with necessary meta information.
The goal of
herodotus is to make logging with a large number of libraries that are being used in many different situations easy. Lets consider a project with the following dependency structure:
email@example.com └─┬ firstname.lastname@example.org └── email@example.com
herodotus this project will log out to a file called
foo.log and will name space
firstname.lastname@example.org. There will also be a
foo-error.log file for error level messages. The log file will have all levels of messages (eg trace and higher) and anything info and higher will be logged to stdout.
Lets dig a little deeper, lets say that we now require
foo in a project called
email@example.com └─┬ firstname.lastname@example.org ├ email@example.com └── ...
herodotus will log to
main.log with the same name spacing structure as before. Additionally, the log file will differentiate between
bar1.2.0 making it easy to see errant behavior between different versions of libraries.
herodotus it is easy to manage log files as your libraries and services grow in complexity.
herodotus will only log to a file if there is a main module for the process. If there is no main module (eg a package is included from the node REPL) then
herodotus will only log to stdout.
herodotus is easy to set up:
// preferred way:var log = ;// orlog = name version;
log variable is just an instance of the bunyan logger, so feel free to use it as you would any bunyan instance.
and now your logs are ready to go!
herodotus will look for
process.env.NODE_LOG_LOCATION as a directory to write log files to. If this is not found then
herodotus will default to