bunyan-logdna-stream
Write log to LogDNA by using Bunyan with optional context and message formatting.
Install
$ npm install bunyan-logdna-stream --save
Usage
const logdna = const bunyan = const bunyanLogdna = // create logdna clientconst client = logdnaconst stream = client // create bunyan loggerconst logger = bunyan
When you creating LogDnaStream
you can pass options to customize message
.
// setup your streamconst stream = client formatMessage: message record return ` (type=)` // log messagelogger // logdna message: "server is running (type=server)"
Or customize context
(additional log data shown in logdna after expand log message). By default all your
extra data will be in context including hostname
and pid
.
// setup your streamconst stream = client formatContext: context record contextuser = 'user123' // context: "hostname": "..." "pid": 1234 "user": "user123" // extra context info
Contributing
When submitting your pull-request try to follow those guides:
- https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github
- https://medium.com/@vadimdemedes/making-your-first-contribution-de6576ddb190
Licence
MIT © Dusan Kmet