Skip to content

ybybzj/express-bunyan-logger2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Express-bunyan-logger2

Fork of express-bunyan-logger, credit for express-bunyan-logger

Added Option

color [Boolean|Object]

default: false

default color scheme:

{
    'remote-address': 'white',
    'user-agent': 'yellow',
    'status-code': 'cyan',
    'response-time': 'green',
    'short-body': 'gray',
    'body': 'gray'
}

Value of color scheme object can be a function, and the value of meta[property] will be passed in to the function. Like,

{
    'response-time': function(resTime){
        //'resTime' is equal to 'meta['response-time']'
        return resTime < 200 ? 'green': 'red';
    }
}

excludes [String|[String]]

default: []

The final meta properies will be computed according to the value of excludes.

Default meta properties are:

[
    'remote-address',
    'ip',
    'method',
    'url',
    'referer',
    'user-agent',
    'body',
    'short-body',
    'http-version',
    'response-time',
    "response-hrtime",
    "status-code",
    'req-headers',
    'res-headers',
    'req',
    'res',
    'incoming'
]

If you don't want some properties to be logged, just include their names in the excludes option.

Put ! before the name if you do want include the property. Useful when '*' is passed in, and you still want several of them to be included.

About

a fork of express-bunyan-logger

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.0%
  • Makefile 1.0%