Skip to content

Releases: theogravity/loglayer

v4.3.0

08 May 23:39
8c83476
Compare
Choose a tag to compare

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

06 May 02:32
d9729b3
Compare
Choose a tag to compare

Patch Changes

v4.2.0

06 May 01:52
831fea6
Compare
Choose a tag to compare

Minor Changes

v4.1.1

04 May 04:30
50bcfc0
Compare
Choose a tag to compare

Patch Changes

v4.1.0

04 May 00:29
43b7ab7
Compare
Choose a tag to compare

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

03 May 23:41
a32ad3e
Compare
Choose a tag to compare

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.