Bunyan Logger Manager
Bunyan loggers over REST
Express middleware to update the log level of yournpm install bunyan-logger-manager
Example usage:
Include the module in your server.js and add it as middleware, passing in the loggers
IMPORTANT: the 'body-parser' package is required and should be added as middleware BEFORE this for this to work as expected*
// server.jsvar bodyParser = var bunyanLoggerManager = var logger1 = bunyan var logger2 = bunyan var app = // bodyParser.json() must be used *before* this middlewareappapp app
GET '/log-level' for the current loggers and levels:
Update the log level using PUT to '/log-level':
Request body:
/* PUT request body */ "loggerName": "logger1" "level": "WARN"
The response body will be the same as the request if the update completed successfully (with status 200 - OK)
/* 200 - OK */ "loggerName": "logger1" "level": "WARN"
In the case of errors (e.g. invalid logger, logLevel), a 400 statusCode will be given with error messages:
/* 400 - Bad Request */ "loggerName": "logger1" "level": "WARN" "errors": "Invalid log level of 'UNICORN' specified"