2.1.0 • Published 9 months ago

@loglayer/plugin-filter v2.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Log filtering plugin for LogLayer

NPM Version NPM Downloads TypeScript

A plugin for LogLayer that filters log messages. You can filter logs using string patterns, regular expressions, or JSON Queries.

Installation

npm install @loglayer/plugin-filter

Usage

import { filterPlugin } from '@loglayer/plugin-filter';

// Create a filter that only allows error messages
const filter = filterPlugin({
  // checks the assembled message using an includes()
  messages: ['error'],
});

// Checks the level of the log
const levelFilter = filterPlugin({
  queries: ['.level == "error" or .level == "warn"'],
});

Configuration

The plugin accepts the following configuration options:

OptionTypeDescription
messagesArray<string \| RegExp>Optional. Array of string patterns or regular expressions to match against log messages
queriesstring[]Optional. Array of JSON queries to filter logs. A JSON Query filter() is applied, which each item being part of an OR condition
debugbooleanOptional. Enable debug mode for troubleshooting
disabledbooleanOptional. Disable the plugin

Documentation

For more details, visit https://loglayer.dev/plugins/filter

2.1.0

9 months ago

2.0.4

12 months ago

2.0.3

12 months ago

2.0.2

12 months ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago