0.1.2 • Published 9 years ago

bunyanizer v0.1.2

Weekly downloads
4
License
ISC
Repository
github
Last release
9 years ago

bunyanizer

Bunyanizer is basically a bunyan constructor with the reqSerializer and an added method bunyanizer.jsonLog(message).

.jsonify(obj/string)

This function is a wrapper to bunyan.info() but it checks first if its JSON or a string and call the bunyan.info().

Its a simple function that wraps bunyan.info to make sure its JSON.

TjsonLog() just checks if the string can be parsed by JSON then log it as is. Else if it's not parseable, it turns it into an object by wrapping it up like this: {msg: '<your-log-here>' }.

If its neither JSON, not a string, it will call bunyan's default log.info("").

"sensible" defaults and more..

see examples/simpleObjectLog.js for more details on how to use fluentd for example. You just pass in a stream name

Basically, just need to call the .construct({name:<your-app-name>}) method and voila a new Bunyan object with a simple request 'reqSerializer' function is created.

re:Streams

Btw you can pass in a stream-name if you want,then modify bunyanizer's construct() mechanism to instantiate an appropriate stream when you call bunyanizer.

In index.js you can check what to do there.

An example in my index.js is instantiating the fluentLogger. You need to npm install fluent-logger-node btw for that to work.

License

ISC.

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.1

9 years ago