Skip to content

Releases: theogravity/loglayer

v4.4.0

28 May 07:25
8fa956a
Compare
Choose a tag to compare

Minor Changes

  • #33 1d67e1f Thanks @theogravity! - Fix ILogLayer return types

    ILogLayer#withPrefix() and ILogLayer#withChild() were of the incorrect return type.

    Changed to ILogLayer<ExternalLogger, ErrorType>.

v4.3.3

20 May 18:38
bf50089
Compare
Choose a tag to compare

Patch Changes

  • a824b32 Thanks @theogravity! - Update README copy

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

v4.3.2

09 May 19:44
48c90d8
Compare
Choose a tag to compare

Patch Changes

v4.3.1

09 May 18:29
4f61221
Compare
Choose a tag to compare

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

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.