@decaf-ts/logging 0.10.0 → 0.10.2
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 +298 -171
- package/dist/logging.cjs +1 -1
- package/dist/logging.cjs.map +1 -1
- package/dist/logging.js +1 -1
- package/dist/logging.js.map +1 -1
- package/lib/LoggedClass.cjs +4 -4
- package/lib/LoggedClass.d.ts +4 -4
- package/lib/constants.cjs +32 -63
- package/lib/constants.d.ts +32 -63
- package/lib/constants.js.map +1 -1
- package/lib/decorators.cjs +28 -28
- package/lib/decorators.d.ts +29 -36
- package/lib/decorators.js.map +1 -1
- package/lib/environment.cjs +34 -41
- package/lib/environment.d.ts +31 -32
- package/lib/environment.js.map +1 -1
- package/lib/esm/LoggedClass.d.ts +4 -4
- package/lib/esm/LoggedClass.js +4 -4
- package/lib/esm/constants.d.ts +32 -63
- package/lib/esm/constants.js +32 -63
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/decorators.d.ts +29 -36
- package/lib/esm/decorators.js +28 -28
- package/lib/esm/decorators.js.map +1 -1
- package/lib/esm/environment.d.ts +31 -32
- package/lib/esm/environment.js +34 -41
- package/lib/esm/environment.js.map +1 -1
- package/lib/esm/filters/LogFilter.d.ts +11 -11
- package/lib/esm/filters/LogFilter.js +5 -5
- package/lib/esm/filters/PatternFilter.d.ts +15 -15
- package/lib/esm/filters/PatternFilter.js +12 -12
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.js +3 -3
- package/lib/esm/logging.d.ts +119 -113
- package/lib/esm/logging.js +223 -138
- package/lib/esm/logging.js.map +1 -1
- package/lib/esm/pino/index.d.ts +6 -0
- package/lib/esm/pino/index.js +6 -0
- package/lib/esm/pino/index.js.map +1 -1
- package/lib/esm/pino/pino.d.ts +13 -5
- package/lib/esm/pino/pino.js +70 -124
- package/lib/esm/pino/pino.js.map +1 -1
- package/lib/esm/text.d.ts +29 -67
- package/lib/esm/text.js +29 -67
- package/lib/esm/text.js.map +1 -1
- package/lib/esm/time.d.ts +45 -43
- package/lib/esm/time.js +38 -36
- package/lib/esm/time.js.map +1 -1
- package/lib/esm/types.d.ts +59 -50
- package/lib/esm/utils.d.ts +43 -0
- package/lib/esm/utils.js +55 -3
- package/lib/esm/utils.js.map +1 -1
- package/lib/esm/web.d.ts +2 -2
- package/lib/esm/web.js +2 -2
- package/lib/esm/winston/index.d.ts +7 -0
- package/lib/esm/winston/index.js +7 -1
- package/lib/esm/winston/index.js.map +1 -1
- package/lib/esm/winston/winston.d.ts +17 -21
- package/lib/esm/winston/winston.js +29 -36
- package/lib/esm/winston/winston.js.map +1 -1
- package/lib/filters/LogFilter.cjs +5 -5
- package/lib/filters/LogFilter.d.ts +11 -11
- package/lib/filters/PatternFilter.cjs +12 -12
- package/lib/filters/PatternFilter.d.ts +15 -15
- package/lib/index.cjs +3 -3
- package/lib/index.d.ts +2 -2
- package/lib/logging.cjs +224 -139
- package/lib/logging.d.ts +119 -113
- package/lib/logging.js.map +1 -1
- package/lib/pino/index.cjs +6 -0
- package/lib/pino/index.d.ts +6 -0
- package/lib/pino/index.js.map +1 -1
- package/lib/pino/pino.cjs +102 -126
- package/lib/pino/pino.d.ts +13 -5
- package/lib/pino/pino.js.map +1 -1
- package/lib/text.cjs +29 -67
- package/lib/text.d.ts +29 -67
- package/lib/text.js.map +1 -1
- package/lib/time.cjs +38 -36
- package/lib/time.d.ts +45 -43
- package/lib/time.js.map +1 -1
- package/lib/types.d.ts +59 -50
- package/lib/utils.cjs +55 -3
- package/lib/utils.d.ts +43 -0
- package/lib/utils.js.map +1 -1
- package/lib/web.cjs +2 -2
- package/lib/web.d.ts +2 -2
- package/lib/winston/index.cjs +22 -0
- package/lib/winston/index.d.ts +7 -0
- package/lib/winston/index.js.map +1 -1
- package/lib/winston/winston.cjs +29 -36
- package/lib/winston/winston.d.ts +17 -21
- package/lib/winston/winston.js.map +1 -1
- package/package.json +9 -10
- package/lib/accumulate.types.cjs +0 -27
- package/lib/accumulate.types.d.ts +0 -1
- package/lib/accumulate.types.js.map +0 -1
- package/lib/esm/accumulate.types.d.ts +0 -1
- package/lib/esm/accumulate.types.js +0 -25
- package/lib/esm/accumulate.types.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Logger, LoggingConfig, LoggingFilter } from "../types";
|
|
2
2
|
import { LoggedClass } from "../LoggedClass";
|
|
3
3
|
/**
|
|
4
|
-
* @description
|
|
5
|
-
* @summary
|
|
4
|
+
* @description A base class for message filters that can be plugged into the logging pipeline.
|
|
5
|
+
* @summary This class extends {@link LoggedClass} to supply a scoped logger, and defines the contract that is required by {@link LoggingFilter} implementers that transform or drop log messages before emission.
|
|
6
6
|
* @class LogFilter
|
|
7
7
|
* @example
|
|
8
8
|
* class RedactSecretsFilter extends LogFilter {
|
|
@@ -26,18 +26,18 @@ import { LoggedClass } from "../LoggedClass";
|
|
|
26
26
|
*/
|
|
27
27
|
export declare abstract class LogFilter extends LoggedClass implements LoggingFilter {
|
|
28
28
|
/**
|
|
29
|
-
* @description
|
|
30
|
-
* @summary
|
|
31
|
-
* @return {Logger}
|
|
29
|
+
* @description A scoped logger that excludes other filters from the chain.
|
|
30
|
+
* @summary This method returns a child logger that is dedicated to the filter, which prevents recursive filter invocation when emitting diagnostic messages.
|
|
31
|
+
* @return {Logger} A context-aware logger for the filter instance.
|
|
32
32
|
*/
|
|
33
33
|
get log(): Logger;
|
|
34
34
|
/**
|
|
35
|
-
* @description
|
|
36
|
-
* @summary
|
|
37
|
-
* @param {LoggingConfig} config -
|
|
38
|
-
* @param {string} message -
|
|
39
|
-
* @param {string[]} context -
|
|
40
|
-
* @return {string}
|
|
35
|
+
* @description Transforms or suppresses a log message.
|
|
36
|
+
* @summary This method inspects the provided message and context to produce the value that will be forwarded to subsequent filters or emitters.
|
|
37
|
+
* @param {LoggingConfig} config - The active logging configuration.
|
|
38
|
+
* @param {string} message - The original log message payload.
|
|
39
|
+
* @param {string[]} context - The context values that are attached to the message.
|
|
40
|
+
* @return {string} The filtered message to pass to downstream processing.
|
|
41
41
|
*/
|
|
42
42
|
abstract filter(config: LoggingConfig, message: string, context: string[]): string;
|
|
43
43
|
}
|
|
@@ -13,10 +13,10 @@ exports.PatternFilter = void 0;
|
|
|
13
13
|
const LogFilter_1 = require("./LogFilter.cjs");
|
|
14
14
|
const decorators_1 = require("./../decorators.cjs");
|
|
15
15
|
/**
|
|
16
|
-
* @description
|
|
17
|
-
* @summary
|
|
18
|
-
* @param {RegExp} regexp -
|
|
19
|
-
* @param {string|ReplacementFunction} replacement -
|
|
16
|
+
* @description A filter that patches log messages using regular expressions.
|
|
17
|
+
* @summary This class applies a configured {@link RegExp} and replacement strategy to redact, mask, or restructure log payloads before they are emitted.
|
|
18
|
+
* @param {RegExp} regexp - The expression to use for detecting sensitive or formatted text.
|
|
19
|
+
* @param {(string|ReplacementFunction)} replacement - The replacement string or a callback that is invoked for each match.
|
|
20
20
|
* @class PatternFilter
|
|
21
21
|
* @example
|
|
22
22
|
* const filter = new PatternFilter(/token=[^&]+/g, "token=***");
|
|
@@ -46,9 +46,9 @@ class PatternFilter extends LogFilter_1.LogFilter {
|
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* @description Ensures deterministic RegExp matching.
|
|
49
|
-
* @summary
|
|
50
|
-
* @param {string} message -
|
|
51
|
-
* @return {RegExpExecArray|null}
|
|
49
|
+
* @summary This method runs the configured expression, then resets its state so that repeated invocations behave consistently.
|
|
50
|
+
* @param {string} message - The message to test for matches.
|
|
51
|
+
* @return {(RegExpExecArray|null)} The match result, or null if no match is found.
|
|
52
52
|
*/
|
|
53
53
|
match(message) {
|
|
54
54
|
const match = this.regexp.exec(message);
|
|
@@ -57,11 +57,11 @@ class PatternFilter extends LogFilter_1.LogFilter {
|
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* @description Applies the replacement strategy to the incoming message.
|
|
60
|
-
* @summary
|
|
61
|
-
* @param {LoggingConfig} config -
|
|
62
|
-
* @param {string} message -
|
|
63
|
-
* @param {string[]} context -
|
|
64
|
-
* @return {string}
|
|
60
|
+
* @summary This method executes {@link PatternFilter.match} and, when a match is found, replaces every occurrence using the configured replacement handler.
|
|
61
|
+
* @param {LoggingConfig} config - The active logging configuration (unused, but part of the filter contract).
|
|
62
|
+
* @param {string} message - The message to be sanitized.
|
|
63
|
+
* @param {string[]} context - The context entries that are associated with the log event.
|
|
64
|
+
* @return {string} The sanitized log message.
|
|
65
65
|
*/
|
|
66
66
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
67
67
|
filter(config, message, context) {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { LogFilter } from "./LogFilter";
|
|
2
2
|
import { LoggingConfig } from "../types";
|
|
3
3
|
/**
|
|
4
|
-
* @description
|
|
5
|
-
* @summary
|
|
6
|
-
* @typedef {function(string, any
|
|
4
|
+
* @description A replacement callback that is used to transform RegExp matches.
|
|
5
|
+
* @summary This function receives the matched substring and additional capture arguments, and returns the replacement text that will be injected into the log message.
|
|
6
|
+
* @typedef {function(string, ...any): string} ReplacementFunction
|
|
7
7
|
* @memberOf module:Logging
|
|
8
8
|
*/
|
|
9
9
|
export type ReplacementFunction = (substring: string, ...args: any[]) => string;
|
|
10
10
|
/**
|
|
11
|
-
* @description
|
|
12
|
-
* @summary
|
|
13
|
-
* @param {RegExp} regexp -
|
|
14
|
-
* @param {string|ReplacementFunction} replacement -
|
|
11
|
+
* @description A filter that patches log messages using regular expressions.
|
|
12
|
+
* @summary This class applies a configured {@link RegExp} and replacement strategy to redact, mask, or restructure log payloads before they are emitted.
|
|
13
|
+
* @param {RegExp} regexp - The expression to use for detecting sensitive or formatted text.
|
|
14
|
+
* @param {(string|ReplacementFunction)} replacement - The replacement string or a callback that is invoked for each match.
|
|
15
15
|
* @class PatternFilter
|
|
16
16
|
* @example
|
|
17
17
|
* const filter = new PatternFilter(/token=[^&]+/g, "token=***");
|
|
@@ -39,18 +39,18 @@ export declare class PatternFilter extends LogFilter {
|
|
|
39
39
|
constructor(regexp: RegExp, replacement: string | ReplacementFunction);
|
|
40
40
|
/**
|
|
41
41
|
* @description Ensures deterministic RegExp matching.
|
|
42
|
-
* @summary
|
|
43
|
-
* @param {string} message -
|
|
44
|
-
* @return {RegExpExecArray|null}
|
|
42
|
+
* @summary This method runs the configured expression, then resets its state so that repeated invocations behave consistently.
|
|
43
|
+
* @param {string} message - The message to test for matches.
|
|
44
|
+
* @return {(RegExpExecArray|null)} The match result, or null if no match is found.
|
|
45
45
|
*/
|
|
46
46
|
protected match(message: string): RegExpExecArray | null;
|
|
47
47
|
/**
|
|
48
48
|
* @description Applies the replacement strategy to the incoming message.
|
|
49
|
-
* @summary
|
|
50
|
-
* @param {LoggingConfig} config -
|
|
51
|
-
* @param {string} message -
|
|
52
|
-
* @param {string[]} context -
|
|
53
|
-
* @return {string}
|
|
49
|
+
* @summary This method executes {@link PatternFilter.match} and, when a match is found, replaces every occurrence using the configured replacement handler.
|
|
50
|
+
* @param {LoggingConfig} config - The active logging configuration (unused, but part of the filter contract).
|
|
51
|
+
* @param {string} message - The message to be sanitized.
|
|
52
|
+
* @param {string[]} context - The context entries that are associated with the log event.
|
|
53
|
+
* @return {string} The sanitized log message.
|
|
54
54
|
*/
|
|
55
55
|
filter(config: LoggingConfig, message: string, context: string[]): string;
|
|
56
56
|
}
|
package/lib/index.cjs
CHANGED
|
@@ -27,9 +27,9 @@ __exportStar(require("./types.cjs"), exports);
|
|
|
27
27
|
__exportStar(require("./web.cjs"), exports);
|
|
28
28
|
__exportStar(require("./utils.cjs"), exports);
|
|
29
29
|
/**
|
|
30
|
-
* @description Comprehensive logging toolkit for browser and Node environments.
|
|
31
|
-
* @summary Exposes {@link Logging} and {@link MiniLogger} for runtime logging, decorators such as {@link log} for method instrumentation, and utilities like {@link PatternFilter}, {@link StopWatch}, and {@link LoggedEnvironment} to build configurable, theme-aware log pipelines.
|
|
32
30
|
* @module Logging
|
|
31
|
+
* @description A comprehensive and versatile logging toolkit for both browser and Node.js environments.
|
|
32
|
+
* @summary This module provides a complete logging solution, exposing {@link Logging} and {@link MiniLogger} for runtime logging. It also includes decorators like {@link log} for method instrumentation, and various utilities such as {@link PatternFilter}, {@link StopWatch}, and {@link LoggedEnvironment} to help build configurable and theme-aware log pipelines.
|
|
33
33
|
*/
|
|
34
34
|
/**
|
|
35
35
|
* @description Current package version string.
|
|
@@ -38,7 +38,7 @@ __exportStar(require("./utils.cjs"), exports);
|
|
|
38
38
|
* @type {string}
|
|
39
39
|
* @memberOf module:Logging
|
|
40
40
|
*/
|
|
41
|
-
exports.VERSION = "0.
|
|
41
|
+
exports.VERSION = "0.10.1";
|
|
42
42
|
/**
|
|
43
43
|
* @description Current package version string.
|
|
44
44
|
* @summary Stores the package version for diagnostics and compatibility checks.
|
package/lib/index.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ export * from "./types";
|
|
|
10
10
|
export * from "./web";
|
|
11
11
|
export * from "./utils";
|
|
12
12
|
/**
|
|
13
|
-
* @description Comprehensive logging toolkit for browser and Node environments.
|
|
14
|
-
* @summary Exposes {@link Logging} and {@link MiniLogger} for runtime logging, decorators such as {@link log} for method instrumentation, and utilities like {@link PatternFilter}, {@link StopWatch}, and {@link LoggedEnvironment} to build configurable, theme-aware log pipelines.
|
|
15
13
|
* @module Logging
|
|
14
|
+
* @description A comprehensive and versatile logging toolkit for both browser and Node.js environments.
|
|
15
|
+
* @summary This module provides a complete logging solution, exposing {@link Logging} and {@link MiniLogger} for runtime logging. It also includes decorators like {@link log} for method instrumentation, and various utilities such as {@link PatternFilter}, {@link StopWatch}, and {@link LoggedEnvironment} to help build configurable and theme-aware log pipelines.
|
|
16
16
|
*/
|
|
17
17
|
/**
|
|
18
18
|
* @description Current package version string.
|