@matter/general 0.13.0-alpha.0-20250318-c1aa38b08 → 0.13.0-alpha.0-20250323-770919c6a
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/cjs/codec/DnsCodec.js +1 -1
- package/dist/cjs/codec/DnsCodec.js.map +1 -1
- package/dist/cjs/log/Console.d.ts +21 -0
- package/dist/cjs/log/Console.d.ts.map +1 -0
- package/dist/cjs/log/Console.js +58 -0
- package/dist/cjs/log/Console.js.map +6 -0
- package/dist/cjs/log/Diagnostic.d.ts +6 -0
- package/dist/cjs/log/Diagnostic.d.ts.map +1 -1
- package/dist/cjs/log/Diagnostic.js +16 -0
- package/dist/cjs/log/Diagnostic.js.map +1 -1
- package/dist/cjs/log/LogDestination.d.ts +67 -0
- package/dist/cjs/log/LogDestination.d.ts.map +1 -0
- package/dist/cjs/log/LogDestination.js +65 -0
- package/dist/cjs/log/LogDestination.js.map +6 -0
- package/dist/cjs/log/LogFormat.d.ts +18 -12
- package/dist/cjs/log/LogFormat.d.ts.map +1 -1
- package/dist/cjs/log/LogFormat.js +17 -24
- package/dist/cjs/log/LogFormat.js.map +1 -1
- package/dist/cjs/log/LogLevel.d.ts +19 -9
- package/dist/cjs/log/LogLevel.d.ts.map +1 -1
- package/dist/cjs/log/LogLevel.js +40 -25
- package/dist/cjs/log/LogLevel.js.map +1 -1
- package/dist/cjs/log/Logger.d.ts +165 -109
- package/dist/cjs/log/Logger.d.ts.map +1 -1
- package/dist/cjs/log/Logger.js +307 -254
- package/dist/cjs/log/Logger.js.map +2 -2
- package/dist/cjs/log/index.d.ts +1 -0
- package/dist/cjs/log/index.d.ts.map +1 -1
- package/dist/cjs/log/index.js +1 -0
- package/dist/cjs/log/index.js.map +1 -1
- package/dist/cjs/time/Time.d.ts +1 -0
- package/dist/cjs/time/Time.d.ts.map +1 -1
- package/dist/cjs/time/Time.js +3 -0
- package/dist/cjs/time/Time.js.map +1 -1
- package/dist/cjs/transaction/Participant.d.ts +3 -3
- package/dist/cjs/transaction/Participant.d.ts.map +1 -1
- package/dist/cjs/transaction/Transaction.d.ts +20 -20
- package/dist/cjs/transaction/Tx.js +3 -3
- package/dist/cjs/transaction/Tx.js.map +1 -1
- package/dist/cjs/util/Construction.js +2 -2
- package/dist/cjs/util/Construction.js.map +1 -1
- package/dist/cjs/util/DataReadQueue.d.ts +4 -0
- package/dist/cjs/util/DataReadQueue.d.ts.map +1 -1
- package/dist/cjs/util/DataReadQueue.js +6 -0
- package/dist/cjs/util/DataReadQueue.js.map +1 -1
- package/dist/cjs/util/FormattedText.js +4 -2
- package/dist/cjs/util/FormattedText.js.map +1 -1
- package/dist/cjs/util/Observable.d.ts +137 -12
- package/dist/cjs/util/Observable.d.ts.map +1 -1
- package/dist/cjs/util/Observable.js +297 -35
- package/dist/cjs/util/Observable.js.map +2 -2
- package/dist/esm/codec/DnsCodec.js +1 -1
- package/dist/esm/codec/DnsCodec.js.map +1 -1
- package/dist/esm/log/Console.d.ts +21 -0
- package/dist/esm/log/Console.d.ts.map +1 -0
- package/dist/esm/log/Console.js +38 -0
- package/dist/esm/log/Console.js.map +6 -0
- package/dist/esm/log/Diagnostic.d.ts +6 -0
- package/dist/esm/log/Diagnostic.d.ts.map +1 -1
- package/dist/esm/log/Diagnostic.js +16 -0
- package/dist/esm/log/Diagnostic.js.map +1 -1
- package/dist/esm/log/LogDestination.d.ts +67 -0
- package/dist/esm/log/LogDestination.d.ts.map +1 -0
- package/dist/esm/log/LogDestination.js +45 -0
- package/dist/esm/log/LogDestination.js.map +6 -0
- package/dist/esm/log/LogFormat.d.ts +18 -12
- package/dist/esm/log/LogFormat.d.ts.map +1 -1
- package/dist/esm/log/LogFormat.js +17 -24
- package/dist/esm/log/LogFormat.js.map +1 -1
- package/dist/esm/log/LogLevel.d.ts +19 -9
- package/dist/esm/log/LogLevel.d.ts.map +1 -1
- package/dist/esm/log/LogLevel.js +40 -25
- package/dist/esm/log/LogLevel.js.map +1 -1
- package/dist/esm/log/Logger.d.ts +165 -109
- package/dist/esm/log/Logger.d.ts.map +1 -1
- package/dist/esm/log/Logger.js +307 -254
- package/dist/esm/log/Logger.js.map +2 -2
- package/dist/esm/log/index.d.ts +1 -0
- package/dist/esm/log/index.d.ts.map +1 -1
- package/dist/esm/log/index.js +1 -0
- package/dist/esm/log/index.js.map +1 -1
- package/dist/esm/time/Time.d.ts +1 -0
- package/dist/esm/time/Time.d.ts.map +1 -1
- package/dist/esm/time/Time.js +3 -0
- package/dist/esm/time/Time.js.map +1 -1
- package/dist/esm/transaction/Participant.d.ts +3 -3
- package/dist/esm/transaction/Participant.d.ts.map +1 -1
- package/dist/esm/transaction/Transaction.d.ts +20 -20
- package/dist/esm/transaction/Tx.js +3 -3
- package/dist/esm/transaction/Tx.js.map +1 -1
- package/dist/esm/util/Construction.js +2 -2
- package/dist/esm/util/Construction.js.map +1 -1
- package/dist/esm/util/DataReadQueue.d.ts +4 -0
- package/dist/esm/util/DataReadQueue.d.ts.map +1 -1
- package/dist/esm/util/DataReadQueue.js +6 -0
- package/dist/esm/util/DataReadQueue.js.map +1 -1
- package/dist/esm/util/FormattedText.js +4 -2
- package/dist/esm/util/FormattedText.js.map +1 -1
- package/dist/esm/util/Observable.d.ts +137 -12
- package/dist/esm/util/Observable.d.ts.map +1 -1
- package/dist/esm/util/Observable.js +297 -35
- package/dist/esm/util/Observable.js.map +2 -2
- package/package.json +2 -2
- package/src/codec/DnsCodec.ts +1 -1
- package/src/log/Console.ts +52 -0
- package/src/log/Diagnostic.ts +21 -0
- package/src/log/LogDestination.ts +113 -0
- package/src/log/LogFormat.ts +39 -36
- package/src/log/LogLevel.ts +55 -25
- package/src/log/Logger.ts +394 -314
- package/src/log/index.ts +1 -0
- package/src/time/Time.ts +4 -0
- package/src/transaction/Participant.ts +3 -3
- package/src/transaction/Transaction.ts +1 -1
- package/src/transaction/Tx.ts +3 -3
- package/src/util/Construction.ts +2 -2
- package/src/util/DataReadQueue.ts +7 -0
- package/src/util/FormattedText.ts +4 -2
- package/src/util/Observable.ts +453 -47
|
@@ -3,16 +3,26 @@
|
|
|
3
3
|
* Copyright 2022-2025 Matter.js Authors
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
export declare function logLevelFromString(level: string): LogLevel;
|
|
7
6
|
/**
|
|
8
|
-
*
|
|
7
|
+
* Supported logging severity levels.
|
|
9
8
|
*/
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
export type LogLevel = 0 | 1 | 2 | 3 | 4 | 5;
|
|
10
|
+
/**
|
|
11
|
+
* Map a string or number to a {@link LogLevel}
|
|
12
|
+
*/
|
|
13
|
+
export declare function LogLevel(level: string | LogLevel): LogLevel;
|
|
14
|
+
export declare namespace LogLevel { }
|
|
15
|
+
export declare namespace LogLevel {
|
|
16
|
+
const DEBUG: LogLevel;
|
|
17
|
+
const INFO: LogLevel;
|
|
18
|
+
const NOTICE: LogLevel;
|
|
19
|
+
const WARN: LogLevel;
|
|
20
|
+
const ERROR: LogLevel;
|
|
21
|
+
const FATAL: LogLevel;
|
|
22
|
+
const names: string[];
|
|
17
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated use {@link LogLevel}
|
|
26
|
+
*/
|
|
27
|
+
export declare const logLevelFromString: typeof LogLevel;
|
|
18
28
|
//# sourceMappingURL=LogLevel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogLevel.d.ts","sourceRoot":"","sources":["../../../src/log/LogLevel.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"LogLevel.d.ts","sourceRoot":"","sources":["../../../src/log/LogLevel.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE7C;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CA0B3D;yBA1Be,QAAQ;AA4BxB,yBAAiB,QAAQ,CAAC;IACf,MAAM,KAAK,EAAE,QAAY,CAAC;IAC1B,MAAM,IAAI,EAAE,QAAY,CAAC;IACzB,MAAM,MAAM,EAAE,QAAY,CAAC;IAC3B,MAAM,IAAI,EAAE,QAAY,CAAC;IACzB,MAAM,KAAK,EAAE,QAAY,CAAC;IAC1B,MAAM,KAAK,EAAE,QAAY,CAAC;IAE1B,MAAM,KAAK,UAAwD,CAAC;CAC9E;AASD;;GAEG;AACH,eAAO,MAAM,kBAAkB,iBAAW,CAAC"}
|
package/dist/cjs/log/LogLevel.js
CHANGED
|
@@ -22,36 +22,51 @@ __export(LogLevel_exports, {
|
|
|
22
22
|
logLevelFromString: () => logLevelFromString
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(LogLevel_exports);
|
|
25
|
+
var import_MatterError = require("#MatterError.js");
|
|
25
26
|
/**
|
|
26
27
|
* @license
|
|
27
28
|
* Copyright 2022-2025 Matter.js Authors
|
|
28
29
|
* SPDX-License-Identifier: Apache-2.0
|
|
29
30
|
*/
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return 0 /* DEBUG */;
|
|
34
|
-
case "info":
|
|
35
|
-
return 1 /* INFO */;
|
|
36
|
-
case "notice":
|
|
37
|
-
return 2 /* NOTICE */;
|
|
38
|
-
case "warn":
|
|
39
|
-
return 3 /* WARN */;
|
|
40
|
-
case "error":
|
|
41
|
-
return 4 /* ERROR */;
|
|
42
|
-
case "fatal":
|
|
43
|
-
return 5 /* FATAL */;
|
|
44
|
-
default:
|
|
45
|
-
return 1 /* INFO */;
|
|
31
|
+
function LogLevel(level) {
|
|
32
|
+
if (typeof level === "string" && level.match(/^\d+$/)) {
|
|
33
|
+
level = Number.parseInt(level);
|
|
46
34
|
}
|
|
35
|
+
if (typeof level === "string") {
|
|
36
|
+
switch (level.toLowerCase()) {
|
|
37
|
+
case "debug":
|
|
38
|
+
return LogLevel.DEBUG;
|
|
39
|
+
case "info":
|
|
40
|
+
return LogLevel.INFO;
|
|
41
|
+
case "notice":
|
|
42
|
+
return LogLevel.NOTICE;
|
|
43
|
+
case "warn":
|
|
44
|
+
return LogLevel.WARN;
|
|
45
|
+
case "error":
|
|
46
|
+
return LogLevel.ERROR;
|
|
47
|
+
case "fatal":
|
|
48
|
+
return LogLevel.FATAL;
|
|
49
|
+
default:
|
|
50
|
+
}
|
|
51
|
+
} else if (level >= 0 && level <= 5) {
|
|
52
|
+
return level;
|
|
53
|
+
}
|
|
54
|
+
throw new import_MatterError.ImplementationError(`Unsupported log level "${level}"`);
|
|
47
55
|
}
|
|
48
|
-
|
|
49
|
-
LogLevel2
|
|
50
|
-
LogLevel2
|
|
51
|
-
LogLevel2
|
|
52
|
-
LogLevel2
|
|
53
|
-
LogLevel2
|
|
54
|
-
LogLevel2
|
|
55
|
-
|
|
56
|
-
})(LogLevel || {});
|
|
56
|
+
((LogLevel2) => {
|
|
57
|
+
LogLevel2.DEBUG = 0;
|
|
58
|
+
LogLevel2.INFO = 1;
|
|
59
|
+
LogLevel2.NOTICE = 2;
|
|
60
|
+
LogLevel2.WARN = 3;
|
|
61
|
+
LogLevel2.ERROR = 4;
|
|
62
|
+
LogLevel2.FATAL = 5;
|
|
63
|
+
LogLevel2.names = ["debug", "info", "notice", "warn", "error", "fatal"];
|
|
64
|
+
})(LogLevel || (LogLevel = {}));
|
|
65
|
+
LogLevel[0] = "debug";
|
|
66
|
+
LogLevel[1] = "info";
|
|
67
|
+
LogLevel[2] = "notice";
|
|
68
|
+
LogLevel[3] = "warn";
|
|
69
|
+
LogLevel[4] = "error";
|
|
70
|
+
LogLevel[5] = "fatal";
|
|
71
|
+
const logLevelFromString = LogLevel;
|
|
57
72
|
//# sourceMappingURL=LogLevel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d,SAAS,CAAC,IAAI;AAKP,MAAM,qBAAqB;",
|
|
5
5
|
"names": ["LogLevel"]
|
|
6
6
|
}
|
package/dist/cjs/log/Logger.d.ts
CHANGED
|
@@ -4,59 +4,125 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { Diagnostic } from "./Diagnostic.js";
|
|
7
|
+
import { LogDestination } from "./LogDestination.js";
|
|
8
|
+
import { LogFormat } from "./LogFormat.js";
|
|
7
9
|
import { LogLevel } from "./LogLevel.js";
|
|
8
10
|
/**
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
export declare function consoleLogger(level: LogLevel, formattedLog: string): void;
|
|
12
|
-
export declare namespace consoleLogger {
|
|
13
|
-
/**
|
|
14
|
-
* The target for consoleLogger.
|
|
15
|
-
*/
|
|
16
|
-
let console: Console;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Definition of one registered Logger.
|
|
20
|
-
*/
|
|
21
|
-
type LoggerDefinition = {
|
|
22
|
-
logIdentifier: string;
|
|
23
|
-
logFormatter: (now: Date, level: LogLevel, facility: string, prefix: string, ...values: any[]) => string;
|
|
24
|
-
log: (level: LogLevel, formattedLog: string) => void;
|
|
25
|
-
defaultLogLevel: LogLevel;
|
|
26
|
-
logLevels: {
|
|
27
|
-
[facility: string]: LogLevel;
|
|
28
|
-
};
|
|
29
|
-
context?: Diagnostic.Context;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Logger that can be used to emit traces.
|
|
33
|
-
*
|
|
34
|
-
* The class supports adding multiple loggers for different targets. A default logger (identifier "default") is added on
|
|
35
|
-
* startup which logs to "console".
|
|
11
|
+
* matter.js logging API
|
|
36
12
|
*
|
|
37
13
|
* Usage:
|
|
38
14
|
*
|
|
39
|
-
* const
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* The configuration of the default logger can be adjusted by using the static properties of the Logger class:
|
|
15
|
+
* const logger = Logger.get("loggerName");
|
|
16
|
+
* logger.debug("My debug message", "my extra value to log");
|
|
43
17
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* - Logger.format = Format.ANSI enables colorization via ANSI escape sequences in default formatter
|
|
18
|
+
* matter.js writes logs to each {@link LogDestination} in {@link Logger.destinations}. By default a single destination
|
|
19
|
+
* named "default" writes to the JS console.
|
|
47
20
|
*
|
|
48
|
-
*
|
|
49
|
-
* configuration of these can be adjusted using static methods with the identifier as first parameter:
|
|
21
|
+
* You may adjust log verbosity and format by modifying the properties on destinations. For example:
|
|
50
22
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
23
|
+
* `Logger.format = LogFormat.PLAIN` sets all destinations to write plaintext
|
|
24
|
+
* `Logger.destinations.default.format = LogFormat.format.ansi` sets one destination to write ANSI
|
|
25
|
+
* `Logger.level = LogLevel.NOTICE` sets "notice" as the minimum level for all destinations
|
|
26
|
+
* `Logger.destinations.default.level = LogLevel.NOTICE` sets "notice" as level for one destination
|
|
54
27
|
*/
|
|
55
28
|
export declare class Logger {
|
|
56
29
|
#private;
|
|
57
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Log destinations.
|
|
32
|
+
*
|
|
33
|
+
* By default there is a single destination named "default". You can create new destinations using
|
|
34
|
+
* {@link LogDestination}. Add or remove destinations by modifying this object.
|
|
35
|
+
*
|
|
36
|
+
* Throws an error if you access a destination that doesn't exist.
|
|
37
|
+
*/
|
|
38
|
+
static destinations: Record<string, LogDestination>;
|
|
39
|
+
/**
|
|
40
|
+
* The number of indents to print with messages.
|
|
41
|
+
*/
|
|
58
42
|
static nestingLevel: number;
|
|
59
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Create a new logger for a facility.
|
|
45
|
+
*
|
|
46
|
+
* @param name the name of the facility
|
|
47
|
+
* @returns a new facility
|
|
48
|
+
*/
|
|
49
|
+
static get(name: string): Logger;
|
|
50
|
+
/**
|
|
51
|
+
* Get the default log level.
|
|
52
|
+
*/
|
|
53
|
+
static get level(): LogLevel | string;
|
|
54
|
+
/**
|
|
55
|
+
* Set log level as name or number for all destinations.
|
|
56
|
+
*/
|
|
57
|
+
static set level(level: LogLevel | string);
|
|
58
|
+
/**
|
|
59
|
+
* Get the default facility levels.
|
|
60
|
+
*/
|
|
61
|
+
static get facilityLevels(): Record<string, LogLevel | string>;
|
|
62
|
+
/**
|
|
63
|
+
* Set log level as name or number for facilities in all destinations.
|
|
64
|
+
*
|
|
65
|
+
* Existing levels that are not named in {@link levels} will remain unchanged.
|
|
66
|
+
*/
|
|
67
|
+
static set facilityLevels(levels: Record<string, LogLevel | string>);
|
|
68
|
+
/**
|
|
69
|
+
* Get the default format name.
|
|
70
|
+
*/
|
|
71
|
+
static get format(): string;
|
|
72
|
+
/**
|
|
73
|
+
* Set the format for all destinations.
|
|
74
|
+
*/
|
|
75
|
+
static set format(format: string | LogFormat.Formatter);
|
|
76
|
+
/**
|
|
77
|
+
* Mask a string with a given character. If unmaskedLength is provided then these number of characters will be
|
|
78
|
+
* shown unmasked.
|
|
79
|
+
*
|
|
80
|
+
* @param str String to mask
|
|
81
|
+
* @param maskChar character to mask with
|
|
82
|
+
* @param unmaskedLength number of characters to show unmasked in the beginning
|
|
83
|
+
*/
|
|
84
|
+
static maskString(str: string, maskChar?: string, unmaskedLength?: number): string;
|
|
85
|
+
/**
|
|
86
|
+
* Perform operations in a nested logging context. Messages will be
|
|
87
|
+
* indented while the context executes.
|
|
88
|
+
*/
|
|
89
|
+
static nest<T>(context: () => T): T;
|
|
90
|
+
/**
|
|
91
|
+
* Async version of nest().
|
|
92
|
+
*/
|
|
93
|
+
static nestAsync(context: () => Promise<any>): Promise<any>;
|
|
94
|
+
/**
|
|
95
|
+
* Unhandled error reporter.
|
|
96
|
+
*
|
|
97
|
+
* Some environments do not report full error details such as {@link Error#cause} and {@link AggregateError#errors}.
|
|
98
|
+
*
|
|
99
|
+
* To ensure these details are always recorded somewhere, unhandled errors may be reported here.
|
|
100
|
+
*
|
|
101
|
+
* To disable this behavior replace this function.
|
|
102
|
+
*/
|
|
103
|
+
static reportUnhandledError(error: Error): void;
|
|
104
|
+
constructor(name: string);
|
|
105
|
+
debug(...values: unknown[]): void;
|
|
106
|
+
info(...values: unknown[]): void;
|
|
107
|
+
notice(...values: unknown[]): void;
|
|
108
|
+
warn(...values: unknown[]): void;
|
|
109
|
+
error(...values: unknown[]): void;
|
|
110
|
+
fatal(...values: unknown[]): void;
|
|
111
|
+
log(level: LogLevel, ...values: unknown[]): void;
|
|
112
|
+
/**
|
|
113
|
+
* Stringify a value (BigInt aware) as JSON.
|
|
114
|
+
*
|
|
115
|
+
* @param data the value to stringify
|
|
116
|
+
* @returns the stringified value
|
|
117
|
+
*
|
|
118
|
+
* @deprecated use {@link Diagnostic.json}
|
|
119
|
+
*/
|
|
120
|
+
static toJSON(data: any): string;
|
|
121
|
+
/**
|
|
122
|
+
* Add additional logger to the list of loggers including the default configuration.
|
|
123
|
+
*
|
|
124
|
+
* @deprecated use {@link destinations}
|
|
125
|
+
*/
|
|
60
126
|
static addLogger(identifier: string, logger: (level: LogLevel, formattedLog: string) => void, options?: {
|
|
61
127
|
defaultLogLevel?: LogLevel;
|
|
62
128
|
logLevels?: {
|
|
@@ -64,31 +130,41 @@ export declare class Logger {
|
|
|
64
130
|
};
|
|
65
131
|
logFormat?: string;
|
|
66
132
|
}): void;
|
|
133
|
+
/**
|
|
134
|
+
* @deprecated use {@link destinations}
|
|
135
|
+
*/
|
|
67
136
|
static removeLogger(identifier: string): void;
|
|
68
137
|
/**
|
|
69
|
-
*
|
|
138
|
+
* Check if a logger with the matching identifier exists.
|
|
70
139
|
* @param identifier The identifier of the logger
|
|
140
|
+
*
|
|
141
|
+
* @deprecated use {@link destinations}
|
|
71
142
|
*/
|
|
72
|
-
static
|
|
143
|
+
static hasLoggerForIdentifier(identifier: string): boolean;
|
|
73
144
|
/**
|
|
74
|
-
*
|
|
145
|
+
* Get the logger with the matching identifier.
|
|
146
|
+
* @param identifier The identifier of the logger
|
|
147
|
+
*
|
|
148
|
+
* @deprecated use {@link destinations}
|
|
75
149
|
*/
|
|
76
|
-
static
|
|
150
|
+
static getLoggerForIdentifier(identifier: string): LoggerDefinition;
|
|
77
151
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* @param format the name of the formatter (see Format enum)
|
|
152
|
+
* @deprecated use {@link destinations}
|
|
81
153
|
*/
|
|
82
|
-
static
|
|
154
|
+
static getLoggerforIdentifier(identifier: string): LoggerDefinition;
|
|
83
155
|
/**
|
|
84
156
|
* Set facility loglevels for the default logger.
|
|
85
157
|
* @param levels The levels to set
|
|
158
|
+
*
|
|
159
|
+
* @deprecated use {@link destinations}
|
|
86
160
|
*/
|
|
87
161
|
static set logLevels(levels: {
|
|
88
162
|
[facility: string]: LogLevel;
|
|
89
163
|
});
|
|
90
164
|
/**
|
|
91
165
|
* Get facility loglevels for the default logger.
|
|
166
|
+
*
|
|
167
|
+
* @deprecated use {@link Logger.facilityLevels}
|
|
92
168
|
*/
|
|
93
169
|
static get logLevels(): {
|
|
94
170
|
[facility: string]: LogLevel;
|
|
@@ -97,30 +173,42 @@ export declare class Logger {
|
|
|
97
173
|
* Set default loglevel for the default logger.
|
|
98
174
|
*
|
|
99
175
|
* @param level The level to set
|
|
176
|
+
*
|
|
177
|
+
* @deprecated use {@link Logger.level}
|
|
100
178
|
*/
|
|
101
179
|
static set defaultLogLevel(level: LogLevel);
|
|
102
180
|
/**
|
|
103
181
|
* Get default loglevel for the default logger.
|
|
182
|
+
*
|
|
183
|
+
* @deprecated use {@link destinations}
|
|
104
184
|
*/
|
|
105
185
|
static get defaultLogLevel(): LogLevel;
|
|
106
186
|
/**
|
|
107
187
|
* Set the log function for the default logger.
|
|
108
188
|
*
|
|
109
189
|
* @param log The log function to set
|
|
190
|
+
*
|
|
191
|
+
* @deprecated use {@link destinations}
|
|
110
192
|
*/
|
|
111
|
-
static set log(log: (level: LogLevel, formattedLog: string) => void);
|
|
193
|
+
static set log(log: (level: LogLevel, formattedLog: string, facility?: string) => void);
|
|
112
194
|
/**
|
|
113
195
|
* Get the log function for the default logger.
|
|
196
|
+
*
|
|
197
|
+
* @deprecated use {@link destinations}
|
|
114
198
|
*/
|
|
115
|
-
static get log(): (level: LogLevel, formattedLog: string) => void;
|
|
199
|
+
static get log(): (level: LogLevel, formattedLog: string, facility?: string) => void;
|
|
116
200
|
/**
|
|
117
201
|
* Set the log formatter for the default logger.
|
|
118
202
|
*
|
|
119
203
|
* @param logFormatter
|
|
204
|
+
*
|
|
205
|
+
* @deprecated use {@link destinations}
|
|
120
206
|
*/
|
|
121
207
|
static set logFormatter(logFormatter: (now: Date, level: LogLevel, facility: string, nestingPrefix: string, values: any[]) => string);
|
|
122
208
|
/**
|
|
123
209
|
* Get the log formatter for the default logger.
|
|
210
|
+
*
|
|
211
|
+
* @deprecated use {@link destinations}
|
|
124
212
|
*/
|
|
125
213
|
static get logFormatter(): (now: Date, level: LogLevel, facility: string, nestingPrefix: string, values: any[]) => string;
|
|
126
214
|
/**
|
|
@@ -128,6 +216,8 @@ export declare class Logger {
|
|
|
128
216
|
*
|
|
129
217
|
* @param identifier The identifier of the logger
|
|
130
218
|
* @param format the name of the formatter (see Format enum)
|
|
219
|
+
*
|
|
220
|
+
* @deprecated use {@link destinations}
|
|
131
221
|
*/
|
|
132
222
|
static setFormatForLogger(identifier: string, format: string): void;
|
|
133
223
|
/**
|
|
@@ -135,6 +225,8 @@ export declare class Logger {
|
|
|
135
225
|
*
|
|
136
226
|
* @param identifier The identifier of the logger
|
|
137
227
|
* @param level The level to set
|
|
228
|
+
*
|
|
229
|
+
* @deprecated use {@link destinations}
|
|
138
230
|
*/
|
|
139
231
|
static setDefaultLoglevelForLogger(identifier: string, level: LogLevel): void;
|
|
140
232
|
/**
|
|
@@ -142,6 +234,8 @@ export declare class Logger {
|
|
|
142
234
|
*
|
|
143
235
|
* @param identifier The identifier of the logger
|
|
144
236
|
* @param levels The levels to set
|
|
237
|
+
*
|
|
238
|
+
* @deprecated use {@link destinations}
|
|
145
239
|
*/
|
|
146
240
|
static setLogLevelsForLogger(identifier: string, levels: {
|
|
147
241
|
[facility: string]: LogLevel;
|
|
@@ -151,72 +245,34 @@ export declare class Logger {
|
|
|
151
245
|
*
|
|
152
246
|
* @param identifier The identifier of the logger
|
|
153
247
|
* @param log The log function to set
|
|
248
|
+
*
|
|
249
|
+
* @deprecated use {@link destinations}
|
|
154
250
|
*/
|
|
155
|
-
static setLogger(identifier: string, log: (level: LogLevel, formattedLog: string) => void): void;
|
|
251
|
+
static setLogger(identifier: string, log: (level: LogLevel, formattedLog: string, facility?: string) => void): void;
|
|
156
252
|
/**
|
|
157
253
|
* Set the log formatter for the logger with the matching identifier.
|
|
158
254
|
*
|
|
159
255
|
* @param identifier The identifier of the logger
|
|
160
256
|
* @param logFormatter The log formatter to set
|
|
161
|
-
*/
|
|
162
|
-
static setLogFormatterForLogger(identifier: string, logFormatter: (now: Date, level: LogLevel, facility: string, nestingPrefix: string, values: any[]) => string): void;
|
|
163
|
-
/**
|
|
164
|
-
* Create a new facility.
|
|
165
|
-
*
|
|
166
|
-
* @param name the name of the facility
|
|
167
|
-
* @returns a new facility
|
|
168
|
-
*/
|
|
169
|
-
static get(name: string): Logger;
|
|
170
|
-
/**
|
|
171
|
-
* Stringify a value (BigInt aware) as JSON.
|
|
172
257
|
*
|
|
173
|
-
* @
|
|
174
|
-
* @returns the stringified value
|
|
258
|
+
* @deprecated use {@link destinations}
|
|
175
259
|
*/
|
|
176
|
-
static
|
|
177
|
-
/**
|
|
178
|
-
* Mask a string with a given character. If unmaskedLength is provided then these number of characters will be
|
|
179
|
-
* shown unmasked.
|
|
180
|
-
*
|
|
181
|
-
* @param str String to mask
|
|
182
|
-
* @param maskChar character to mask with
|
|
183
|
-
* @param unmaskedLength number of characters to show unmasked in the beginning
|
|
184
|
-
*/
|
|
185
|
-
static maskString(str: string, maskChar?: string, unmaskedLength?: number): string;
|
|
186
|
-
/**
|
|
187
|
-
* Perform operations in a nested logging context. Messages will be
|
|
188
|
-
* indented while the context executes.
|
|
189
|
-
*/
|
|
190
|
-
static nest<T>(context: () => T): T;
|
|
191
|
-
/**
|
|
192
|
-
* Async version of nest().
|
|
193
|
-
*/
|
|
194
|
-
static nestAsync(context: () => Promise<any>): Promise<any>;
|
|
195
|
-
/**
|
|
196
|
-
* Unhandled error reporter.
|
|
197
|
-
*
|
|
198
|
-
* Some environments do not report full error details such as {@link Error#cause} and {@link AggregateError#errors}.
|
|
199
|
-
*
|
|
200
|
-
* To ensure these details are always recorded somewhere, unhandled errors may be reported here.
|
|
201
|
-
*
|
|
202
|
-
* To disable this behavior replace this function.
|
|
203
|
-
*/
|
|
204
|
-
static reportUnhandledError(error: Error): void;
|
|
205
|
-
/**
|
|
206
|
-
* Invoke logic and return any log messages produced.
|
|
207
|
-
*/
|
|
208
|
-
static capture(fn: () => void, fromLogger?: string): {
|
|
209
|
-
level: LogLevel;
|
|
210
|
-
message: string;
|
|
211
|
-
}[];
|
|
212
|
-
constructor(name: string);
|
|
213
|
-
debug: (...values: any[]) => void;
|
|
214
|
-
info: (...values: any[]) => void;
|
|
215
|
-
notice: (...values: any[]) => void;
|
|
216
|
-
warn: (...values: any[]) => void;
|
|
217
|
-
error: (...values: any[]) => void;
|
|
218
|
-
fatal: (...values: any[]) => void;
|
|
219
|
-
log: (level: LogLevel, ...values: any[]) => void;
|
|
260
|
+
static setLogFormatterForLogger(identifier: string, logFormatter: (now: Date, level: LogLevel, facility: string, nestingPrefix: string, values: any[]) => string): void;
|
|
220
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* Definition of one registered Logger.
|
|
264
|
+
*
|
|
265
|
+
* @deprecated
|
|
266
|
+
*/
|
|
267
|
+
type LoggerDefinition = {
|
|
268
|
+
logIdentifier: string;
|
|
269
|
+
logFormatter: (now: Date, level: LogLevel, facility: string, prefix: string, values: any[]) => string;
|
|
270
|
+
log: (level: LogLevel, formattedLog: string, facility?: string) => void;
|
|
271
|
+
defaultLogLevel: LogLevel;
|
|
272
|
+
logLevels: {
|
|
273
|
+
[facility: string]: LogLevel;
|
|
274
|
+
};
|
|
275
|
+
context?: Diagnostic.Context;
|
|
276
|
+
};
|
|
221
277
|
export {};
|
|
222
278
|
//# sourceMappingURL=Logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../../src/log/Logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../../src/log/Logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAmB,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,MAAM;;IACf;;;;;;;OAOG;IACH,MAAM,CAAC,YAAY,iCAAqB;IAExC;;OAEG;IACH,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC;IAI5B;;;;;OAKG;IACH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM;IAIvB;;OAEG;IACH,MAAM,KAAK,KAAK,IAOQ,QAAQ,GAAG,MAAM,CALxC;IAED;;OAEG;IACH,MAAM,KAAK,KAAK,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,EAQxC;IAED;;OAEG;IACH,MAAM,KAAK,cAAc,IASS,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAAC,CAPlE;IAED;;;;OAIG;IACH,MAAM,KAAK,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,G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