@holz/env-filter 0.1.0 → 0.1.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/package.json
CHANGED
|
@@ -14,7 +14,7 @@ export default class EnvironmentFilter implements LogProcessor {
|
|
|
14
14
|
|
|
15
15
|
constructor(options: Config) {
|
|
16
16
|
this.processor = options.processor;
|
|
17
|
-
this.
|
|
17
|
+
this.replaceFilter(
|
|
18
18
|
options.pattern ?? this.loadPattern() ?? options.defaultPattern ?? '*'
|
|
19
19
|
);
|
|
20
20
|
}
|
|
@@ -28,10 +28,7 @@ export default class EnvironmentFilter implements LogProcessor {
|
|
|
28
28
|
* it will attempt to persist your preference.
|
|
29
29
|
*/
|
|
30
30
|
setPattern(pattern: string) {
|
|
31
|
-
this.
|
|
32
|
-
processor: this.processor,
|
|
33
|
-
pattern,
|
|
34
|
-
});
|
|
31
|
+
this.replaceFilter(pattern);
|
|
35
32
|
|
|
36
33
|
if (this.env === Environment.Browser) {
|
|
37
34
|
browserEnv.save(browserEnv.STORAGE_KEY, pattern);
|
|
@@ -51,6 +48,13 @@ export default class EnvironmentFilter implements LogProcessor {
|
|
|
51
48
|
private loadPattern() {
|
|
52
49
|
return browserEnv.load(browserEnv.STORAGE_KEY) ?? serverEnv.load('DEBUG');
|
|
53
50
|
}
|
|
51
|
+
|
|
52
|
+
private replaceFilter(pattern: string) {
|
|
53
|
+
this.filter = new PatternFilter({
|
|
54
|
+
processor: this.processor,
|
|
55
|
+
pattern,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
interface Config {
|