1.1.0 • Published 9 years ago
steeplejack-bunyan v1.1.0
Steeplejack Bunyan
Bunyan implementation for steeplejack logger
Usage
To use, you will need to create a config dependency in the injector. This is a strategy object so, once you've done the initial configuration, everything is controlled by the Logger object.
The constructor
accepts anything that can be sent through to Bunyan's
createLogger factory method.
Inside the application, you're dealing with the Steeplejack logger class, so just use as normal.
Example
import {Logger} from "steeplejack/lib/logger";
import {Bunyan} from "steeplejack-bunyan";
/* Name for the injector */
const name = "$logger";
/* Factory function */
function config ($config) {
/* This accepts anything accepted by the Bunyan.createLogger method */
let opts = {
name: "loggerName"
};
return new Logger(new Bunyan(opts));
}
/* Define the output for the injector */
export let __config = {
name,
config
};