@loglayer/plugin-filter 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -76,25 +76,42 @@ var FilterExecutor = class {
76
76
  if (!_optionalChain([this, 'access', _7 => _7.config, 'access', _8 => _8.queries, 'optionalAccess', _9 => _9.length])) {
77
77
  return false;
78
78
  }
79
- const query = this.config.queries.map((q) => `(${q.replaceAll(`'`, `"`)})`).join(" or ");
80
79
  const queryContext = {
81
80
  level: this.context.logLevel,
82
81
  message: this.context.message,
83
82
  data: this.context.data
84
83
  };
85
84
  try {
86
- if (this.config.debug) {
87
- this.context.debugItems.push(`[filter-plugin] query: filter(${query})`);
88
- this.context.debugItems.push(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);
89
- }
90
- const output = _jsonquery.jsonquery.call(void 0, [queryContext], `filter(${query})`);
91
- if (this.config.debug) {
92
- this.context.debugItems.push(`[filter-plugin] query match: ${output.length > 0}`);
85
+ for (const q of this.config.queries) {
86
+ const conditions = q.split(" or ").map((cond) => `filter(${cond.trim().replaceAll(`'`, `"`)})`);
87
+ const query = conditions.join(" or ");
88
+ if (this.config.debug) {
89
+ this.context.debugItems.push(`[filter-plugin] query: filter(${query})`);
90
+ this.context.debugItems.push(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);
91
+ }
92
+ for (const condition of conditions) {
93
+ try {
94
+ const output = _jsonquery.jsonquery.call(void 0, [queryContext], condition);
95
+ if (output.length > 0) {
96
+ if (this.config.debug) {
97
+ this.context.debugItems.push(`[filter-plugin] query match: ${output.length > 0}`);
98
+ }
99
+ return true;
100
+ }
101
+ } catch (e) {
102
+ console.error(`[filter-plugin] Error: ${e}`);
103
+ console.log(`[filter-plugin] query: ${condition}`);
104
+ console.log(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);
105
+ }
106
+ }
107
+ if (this.config.debug) {
108
+ this.context.debugItems.push("[filter-plugin] query match: false");
109
+ }
93
110
  }
94
- return output.length > 0;
111
+ return false;
95
112
  } catch (e) {
96
113
  console.error(`[filter-plugin] Error: ${e}`);
97
- console.log(`[filter-plugin] query: filter(${query})`);
114
+ console.log(`[filter-plugin] queries: ${JSON.stringify(this.config.queries)}`);
98
115
  console.log(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);
99
116
  return false;
100
117
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/loglayer/loglayer/packages/plugins/filter/dist/index.cjs","../src/FilterExecutor.ts","../src/plugin.ts"],"names":[],"mappings":"AAAA;ACAA,qDAA0B;AAyBnB,IAAM,eAAA,EAAN,MAAqB;AAAA,EACT;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOR,WAAA,CAAY,MAAA,EAA4B;AACtC,IAAA,IAAA,CAAK,OAAA,EAAS,MAAA;AACd,IAAA,IAAA,CAAK,QAAA,EAAU;AAAA,MACb,OAAA,EAAS,EAAA;AAAA,MACT,QAAA,EAAU,EAAA;AAAA,MACV,IAAA,EAAM,CAAC,CAAA;AAAA,MACP,UAAA,EAAY,CAAC;AAAA,IACf,CAAA;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOQ,YAAA,CAAa,MAAA,EAA8C;AACjE,IAAA,IAAA,CAAK,QAAA,EAAU;AAAA,MACb,OAAA,kBAAS,MAAA,mBAAO,QAAA,6BAAU,IAAA,mBAAK,GAAG,IAAA,GAAK,EAAA;AAAA,MACvC,QAAA,EAAU,MAAA,CAAO,QAAA;AAAA,MACjB,IAAA,EAAM,MAAA,CAAO,KAAA,GAAQ,CAAC,CAAA;AAAA,MACtB,UAAA,EAAY,CAAC,mDAAmD;AAAA,IAClE,CAAA;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKQ,eAAA,CAAA,EAAwB;AAC9B,IAAA,GAAA,CAAI,IAAA,CAAK,MAAA,CAAO,KAAA,EAAO;AACrB,MAAA,IAAA,CAAA,MAA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;AACT,IAAA;AAGsC,IAAA;AACjB,IAAA;AACd,IAAA;AACT,EAAA;AACF;AD9CoF;AACA;AEtGX;AAC7B,EAAA;AAEnC,EAAA;AACM,IAAA;AACM,IAAA;AAC+C,IAAA;AAClC,MAAA;AAC9B,IAAA;AACF,EAAA;AACF;AFuGoF;AACA;AACA","file":"/home/runner/work/loglayer/loglayer/packages/plugins/filter/dist/index.cjs","sourcesContent":[null,"import { jsonquery } from \"@jsonquerylang/jsonquery\";\nimport type { PluginShouldSendToLoggerParams } from \"@loglayer/plugin\";\nimport type { filterPluginParams } from \"./types.js\";\n\n/**\n * Internal context for the filter execution.\n * Contains the current log message details and debug information.\n */\ninterface FilterContext {\n /** The combined log message */\n message: string;\n /** The log level */\n logLevel: string;\n /** Additional log data */\n data: Record<string, any>;\n /** Debug messages for troubleshooting */\n debugItems: string[];\n}\n\n/**\n * Core filtering logic implementation.\n * Handles pattern matching and query-based filtering of log messages.\n *\n * @internal\n */\nexport class FilterExecutor {\n private readonly config: filterPluginParams;\n private context: FilterContext;\n\n /**\n * Creates a new FilterExecutor instance.\n *\n * @param config - The filter plugin configuration\n */\n constructor(config: filterPluginParams) {\n this.config = config;\n this.context = {\n message: \"\",\n logLevel: \"\",\n data: {},\n debugItems: [],\n };\n }\n\n /**\n * Resets the context for a new log message check.\n *\n * @param params - The log message parameters\n */\n private resetContext(params: PluginShouldSendToLoggerParams): void {\n this.context = {\n message: params.messages?.join(\" \") || \"\",\n logLevel: params.logLevel,\n data: params.data || {},\n debugItems: [\"[filter-plugin] =================================\"],\n };\n }\n\n /**\n * Prints debug information if debug mode is enabled.\n */\n private printDebugItems(): void {\n if (this.config.debug) {\n for (const item of this.context.debugItems) {\n console.log(item);\n }\n }\n }\n\n /**\n * Checks if the current message matches any of the configured patterns.\n * Supports both string and RegExp patterns.\n *\n * @returns true if any pattern matches, false otherwise\n */\n private checkMessagePatterns(): boolean {\n if (!this.config.messages?.length) {\n return false;\n }\n\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] message: ${this.context.message}`);\n }\n\n for (const pattern of this.config.messages) {\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] pattern: ${pattern}`);\n }\n\n const matches =\n typeof pattern === \"string\" ? this.context.message.includes(pattern) : pattern.test(this.context.message);\n\n if (matches) {\n this.context.debugItems.push(\"[filter-plugin] pattern match: true\");\n return true;\n }\n\n this.context.debugItems.push(\"[filter-plugin] pattern match: false\");\n }\n\n return false;\n }\n\n /**\n * Checks if the current message matches any of the configured queries.\n * Uses @jsonquerylang/jsonquery for query execution.\n *\n * @returns true if any query matches, false otherwise\n */\n private checkQueries(): boolean {\n if (!this.config.queries?.length) {\n return false;\n }\n\n const query = this.config.queries.map((q) => `(${q.replaceAll(`'`, `\"`)})`).join(\" or \");\n const queryContext = {\n level: this.context.logLevel,\n message: this.context.message,\n data: this.context.data,\n };\n\n try {\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] query: filter(${query})`);\n this.context.debugItems.push(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);\n }\n\n const output = jsonquery([queryContext], `filter(${query})`) as Array<any>;\n\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] query match: ${output.length > 0}`);\n }\n\n return output.length > 0;\n } catch (e) {\n console.error(`[filter-plugin] Error: ${e}`);\n console.log(`[filter-plugin] query: filter(${query})`);\n console.log(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);\n return false;\n }\n }\n\n /**\n * Checks if a log message should be allowed based on the configured filters.\n *\n * The filtering logic is:\n * 1. If no filters defined, allow all logs\n * 2. If message patterns match, allow the log\n * 3. If queries match, allow the log\n * 4. Otherwise, filter out the log\n *\n * @param params - The log message parameters\n * @returns true if the log should be allowed, false otherwise\n */\n check(params: PluginShouldSendToLoggerParams): boolean {\n this.resetContext(params);\n\n // If no filters defined at all, allow everything\n if (!this.config.messages?.length && !this.config.queries?.length) {\n this.context.debugItems.push(\"[filter-plugin] no filters defined, allowing message\");\n this.printDebugItems();\n return true;\n }\n\n // Check message patterns first\n if (this.checkMessagePatterns()) {\n this.printDebugItems();\n return true;\n }\n\n // Then check queries if message patterns didn't match\n const queryResult = this.checkQueries();\n this.printDebugItems();\n return queryResult;\n }\n}\n","import type { LogLayerPlugin, PluginShouldSendToLoggerParams } from \"@loglayer/plugin\";\nimport { FilterExecutor } from \"./FilterExecutor.js\";\nimport type { filterPluginParams } from \"./types.js\";\n\n/**\n * Creates a new filter plugin instance.\n *\n * The filter plugin allows filtering log messages based on:\n * - String patterns\n * - Regular expressions\n * - JSON queries\n *\n * @example\n * ```typescript\n * // Filter error messages\n * const filter = filterPlugin({\n * messages: ['error'],\n * });\n *\n * // Filter by log level\n * const levelFilter = filterPlugin({\n * queries: ['.level == \"error\" or .level == \"warn\"'],\n * });\n * ```\n *\n * @param config - The filter plugin configuration\n * @returns A LogLayer plugin instance\n */\nexport function filterPlugin(config: filterPluginParams): LogLayerPlugin {\n const executor = new FilterExecutor(config);\n\n return {\n id: config.id,\n disabled: config.disabled,\n shouldSendToLogger: (params: PluginShouldSendToLoggerParams) => {\n return executor.check(params);\n },\n };\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/loglayer/loglayer/packages/plugins/filter/dist/index.cjs","../src/FilterExecutor.ts","../src/plugin.ts"],"names":[],"mappings":"AAAA;ACAA,qDAA0B;AAyBnB,IAAM,eAAA,EAAN,MAAqB;AAAA,EACT;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOR,WAAA,CAAY,MAAA,EAA4B;AACtC,IAAA,IAAA,CAAK,OAAA,EAAS,MAAA;AACd,IAAA,IAAA,CAAK,QAAA,EAAU;AAAA,MACb,OAAA,EAAS,EAAA;AAAA,MACT,QAAA,EAAU,EAAA;AAAA,MACV,IAAA,EAAM,CAAC,CAAA;AAAA,MACP,UAAA,EAAY,CAAC;AAAA,IACf,CAAA;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOQ,YAAA,CAAa,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C,MAAA;AACE,MAAA;AACH,MAAA;AACrB,IAAA;AAEI,IAAA;AAEmC,MAAA;AAEoC,QAAA;AACnC,QAAA;AAEb,QAAA;AACiD,UAAA;AACA,UAAA;AACxE,QAAA;AAGoC,QAAA;AAC9B,UAAA;AACgD,YAAA;AAC3B,YAAA;AACE,cAAA;AAC+C,gBAAA;AACtE,cAAA;AACO,cAAA;AACT,YAAA;AACU,UAAA;AACiC,YAAA;AACM,YAAA;AACmB,YAAA;AAEtE,UAAA;AACF,QAAA;AAEuB,QAAA;AAC4C,UAAA;AACnE,QAAA;AACF,MAAA;AAEO,MAAA;AACG,IAAA;AACiC,MAAA;AACkC,MAAA;AACT,MAAA;AAC7D,MAAA;AACT,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcuD,EAAA;AAC7B,IAAA;AAG2C,IAAA;AACpC,MAAA;AACR,MAAA;AACd,MAAA;AACT,IAAA;AAGiC,IAAA;AACV,MAAA;AACd,MAAA;AACT,IAAA;AAGsC,IAAA;AACjB,IAAA;AACd,IAAA;AACT,EAAA;AACF;ADnDoF;AACA;AEvHX;AAC7B,EAAA;AAEnC,EAAA;AACM,IAAA;AACM,IAAA;AAC+C,IAAA;AAClC,MAAA;AAC9B,IAAA;AACF,EAAA;AACF;AFwHoF;AACA;AACA","file":"/home/runner/work/loglayer/loglayer/packages/plugins/filter/dist/index.cjs","sourcesContent":[null,"import { jsonquery } from \"@jsonquerylang/jsonquery\";\nimport type { PluginShouldSendToLoggerParams } from \"@loglayer/plugin\";\nimport type { filterPluginParams } from \"./types.js\";\n\n/**\n * Internal context for the filter execution.\n * Contains the current log message details and debug information.\n */\ninterface FilterContext {\n /** The combined log message */\n message: string;\n /** The log level */\n logLevel: string;\n /** Additional log data */\n data: Record<string, any>;\n /** Debug messages for troubleshooting */\n debugItems: string[];\n}\n\n/**\n * Core filtering logic implementation.\n * Handles pattern matching and query-based filtering of log messages.\n *\n * @internal\n */\nexport class FilterExecutor {\n private readonly config: filterPluginParams;\n private context: FilterContext;\n\n /**\n * Creates a new FilterExecutor instance.\n *\n * @param config - The filter plugin configuration\n */\n constructor(config: filterPluginParams) {\n this.config = config;\n this.context = {\n message: \"\",\n logLevel: \"\",\n data: {},\n debugItems: [],\n };\n }\n\n /**\n * Resets the context for a new log message check.\n *\n * @param params - The log message parameters\n */\n private resetContext(params: PluginShouldSendToLoggerParams): void {\n this.context = {\n message: params.messages?.join(\" \") || \"\",\n logLevel: params.logLevel,\n data: params.data || {},\n debugItems: [\"[filter-plugin] =================================\"],\n };\n }\n\n /**\n * Prints debug information if debug mode is enabled.\n */\n private printDebugItems(): void {\n if (this.config.debug) {\n for (const item of this.context.debugItems) {\n console.log(item);\n }\n }\n }\n\n /**\n * Checks if the current message matches any of the configured patterns.\n * Supports both string and RegExp patterns.\n *\n * @returns true if any pattern matches, false otherwise\n */\n private checkMessagePatterns(): boolean {\n if (!this.config.messages?.length) {\n return false;\n }\n\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] message: ${this.context.message}`);\n }\n\n for (const pattern of this.config.messages) {\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] pattern: ${pattern}`);\n }\n\n const matches =\n typeof pattern === \"string\" ? this.context.message.includes(pattern) : pattern.test(this.context.message);\n\n if (matches) {\n this.context.debugItems.push(\"[filter-plugin] pattern match: true\");\n return true;\n }\n\n this.context.debugItems.push(\"[filter-plugin] pattern match: false\");\n }\n\n return false;\n }\n\n /**\n * Checks if the current message matches any of the configured queries.\n * Uses @jsonquerylang/jsonquery for query execution.\n *\n * @returns true if any query matches, false otherwise\n */\n private checkQueries(): boolean {\n if (!this.config.queries?.length) {\n return false;\n }\n\n const queryContext = {\n level: this.context.logLevel,\n message: this.context.message,\n data: this.context.data,\n };\n\n try {\n // Process each query individually and return true if any match\n for (const q of this.config.queries) {\n // Split OR conditions and wrap each in filter()\n const conditions = q.split(\" or \").map((cond) => `filter(${cond.trim().replaceAll(`'`, `\"`)})`);\n const query = conditions.join(\" or \");\n\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] query: filter(${query})`);\n this.context.debugItems.push(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);\n }\n\n // Try each condition separately\n for (const condition of conditions) {\n try {\n const output = jsonquery([queryContext], condition) as Array<any>;\n if (output.length > 0) {\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] query match: ${output.length > 0}`);\n }\n return true;\n }\n } catch (e) {\n console.error(`[filter-plugin] Error: ${e}`);\n console.log(`[filter-plugin] query: ${condition}`);\n console.log(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);\n // Continue trying other conditions\n }\n }\n\n if (this.config.debug) {\n this.context.debugItems.push(\"[filter-plugin] query match: false\");\n }\n }\n\n return false;\n } catch (e) {\n console.error(`[filter-plugin] Error: ${e}`);\n console.log(`[filter-plugin] queries: ${JSON.stringify(this.config.queries)}`);\n console.log(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);\n return false;\n }\n }\n\n /**\n * Checks if a log message should be allowed based on the configured filters.\n *\n * The filtering logic is:\n * 1. If no filters defined, allow all logs\n * 2. If message patterns match, allow the log\n * 3. If queries match, allow the log\n * 4. Otherwise, filter out the log\n *\n * @param params - The log message parameters\n * @returns true if the log should be allowed, false otherwise\n */\n check(params: PluginShouldSendToLoggerParams): boolean {\n this.resetContext(params);\n\n // If no filters defined at all, allow everything\n if (!this.config.messages?.length && !this.config.queries?.length) {\n this.context.debugItems.push(\"[filter-plugin] no filters defined, allowing message\");\n this.printDebugItems();\n return true;\n }\n\n // Check message patterns first\n if (this.checkMessagePatterns()) {\n this.printDebugItems();\n return true;\n }\n\n // Then check queries if message patterns didn't match\n const queryResult = this.checkQueries();\n this.printDebugItems();\n return queryResult;\n }\n}\n","import type { LogLayerPlugin, PluginShouldSendToLoggerParams } from \"@loglayer/plugin\";\nimport { FilterExecutor } from \"./FilterExecutor.js\";\nimport type { filterPluginParams } from \"./types.js\";\n\n/**\n * Creates a new filter plugin instance.\n *\n * The filter plugin allows filtering log messages based on:\n * - String patterns\n * - Regular expressions\n * - JSON queries\n *\n * @example\n * ```typescript\n * // Filter error messages\n * const filter = filterPlugin({\n * messages: ['error'],\n * });\n *\n * // Filter by log level\n * const levelFilter = filterPlugin({\n * queries: ['.level == \"error\" or .level == \"warn\"'],\n * });\n * ```\n *\n * @param config - The filter plugin configuration\n * @returns A LogLayer plugin instance\n */\nexport function filterPlugin(config: filterPluginParams): LogLayerPlugin {\n const executor = new FilterExecutor(config);\n\n return {\n id: config.id,\n disabled: config.disabled,\n shouldSendToLogger: (params: PluginShouldSendToLoggerParams) => {\n return executor.check(params);\n },\n };\n}\n"]}
package/dist/index.js CHANGED
@@ -76,25 +76,42 @@ var FilterExecutor = class {
76
76
  if (!this.config.queries?.length) {
77
77
  return false;
78
78
  }
79
- const query = this.config.queries.map((q) => `(${q.replaceAll(`'`, `"`)})`).join(" or ");
80
79
  const queryContext = {
81
80
  level: this.context.logLevel,
82
81
  message: this.context.message,
83
82
  data: this.context.data
84
83
  };
85
84
  try {
86
- if (this.config.debug) {
87
- this.context.debugItems.push(`[filter-plugin] query: filter(${query})`);
88
- this.context.debugItems.push(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);
89
- }
90
- const output = jsonquery([queryContext], `filter(${query})`);
91
- if (this.config.debug) {
92
- this.context.debugItems.push(`[filter-plugin] query match: ${output.length > 0}`);
85
+ for (const q of this.config.queries) {
86
+ const conditions = q.split(" or ").map((cond) => `filter(${cond.trim().replaceAll(`'`, `"`)})`);
87
+ const query = conditions.join(" or ");
88
+ if (this.config.debug) {
89
+ this.context.debugItems.push(`[filter-plugin] query: filter(${query})`);
90
+ this.context.debugItems.push(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);
91
+ }
92
+ for (const condition of conditions) {
93
+ try {
94
+ const output = jsonquery([queryContext], condition);
95
+ if (output.length > 0) {
96
+ if (this.config.debug) {
97
+ this.context.debugItems.push(`[filter-plugin] query match: ${output.length > 0}`);
98
+ }
99
+ return true;
100
+ }
101
+ } catch (e) {
102
+ console.error(`[filter-plugin] Error: ${e}`);
103
+ console.log(`[filter-plugin] query: ${condition}`);
104
+ console.log(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);
105
+ }
106
+ }
107
+ if (this.config.debug) {
108
+ this.context.debugItems.push("[filter-plugin] query match: false");
109
+ }
93
110
  }
94
- return output.length > 0;
111
+ return false;
95
112
  } catch (e) {
96
113
  console.error(`[filter-plugin] Error: ${e}`);
97
- console.log(`[filter-plugin] query: filter(${query})`);
114
+ console.log(`[filter-plugin] queries: ${JSON.stringify(this.config.queries)}`);
98
115
  console.log(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);
99
116
  return false;
100
117
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/FilterExecutor.ts","../src/plugin.ts"],"sourcesContent":["import { jsonquery } from \"@jsonquerylang/jsonquery\";\nimport type { PluginShouldSendToLoggerParams } from \"@loglayer/plugin\";\nimport type { filterPluginParams } from \"./types.js\";\n\n/**\n * Internal context for the filter execution.\n * Contains the current log message details and debug information.\n */\ninterface FilterContext {\n /** The combined log message */\n message: string;\n /** The log level */\n logLevel: string;\n /** Additional log data */\n data: Record<string, any>;\n /** Debug messages for troubleshooting */\n debugItems: string[];\n}\n\n/**\n * Core filtering logic implementation.\n * Handles pattern matching and query-based filtering of log messages.\n *\n * @internal\n */\nexport class FilterExecutor {\n private readonly config: filterPluginParams;\n private context: FilterContext;\n\n /**\n * Creates a new FilterExecutor instance.\n *\n * @param config - The filter plugin configuration\n */\n constructor(config: filterPluginParams) {\n this.config = config;\n this.context = {\n message: \"\",\n logLevel: \"\",\n data: {},\n debugItems: [],\n };\n }\n\n /**\n * Resets the context for a new log message check.\n *\n * @param params - The log message parameters\n */\n private resetContext(params: PluginShouldSendToLoggerParams): void {\n this.context = {\n message: params.messages?.join(\" \") || \"\",\n logLevel: params.logLevel,\n data: params.data || {},\n debugItems: [\"[filter-plugin] =================================\"],\n };\n }\n\n /**\n * Prints debug information if debug mode is enabled.\n */\n private printDebugItems(): void {\n if (this.config.debug) {\n for (const item of this.context.debugItems) {\n console.log(item);\n }\n }\n }\n\n /**\n * Checks if the current message matches any of the configured patterns.\n * Supports both string and RegExp patterns.\n *\n * @returns true if any pattern matches, false otherwise\n */\n private checkMessagePatterns(): boolean {\n if (!this.config.messages?.length) {\n return false;\n }\n\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] message: ${this.context.message}`);\n }\n\n for (const pattern of this.config.messages) {\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] pattern: ${pattern}`);\n }\n\n const matches =\n typeof pattern === \"string\" ? this.context.message.includes(pattern) : pattern.test(this.context.message);\n\n if (matches) {\n this.context.debugItems.push(\"[filter-plugin] pattern match: true\");\n return true;\n }\n\n this.context.debugItems.push(\"[filter-plugin] pattern match: false\");\n }\n\n return false;\n }\n\n /**\n * Checks if the current message matches any of the configured queries.\n * Uses @jsonquerylang/jsonquery for query execution.\n *\n * @returns true if any query matches, false otherwise\n */\n private checkQueries(): boolean {\n if (!this.config.queries?.length) {\n return false;\n }\n\n const query = this.config.queries.map((q) => `(${q.replaceAll(`'`, `\"`)})`).join(\" or \");\n const queryContext = {\n level: this.context.logLevel,\n message: this.context.message,\n data: this.context.data,\n };\n\n try {\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] query: filter(${query})`);\n this.context.debugItems.push(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);\n }\n\n const output = jsonquery([queryContext], `filter(${query})`) as Array<any>;\n\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] query match: ${output.length > 0}`);\n }\n\n return output.length > 0;\n } catch (e) {\n console.error(`[filter-plugin] Error: ${e}`);\n console.log(`[filter-plugin] query: filter(${query})`);\n console.log(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);\n return false;\n }\n }\n\n /**\n * Checks if a log message should be allowed based on the configured filters.\n *\n * The filtering logic is:\n * 1. If no filters defined, allow all logs\n * 2. If message patterns match, allow the log\n * 3. If queries match, allow the log\n * 4. Otherwise, filter out the log\n *\n * @param params - The log message parameters\n * @returns true if the log should be allowed, false otherwise\n */\n check(params: PluginShouldSendToLoggerParams): boolean {\n this.resetContext(params);\n\n // If no filters defined at all, allow everything\n if (!this.config.messages?.length && !this.config.queries?.length) {\n this.context.debugItems.push(\"[filter-plugin] no filters defined, allowing message\");\n this.printDebugItems();\n return true;\n }\n\n // Check message patterns first\n if (this.checkMessagePatterns()) {\n this.printDebugItems();\n return true;\n }\n\n // Then check queries if message patterns didn't match\n const queryResult = this.checkQueries();\n this.printDebugItems();\n return queryResult;\n }\n}\n","import type { LogLayerPlugin, PluginShouldSendToLoggerParams } from \"@loglayer/plugin\";\nimport { FilterExecutor } from \"./FilterExecutor.js\";\nimport type { filterPluginParams } from \"./types.js\";\n\n/**\n * Creates a new filter plugin instance.\n *\n * The filter plugin allows filtering log messages based on:\n * - String patterns\n * - Regular expressions\n * - JSON queries\n *\n * @example\n * ```typescript\n * // Filter error messages\n * const filter = filterPlugin({\n * messages: ['error'],\n * });\n *\n * // Filter by log level\n * const levelFilter = filterPlugin({\n * queries: ['.level == \"error\" or .level == \"warn\"'],\n * });\n * ```\n *\n * @param config - The filter plugin configuration\n * @returns A LogLayer plugin instance\n */\nexport function filterPlugin(config: filterPluginParams): LogLayerPlugin {\n const executor = new FilterExecutor(config);\n\n return {\n id: config.id,\n disabled: config.disabled,\n shouldSendToLogger: (params: PluginShouldSendToLoggerParams) => {\n return executor.check(params);\n },\n };\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAyBnB,IAAM,iBAAN,MAAqB;AAAA,EACT;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOR,YAAY,QAA4B;AACtC,SAAK,SAAS;AACd,SAAK,UAAU;AAAA,MACb,SAAS;AAAA,MACT,UAAU;AAAA,MACV,MAAM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Aa,QAA4C;AACvE,QAAM,WAAW,IAAI,eAAe,MAAM;AAE1C,SAAO;AAAA,IACL,IAAI,OAAO;AAAA,IACX,UAAU,OAAO;AAAA,IACjB,oBAAoB,CAAC,WAA2C;AAC9D,aAAO,SAAS,MAAM,MAAM;AAAA,IAC9B;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/FilterExecutor.ts","../src/plugin.ts"],"sourcesContent":["import { jsonquery } from \"@jsonquerylang/jsonquery\";\nimport type { PluginShouldSendToLoggerParams } from \"@loglayer/plugin\";\nimport type { filterPluginParams } from \"./types.js\";\n\n/**\n * Internal context for the filter execution.\n * Contains the current log message details and debug information.\n */\ninterface FilterContext {\n /** The combined log message */\n message: string;\n /** The log level */\n logLevel: string;\n /** Additional log data */\n data: Record<string, any>;\n /** Debug messages for troubleshooting */\n debugItems: string[];\n}\n\n/**\n * Core filtering logic implementation.\n * Handles pattern matching and query-based filtering of log messages.\n *\n * @internal\n */\nexport class FilterExecutor {\n private readonly config: filterPluginParams;\n private context: FilterContext;\n\n /**\n * Creates a new FilterExecutor instance.\n *\n * @param config - The filter plugin configuration\n */\n constructor(config: filterPluginParams) {\n this.config = config;\n this.context = {\n message: \"\",\n logLevel: \"\",\n data: {},\n debugItems: [],\n };\n }\n\n /**\n * Resets the context for a new log message check.\n *\n * @param params - The log message parameters\n */\n private resetContext(params: PluginShouldSendToLoggerParams): void {\n this.context = {\n message: params.messages?.join(\" \") || \"\",\n logLevel: params.logLevel,\n data: params.data || {},\n debugItems: [\"[filter-plugin] =================================\"],\n };\n }\n\n /**\n * Prints debug information if debug mode is enabled.\n */\n private printDebugItems(): void {\n if (this.config.debug) {\n for (const item of this.context.debugItems) {\n console.log(item);\n }\n }\n }\n\n /**\n * Checks if the current message matches any of the configured patterns.\n * Supports both string and RegExp patterns.\n *\n * @returns true if any pattern matches, false otherwise\n */\n private checkMessagePatterns(): boolean {\n if (!this.config.messages?.length) {\n return false;\n }\n\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] message: ${this.context.message}`);\n }\n\n for (const pattern of this.config.messages) {\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] pattern: ${pattern}`);\n }\n\n const matches =\n typeof pattern === \"string\" ? this.context.message.includes(pattern) : pattern.test(this.context.message);\n\n if (matches) {\n this.context.debugItems.push(\"[filter-plugin] pattern match: true\");\n return true;\n }\n\n this.context.debugItems.push(\"[filter-plugin] pattern match: false\");\n }\n\n return false;\n }\n\n /**\n * Checks if the current message matches any of the configured queries.\n * Uses @jsonquerylang/jsonquery for query execution.\n *\n * @returns true if any query matches, false otherwise\n */\n private checkQueries(): boolean {\n if (!this.config.queries?.length) {\n return false;\n }\n\n const queryContext = {\n level: this.context.logLevel,\n message: this.context.message,\n data: this.context.data,\n };\n\n try {\n // Process each query individually and return true if any match\n for (const q of this.config.queries) {\n // Split OR conditions and wrap each in filter()\n const conditions = q.split(\" or \").map((cond) => `filter(${cond.trim().replaceAll(`'`, `\"`)})`);\n const query = conditions.join(\" or \");\n\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] query: filter(${query})`);\n this.context.debugItems.push(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);\n }\n\n // Try each condition separately\n for (const condition of conditions) {\n try {\n const output = jsonquery([queryContext], condition) as Array<any>;\n if (output.length > 0) {\n if (this.config.debug) {\n this.context.debugItems.push(`[filter-plugin] query match: ${output.length > 0}`);\n }\n return true;\n }\n } catch (e) {\n console.error(`[filter-plugin] Error: ${e}`);\n console.log(`[filter-plugin] query: ${condition}`);\n console.log(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);\n // Continue trying other conditions\n }\n }\n\n if (this.config.debug) {\n this.context.debugItems.push(\"[filter-plugin] query match: false\");\n }\n }\n\n return false;\n } catch (e) {\n console.error(`[filter-plugin] Error: ${e}`);\n console.log(`[filter-plugin] queries: ${JSON.stringify(this.config.queries)}`);\n console.log(`[filter-plugin] input: ${JSON.stringify(queryContext)}`);\n return false;\n }\n }\n\n /**\n * Checks if a log message should be allowed based on the configured filters.\n *\n * The filtering logic is:\n * 1. If no filters defined, allow all logs\n * 2. If message patterns match, allow the log\n * 3. If queries match, allow the log\n * 4. Otherwise, filter out the log\n *\n * @param params - The log message parameters\n * @returns true if the log should be allowed, false otherwise\n */\n check(params: PluginShouldSendToLoggerParams): boolean {\n this.resetContext(params);\n\n // If no filters defined at all, allow everything\n if (!this.config.messages?.length && !this.config.queries?.length) {\n this.context.debugItems.push(\"[filter-plugin] no filters defined, allowing message\");\n this.printDebugItems();\n return true;\n }\n\n // Check message patterns first\n if (this.checkMessagePatterns()) {\n this.printDebugItems();\n return true;\n }\n\n // Then check queries if message patterns didn't match\n const queryResult = this.checkQueries();\n this.printDebugItems();\n return queryResult;\n }\n}\n","import type { LogLayerPlugin, PluginShouldSendToLoggerParams } from \"@loglayer/plugin\";\nimport { FilterExecutor } from \"./FilterExecutor.js\";\nimport type { filterPluginParams } from \"./types.js\";\n\n/**\n * Creates a new filter plugin instance.\n *\n * The filter plugin allows filtering log messages based on:\n * - String patterns\n * - Regular expressions\n * - JSON queries\n *\n * @example\n * ```typescript\n * // Filter error messages\n * const filter = filterPlugin({\n * messages: ['error'],\n * });\n *\n * // Filter by log level\n * const levelFilter = filterPlugin({\n * queries: ['.level == \"error\" or .level == \"warn\"'],\n * });\n * ```\n *\n * @param config - The filter plugin configuration\n * @returns A LogLayer plugin instance\n */\nexport function filterPlugin(config: filterPluginParams): LogLayerPlugin {\n const executor = new FilterExecutor(config);\n\n return {\n id: config.id,\n disabled: config.disabled,\n shouldSendToLogger: (params: PluginShouldSendToLoggerParams) => {\n return executor.check(params);\n },\n };\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAyBnB,IAAM,iBAAN,MAAqB;AAAA,EACT;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOR,YAAY,QAA4B;AACtC,SAAK,SAAS;AACd,SAAK,UAAU;AAAA,MACb,SAAS;AAAA,MACT,UA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;AAAA,IACT;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,MAAM,QAAiD;AACrD,SAAK,aAAa,MAAM;AAGxB,QAAI,CAAC,KAAK,OAAO,UAAU,UAAU,CAAC,KAAK,OAAO,SAAS,QAAQ;AACjE,WAAK,QAAQ,WAAW,KAAK,sDAAsD;AACnF,WAAK,gBAAgB;AACrB,aAAO;AAAA,IACT;AAGA,QAAI,KAAK,qBAAqB,GAAG;AAC/B,WAAK,gBAAgB;AACrB,aAAO;AAAA,IACT;AAGA,UAAM,cAAc,KAAK,aAAa;AACtC,SAAK,gBAAgB;AACrB,WAAO;AAAA,EACT;AACF;;;ACzKO,SAAS,aAAa,QAA4C;AACvE,QAAM,WAAW,IAAI,eAAe,MAAM;AAE1C,SAAO;AAAA,IACL,IAAI,OAAO;AAAA,IACX,UAAU,OAAO;AAAA,IACjB,oBAAoB,CAAC,WAA2C;AAC9D,aAAO,SAAS,MAAM,MAAM;AAAA,IAC9B;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@loglayer/plugin-filter",
3
3
  "description": "Filter logs with LogLayer using string patterns, regular expressions, or JSON Queries.",
4
- "version": "1.0.3",
4
+ "version": "1.0.5",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",
@@ -29,8 +29,8 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@jsonquerylang/jsonquery": "4.1.1",
32
- "@loglayer/plugin": "1.2.2",
33
- "@loglayer/shared": "1.2.1"
32
+ "@loglayer/plugin": "1.3.0",
33
+ "@loglayer/shared": "1.3.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "hash-runner": "2.0.1",
@@ -38,8 +38,8 @@
38
38
  "tsup": "8.3.5",
39
39
  "typescript": "5.7.3",
40
40
  "vitest": "3.0.4",
41
- "loglayer": "5.5.1",
42
- "@internal/tsconfig": "1.0.0"
41
+ "@internal/tsconfig": "1.0.0",
42
+ "loglayer": "5.6.0"
43
43
  },
44
44
  "bugs": "https://github.com/loglayer/loglayer/issues",
45
45
  "engines": {