2.1.0 • Published 8 months ago

@loglayer/plugin-filter v2.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 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

8 months ago

2.0.4

10 months ago

2.0.3

10 months ago

2.0.2

10 months ago

2.0.1

11 months ago

2.0.0

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

12 months ago

1.0.0

12 months ago