Skip to content

Setting the level of a Bunyan logger and all its children at once

Notifications You must be signed in to change notification settings

telecomsante/bunyan-tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The bunyan tree

For developers, you must comply with the release procedure described in the changelog.

A current limitation of bunyan is that one cannot set the level of a logger and all its children at once.

bunyan-tree provides this feature at the cost of being a slightly more verbose during log objects declarations.

In fact, level is not the only method that can be applied recursively to a whole bunyan tree, recursive versions of all bunyan methods are available in the tree attribute of a logger.

Install

npm install --save bunyan-tree

Usage

Here is a simple usage example:

main.js:

var someModule = require('./someModule');
var log = require('bunyan-tree');

log.seed({ /* bunyan options */});

log.tree.level('warning');

someModule();

someModule.js:

var log = require('bunyan-tree').fork({/* child options, i.e. component name (component: 'myComponent') */});

log.info('this will be logged');

module.exports = function () {
	log.info('this will not be logged');
};

About

Setting the level of a Bunyan logger and all its children at once

Resources

Stars

Watchers

Forks

Packages

No packages published