@holz/pattern-filter 0.6.0 → 0.7.0-rc.1
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/README.md +1 -1
- package/dist/holz-pattern-filter.d.ts +27 -0
- package/package.json +14 -10
- package/src/__tests__/pattern-filter.test.ts +1 -1
- package/src/string-match.ts +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ The `processor` option is where you specify which plugin should process the filt
|
|
|
21
21
|
|
|
22
22
|
## Patterns
|
|
23
23
|
|
|
24
|
-
Patterns are strings that match against `log.origin`, which is a property of each log object. Origins are added when you call `logger.
|
|
24
|
+
Patterns are strings that match against `log.origin`, which is a property of each log object. Origins are added when you call `logger.namespace(...)`. The following syntax is supported:
|
|
25
25
|
|
|
26
26
|
- `*` matches zero or more characters.
|
|
27
27
|
- `-` at the beginning of a pattern negates it, so that logs with origins matching the pattern are hidden rather than shown.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LogProcessor } from '@holz/core';
|
|
2
|
+
|
|
3
|
+
declare interface Config {
|
|
4
|
+
/** A set of patterns to test against `log.origin`. */
|
|
5
|
+
pattern: string;
|
|
6
|
+
/** Where to send logs if they pass the filter. */
|
|
7
|
+
processor: LogProcessor;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Only forwards logs who's origin matches the given pattern. It works the
|
|
12
|
+
* same as the popular `debug` module.
|
|
13
|
+
*
|
|
14
|
+
* Patterns allow wildcards and negation. For example, the pattern `my-app*`
|
|
15
|
+
* will match all logs with the origin `my-app` or `my-app:foo` or
|
|
16
|
+
* `my-app:foo:bar`. The pattern `*, -my-app` will match all logs except those
|
|
17
|
+
* with the origin `my-app`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* createPatternFilter({
|
|
21
|
+
* pattern: 'my-app*, -spammy:library',
|
|
22
|
+
* processor: backend,
|
|
23
|
+
* })
|
|
24
|
+
*/
|
|
25
|
+
export declare function createPatternFilter({ processor, pattern, }: Config): LogProcessor;
|
|
26
|
+
|
|
27
|
+
export { }
|
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holz/pattern-filter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-rc.1",
|
|
4
4
|
"description": "Only print log messages that match a pattern",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/holz-pattern-filter.cjs",
|
|
7
|
-
"module": "./dist/holz-pattern-filter.js",
|
|
8
|
-
"types": "./src/index.ts",
|
|
9
6
|
"repository": {
|
|
10
7
|
"type": "git",
|
|
11
8
|
"url": "https://github.com/PsychoLlama/holz",
|
|
@@ -13,6 +10,7 @@
|
|
|
13
10
|
},
|
|
14
11
|
"exports": {
|
|
15
12
|
".": {
|
|
13
|
+
"types": "./dist/holz-pattern-filter.d.ts",
|
|
16
14
|
"require": "./dist/holz-pattern-filter.cjs",
|
|
17
15
|
"import": "./dist/holz-pattern-filter.js"
|
|
18
16
|
}
|
|
@@ -39,11 +37,17 @@
|
|
|
39
37
|
"test:unit": "vitest --color --passWithNoTests",
|
|
40
38
|
"test:types": "tsc"
|
|
41
39
|
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@holz/core": "0.7.0-rc.1"
|
|
42
|
+
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@holz/core": "^0.
|
|
44
|
-
"@vitest/coverage-
|
|
45
|
-
"typescript": "^
|
|
46
|
-
"vite": "^
|
|
47
|
-
"
|
|
48
|
-
|
|
44
|
+
"@holz/core": "^0.7.0-rc.1",
|
|
45
|
+
"@vitest/coverage-v8": "^3.0.8",
|
|
46
|
+
"typescript": "^5.0.0",
|
|
47
|
+
"vite": "^6.0.0",
|
|
48
|
+
"vite-plugin-dts": "^4.5.3",
|
|
49
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
50
|
+
"vitest": "^3.0.8"
|
|
51
|
+
},
|
|
52
|
+
"stableVersion": "0.6.1"
|
|
49
53
|
}
|