@ist-group/dynamic-bunyan-seq
v3.2.0
Published
The purpose of this module is to control the seq log level dynamically from the seq server interface.
Downloads
30
Readme
Dynamic bunyan seq
The purpose of this module is to control the seq log level dynamically from the seq server interface.
Install
yarn add @ist-group/dynamic-bunyan-seq
Usage
import { createAttachDynamicSeq } from "@ist-group/dynamic-bunyan-seq";
const logger = bunyan.createLogger({
name: "Logger-name",
src: true
});
const { update, seqStream, flush } = createAttachDynamicSeq({
bunyanLogger: logger,
seqHost: config.SEQ_HOST,
seqApiKey: config.SEQ_API_KEY
});
update: poll new log level
flush: flush the buffer, useful when the service is about to die
seqStream: the object that is given from require("bunyan-seq").createStream()
| Param | required | Default | Description | | -------------- | -------- | ------- | --------------------------- | | bunyanLogger | yes | - | The Bunyan logger object | | seqHost | yes | - | ex: https://seq.example.com | | seqApiKey | no | - | Seq api key | | requestTimeout | no | 30 000 | request timeout in ms |
Additional: Formated output
Also included is a tool to display console output with included properties (the seq way)
Usage
Pipe output from node into bunyan-seq-format:
node build/server.js | ./node_modules/.bin/bunyan-seq-format -o short
Example of log:
logger.info(
{ status: 200, statusMessage: "Ok" },
"Request finished with status: {status} and message: {statusMessage}"
);