- ClientLogger
- ClientConsoleLogger
- ClientLogentriesLogger
- ClientRollbarLogger
- NodeLogger
- BUNYAN_CONFIG_FIELDS
- DEFAULT_ROOT_FIELDS
- BUNYAN_LOGGER_LEVELS
- DEFAULT_CONFIG
- assembleConfig
- toBunyanConfig
- logForLevel
- logIt
- ServerRollbarLogger
- bunyanToRollbarLevelMap
- bunyanLevelToRollbarLevelName
- ServerLogentriesLogger
- createRequestLogger
- requestLoggerMiddleware
A logger than can be used in browsers
Parameters
config
Object we-js-logger config (optional, default{}
)logger
Object? an instance of abunyan
logger to use internally. this is meant to be used by thechild
method.
src/util/client/consoleLogger.js:9-9
Pretty logging to console
for client applications
src/util/client/consoleLogger.js:16-48
Transport to console
Parameters
data
Object (optional, default{}
)
Returns undefined
src/util/client/logentriesLogger.js:10-23
Custom bunyan stream that transports to Logentries from client applications
Parameters
$0
Object$0.name
$0.token
src/util/client/logentriesLogger.js:30-37
Transport logs to Logentries
Parameters
data
Object (optional, default{}
)
Returns undefined
src/util/client/rollbarLogger.js:21-37
Custom rollbar stream that transports to logentries from a browser Wortks with a global Rollbar instance that is already initialized. Note this expects rollbar to be loaded in the head, not via an npm module. See https://rollbar.com/docs/notifier/rollbar.js/#quick-start for details on integrating Rollbar in client apps
Parameters
$0
Object$0.token
$0.environment
$0.codeVersion
src/util/client/rollbarLogger.js:44-56
Transport logs to Rollbar
Parameters
data
Object (optional, default{}
)
Returns undefined
A logger than can be used in node processes
Parameters
config
Object we-js-logger config (optional, default{}
)logger
Object? an instance of abunyan
logger to use internally. this is meant to be used by thechild
method.
src/util/common/config.js:9-14
Config keys that should always be passed to
bunyan.createLogger
src/util/common/config.js:22-26
Whitelist of extra config keys that should be
passed to bunyan.createLogger
to form
root logger fields.
src/util/common/config.js:33-33
Array of bunyan's different log levels. https://github.com/trentm/node-bunyan#levels
src/util/common/config.js:36-48
src/util/common/config.js:61-68
Merges config with DEFAULT_CONFIG, and appends passed in streams with pre-configured streams for the runtime.
This is used to configure this library, not bunyan as it has a lot of
extra information. See toBunyanConfig
below.
Parameters
Returns Object runtimeConfig
src/util/common/config.js:79-81
Create a config objct for bunyan from a full we-js-logger
config object.
Extra keys passed to bunyan.createLogger
become root logger fields, pass
a custom config.rootFields
to control this behavior
Parameters
Returns Object config for bunyan.createLogger
src/util/common/logForLevel.js:10-22
Creates a log method for a particular level
Parameters
level
String
Returns Function
src/util/common/logForLevel.js:19-21
Log at a level. Must be bound to a logger instance.
Parameters
args
any
Returns undefined
src/util/server/rollbarLogger.js:12-21
Custom bunyan stream that transports to Rollbar from a node process. See https://rollbar.com/docs/notifier/node_rollbar/ for integration details
Parameters
token
Object , codeVersion, and environmenttoken.token
token.codeVersion
token.environment
src/util/server/rollbarLogger.js:31-44
handles err
and req
properties, attaches any custom data,
and calls the appropriate Rollbar method.
Parameters
data
Object (optional, default{}
)
Returns undefined
src/util/common/rollbar.js:11-18
Map of bunyan log levels to Rollbar levels https://github.com/trentm/node-bunyan#levels https://rollbar.com/docs/notifier/rollbar.js/api/#rollbardebuginfowarnwarningerrorcritical
src/util/common/rollbar.js:25-28
Convert bunyan log level to rollbar level. Defaults to 'error'.
Parameters
level
String bunyan log level (optional, defaultbunyan.ERROR
)
Returns String Rollbar log level
src/util/server/logentriesLogger.js:10-20
Custom bunyan stream that transports to logentries from a node process
Parameters
Returns Object bunyan stream config
src/util/server/requestLogger.js:12-48
Create a request loging express middleware
Parameters
logger
Object a logger instanceoptions
Object (optional, default{}
)options.reqIdHeader
String? (optional, defaultDEFAULT_HEADER_NAME
)
Returns Function
src/util/server/requestLogger.js:24-47
Request Logger Middleware
Adds base logging to every request
Attaches a log
child to each request object
Parameters
Returns undefined