Loglayer Versions Save

Standardizes logging across multiple Javascript logging libraries, providing a consistent way to specify context, metadata, and errors.

v4.3.3

1 week ago

Patch Changes

  • a824b32 Thanks @theogravity! - Update README copy

    Updates the README intro to sound less... odd.

v4.3.2

3 weeks ago

Patch Changes

v4.3.1

3 weeks ago

Patch Changes

  • #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.

v4.3.0

3 weeks ago

Minor Changes

  • 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.

Patch Changes

v4.2.1

3 weeks ago

Patch Changes

v4.2.0

3 weeks ago

Minor Changes

v4.1.1

4 weeks ago

Patch Changes

v4.1.0

4 weeks ago

Minor Changes

  • #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)

v4.0.0

4 weeks ago

Major Changes

  • #13 d1a8cc2 Thanks @theogravity! - - Removes hooks and adds a plugin system where you can define multiple hooks to run instead.

    • Adds esm and cjs builds to the package

    Breaking Changes

    • The hooks option has been removed
    • The setHooks() method has been removed
    • A plugins option has been added
    • An addPlugins() method has been added

    There 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:

  • Replace hooks with plugins
  • For your existing hooks, move them into the plugins array where each entry is an object with the hook definition

See the README.md plugin section for more details.