Standardizes logging across multiple Javascript logging libraries, providing a consistent way to specify context, metadata, and errors.
a824b32
Thanks @theogravity! - Update README copy
Updates the README intro to sound less... odd.
#29 0d5a9c7
Thanks @theogravity! - Fixes child logger not inheriting plugins.
Before plugins, hooks were copied to the child logger, so this fix makes the behavior consistent with prior behavior.
The README for child loggers has been updated to include that plugins are now inherited.
74756da
Thanks @theogravity! - Add onMetadataCalled()
plugin callback to hook into withMetadata()
and metadataOnly()
calls.
See the README section on intercept metadata calls
for usage details.
a6fb176
Thanks @theogravity! - Refactor PluginManager
for performance improvements.#23 e6323b7
Thanks @theogravity! - Add signale
support
See README.md for more details.
#20 c3b5468
Thanks @theogravity! - Add log4js-node
support
See README.md for more details.
#22 2dfe830
Thanks @theogravity! - Add fatal
log level support
fatal()
method in loglayer
to write to a fatal
log level.
fatal
level will
be written as an error
level instead.#24 f989f15
Thanks @theogravity! - Add consola support
#15 c583c94
Thanks @theogravity! - Adds an optional id
field to plugins and the ability to manage plugins.
The following methods have been added:
LogLayer#removePlugin(id: string)
LogLayer#enablePlugin(id: string)
LogLayer#disablePlugin(id: string)
#13 d1a8cc2
Thanks @theogravity! - - Removes hooks and adds a plugin system where you can define multiple hooks to run instead.
Breaking Changes
hooks
option has been removedsetHooks()
method has been removedplugins
option has been addedaddPlugins()
method has been addedThere will be a way to remove / disable specific plugins in a future release.
Migrating from 3.x to 4.x
Your 3.x definition may look like this:
{
hooks: {
onBeforeDataOut: (data) => {
// do something with data
return data;
},
shouldSendToLogger: () => {
return true;
}
}
}
The 4.x version of this would look like this:
{
plugins: [
{
onBeforeDataOut: (data) => {
// do something with data
return data;
},
shouldSendToLogger: () => {
return true;
},
},
];
}
Type changes:
LogLayerHooksConfig
-> LogLayerPlugin
HookBeforeDataOutParams
-> PluginBeforeDataOutParams
HookBeforeDataOutFn
-> PluginBeforeDataOutFn
HookShouldSendToLoggerParams
-> PluginShouldSendToLoggerParams
HookShouldSendToLoggerFn
-> PluginShouldSendToLoggerFn
Summary:
hooks
with plugins
plugins
array where each entry is an object with the hook definitionSee the README.md
plugin section for more details.