@decaf-ts/logging 0.11.3 → 0.12.0
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/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/cjs/LoggedClass.js.map +1 -0
- package/lib/cjs/constants.js.map +1 -0
- package/lib/cjs/decorators.js.map +1 -0
- package/lib/cjs/environment.js.map +1 -0
- package/lib/cjs/filters/LogFilter.js.map +1 -0
- package/lib/cjs/filters/PatternFilter.js.map +1 -0
- package/lib/cjs/filters/index.js.map +1 -0
- package/lib/{index.cjs → cjs/index.cjs} +1 -1
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/logParameters.js.map +1 -0
- package/lib/{logging.cjs → cjs/logging.cjs} +6 -2
- package/lib/cjs/logging.js.map +1 -0
- package/lib/cjs/pino/index.js.map +1 -0
- package/lib/cjs/pino/pino.js.map +1 -0
- package/lib/cjs/text.js.map +1 -0
- package/lib/cjs/time.js.map +1 -0
- package/lib/cjs/types.js.map +1 -0
- package/lib/cjs/utils.js.map +1 -0
- package/lib/cjs/web.js.map +1 -0
- package/lib/cjs/winston/index.js.map +1 -0
- package/lib/cjs/winston/winston.js.map +1 -0
- package/lib/esm/index.js +1 -1
- package/lib/esm/logging.js +6 -2
- package/lib/esm/logging.js.map +1 -1
- package/lib/{logging.d.ts → types/logging.d.ts} +3 -2
- package/package.json +15 -13
- package/lib/LoggedClass.js.map +0 -1
- package/lib/constants.js.map +0 -1
- package/lib/decorators.js.map +0 -1
- package/lib/environment.js.map +0 -1
- package/lib/esm/LoggedClass.d.ts +0 -39
- package/lib/esm/constants.d.ts +0 -104
- package/lib/esm/decorators.d.ts +0 -109
- package/lib/esm/environment.d.ts +0 -120
- package/lib/esm/logging.d.ts +0 -372
- package/lib/filters/LogFilter.d.ts +0 -43
- package/lib/filters/LogFilter.js.map +0 -1
- package/lib/filters/PatternFilter.d.ts +0 -56
- package/lib/filters/PatternFilter.js.map +0 -1
- package/lib/filters/index.d.ts +0 -7
- package/lib/filters/index.js.map +0 -1
- package/lib/index.d.ts +0 -34
- package/lib/index.js.map +0 -1
- package/lib/logParameters.d.ts +0 -56
- package/lib/logParameters.js.map +0 -1
- package/lib/logging.js.map +0 -1
- package/lib/pino/index.d.ts +0 -7
- package/lib/pino/index.js.map +0 -1
- package/lib/pino/pino.d.ts +0 -29
- package/lib/pino/pino.js.map +0 -1
- package/lib/text.d.ts +0 -118
- package/lib/text.js.map +0 -1
- package/lib/time.d.ts +0 -151
- package/lib/time.js.map +0 -1
- package/lib/types.d.ts +0 -287
- package/lib/types.js.map +0 -1
- package/lib/utils.d.ts +0 -48
- package/lib/utils.js.map +0 -1
- package/lib/web.d.ts +0 -8
- package/lib/web.js.map +0 -1
- package/lib/winston/index.d.ts +0 -7
- package/lib/winston/index.js.map +0 -1
- package/lib/winston/winston.d.ts +0 -47
- package/lib/winston/winston.js.map +0 -1
- /package/lib/{LoggedClass.cjs → cjs/LoggedClass.cjs} +0 -0
- /package/lib/{constants.cjs → cjs/constants.cjs} +0 -0
- /package/lib/{decorators.cjs → cjs/decorators.cjs} +0 -0
- /package/lib/{environment.cjs → cjs/environment.cjs} +0 -0
- /package/lib/{filters → cjs/filters}/LogFilter.cjs +0 -0
- /package/lib/{filters → cjs/filters}/PatternFilter.cjs +0 -0
- /package/lib/{filters → cjs/filters}/index.cjs +0 -0
- /package/lib/{logParameters.cjs → cjs/logParameters.cjs} +0 -0
- /package/lib/{pino → cjs/pino}/index.cjs +0 -0
- /package/lib/{pino → cjs/pino}/pino.cjs +0 -0
- /package/lib/{text.cjs → cjs/text.cjs} +0 -0
- /package/lib/{time.cjs → cjs/time.cjs} +0 -0
- /package/lib/{types.cjs → cjs/types.cjs} +0 -0
- /package/lib/{utils.cjs → cjs/utils.cjs} +0 -0
- /package/lib/{web.cjs → cjs/web.cjs} +0 -0
- /package/lib/{winston → cjs/winston}/index.cjs +0 -0
- /package/lib/{winston → cjs/winston}/winston.cjs +0 -0
- /package/lib/{LoggedClass.d.ts → types/LoggedClass.d.ts} +0 -0
- /package/lib/{constants.d.ts → types/constants.d.ts} +0 -0
- /package/lib/{decorators.d.ts → types/decorators.d.ts} +0 -0
- /package/lib/{environment.d.ts → types/environment.d.ts} +0 -0
- /package/lib/{esm → types}/filters/LogFilter.d.ts +0 -0
- /package/lib/{esm → types}/filters/PatternFilter.d.ts +0 -0
- /package/lib/{esm → types}/filters/index.d.ts +0 -0
- /package/lib/{esm → types}/index.d.ts +0 -0
- /package/lib/{esm → types}/logParameters.d.ts +0 -0
- /package/lib/{esm → types}/pino/index.d.ts +0 -0
- /package/lib/{esm → types}/pino/pino.d.ts +0 -0
- /package/lib/{esm → types}/text.d.ts +0 -0
- /package/lib/{esm → types}/time.d.ts +0 -0
- /package/lib/{esm → types}/types.d.ts +0 -0
- /package/lib/{esm → types}/utils.d.ts +0 -0
- /package/lib/{esm → types}/web.d.ts +0 -0
- /package/lib/{esm → types}/winston/index.d.ts +0 -0
- /package/lib/{esm → types}/winston/winston.d.ts +0 -0
package/lib/pino/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pino/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,6CAAuB"}
|
package/lib/pino/pino.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Logger as PinoBaseLogger } from "pino";
|
|
2
|
-
import { MiniLogger } from "../logging";
|
|
3
|
-
import { Logger, LoggerFactory, LogMeta, LoggingConfig, StringLike } from "../types";
|
|
4
|
-
import { LogLevel } from "../constants";
|
|
5
|
-
/**
|
|
6
|
-
* @description A logger that is powered by the Pino logging library.
|
|
7
|
-
* @summary This class extends {@link MiniLogger} and uses Pino as its underlying logging engine.
|
|
8
|
-
* @param {string} [context] - The context (typically the class name) that this logger is associated with.
|
|
9
|
-
* @param {Partial<LoggingConfig>} [conf] - Optional configuration to override global settings.
|
|
10
|
-
* @param {PinoBaseLogger} [driver] - An optional, pre-existing Pino logger instance to use.
|
|
11
|
-
* @class PinoLogger
|
|
12
|
-
*/
|
|
13
|
-
export declare class PinoLogger extends MiniLogger implements Logger {
|
|
14
|
-
protected pino: PinoBaseLogger;
|
|
15
|
-
constructor(context?: string, conf?: Partial<LoggingConfig>, driver?: PinoBaseLogger);
|
|
16
|
-
protected log(level: LogLevel, msg: StringLike | Error, error?: Error, meta?: LogMeta): void;
|
|
17
|
-
fatal(msg: StringLike | Error, error?: Error, meta?: LogMeta): void;
|
|
18
|
-
child(bindings?: Record<string, unknown>, options?: Record<string, unknown>): PinoLogger;
|
|
19
|
-
flush(): void | Promise<void>;
|
|
20
|
-
get level(): string | undefined;
|
|
21
|
-
set level(value: string | undefined);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @description A factory for creating {@link PinoLogger} instances.
|
|
25
|
-
* @summary This factory function creates a new {@link PinoLogger} instance, and can optionally accept a pre-existing Pino logger instance.
|
|
26
|
-
* @const {LoggerFactory} PinoFactory
|
|
27
|
-
* @memberOf module:Logging
|
|
28
|
-
*/
|
|
29
|
-
export declare const PinoFactory: LoggerFactory;
|
package/lib/pino/pino.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pino.js","sourceRoot":"","sources":["../../src/pino/pino.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAKc;AACd,8CAAiD;AAQjD,kDAAwC;AAWxC,MAAM,cAAc,GAAoC;IACtD,CAAC,oBAAQ,CAAC,SAAS,CAAC,EAAE,MAAM;IAC5B,CAAC,oBAAQ,CAAC,KAAK,CAAC,EAAE,OAAO;IACzB,CAAC,oBAAQ,CAAC,IAAI,CAAC,EAAE,MAAM;IACvB,CAAC,oBAAQ,CAAC,IAAI,CAAC,EAAE,MAAM;IAC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AkB,CAAY,IAAI,GAAG,CACnD,EACH,IAAI,CAAC,IAAI,EACT,aAAa,CACd,CAAC;QACF,WAAW,CAAC,OAAO,GAAG,WAAW;YAC/B,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC;YAChC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,KAAK;QACH,IAAI,OAAQ,IAAI,CAAC,IAAY,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;YACnD,OAAQ,IAAI,CAAC,IAAY,CAAC,KAAK,EAAE,CAAC;QACpC,CAAC;IACH,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IACzB,CAAC;IAED,IAAI,KAAK,CAAC,KAAyB;QACjC,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACxB,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,MAAM;YAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IAChD,CAAC;CACF;AApHD,gCAoHC;AAED;;;;;GAKG;AACI,MAAM,WAAW,GAAkB,CACxC,OAAgB,EAChB,IAA6B,EAC7B,GAAG,IAAW,EACd,EAAE;IACF,MAAM,CAAC,MAAM,CAAC,GAAG,IAAoC,CAAC;IACtD,OAAO,IAAI,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAC/C,CAAC,CAAC;AAPW,QAAA,WAAW,eAOtB"}
|
package/lib/text.d.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description Pads the end of a string with a specified character.
|
|
3
|
-
* @summary This function extends the input string to a specified length by adding a padding character to the end. If the input string is already longer than the specified length, it is returned unchanged.
|
|
4
|
-
* @param {string} str - The input string to be padded.
|
|
5
|
-
* @param {number} length - The desired total length of the resulting string.
|
|
6
|
-
* @param {string} [char=" "] - The character to use for padding.
|
|
7
|
-
* @return {string} The padded string.
|
|
8
|
-
* @throws {Error} If the padding character is not exactly one character long.
|
|
9
|
-
* @function padEnd
|
|
10
|
-
* @memberOf module:Logging
|
|
11
|
-
*/
|
|
12
|
-
export declare function padEnd(str: string, length: number, char?: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* @description Replaces placeholders in a string with the provided values.
|
|
15
|
-
* @summary This function interpolates a string by replacing placeholders of the form `${variableName}` with the corresponding values from the provided object. If a placeholder does not have a corresponding value, it is left unchanged in the string.
|
|
16
|
-
* @param {string} input - The input string containing the placeholders to be replaced.
|
|
17
|
-
* @param {Record<string, (number|string)>} values - An object containing key-value pairs for the replacement.
|
|
18
|
-
* @param {string} [prefix="${"] - The prefix for the placeholders.
|
|
19
|
-
* @param {string} [suffix="}"] - The suffix for the placeholders.
|
|
20
|
-
* @param {string} [flags="g"] - The regular expression flags to use.
|
|
21
|
-
* @return {string} The interpolated string with the placeholders replaced by their corresponding values.
|
|
22
|
-
* @function patchPlaceholders
|
|
23
|
-
* @mermaid
|
|
24
|
-
* sequenceDiagram
|
|
25
|
-
* participant Caller
|
|
26
|
-
* participant patchString
|
|
27
|
-
* participant String.replace
|
|
28
|
-
* Caller->>patchString: Call with input and values
|
|
29
|
-
* patchString->>String.replace: Call with regex and replacement function
|
|
30
|
-
* String.replace->>patchString: Return replaced string
|
|
31
|
-
* patchString-->>Caller: Return patched string
|
|
32
|
-
* @memberOf module:Logging
|
|
33
|
-
*/
|
|
34
|
-
export declare function patchPlaceholders(input: string, values: Record<string, number | string>, prefix?: string, suffix?: string, flags?: string): string;
|
|
35
|
-
/**
|
|
36
|
-
* @description Replaces occurrences of keys with their corresponding values in a string.
|
|
37
|
-
* @summary This function iterates through a set of key-value pairs and replaces all occurrences of each key in the input string with its corresponding value. It supports regular expression flags for customized replacement.
|
|
38
|
-
* @param {string} input - The input string in which the replacements will be made.
|
|
39
|
-
* @param {Record<string, (number|string)>} values - An object containing key-value pairs for the replacement.
|
|
40
|
-
* @param {string} [flags="g"] - The regular expression flags to control the replacement behavior.
|
|
41
|
-
* @return {string} The string with all the specified replacements applied.
|
|
42
|
-
* @function patchString
|
|
43
|
-
* @memberOf module:Logging
|
|
44
|
-
*/
|
|
45
|
-
export declare function patchString(input: string, values: Record<string, number | string>, flags?: string): string;
|
|
46
|
-
/**
|
|
47
|
-
* @description Converts a string to camelCase.
|
|
48
|
-
* @summary This function transforms the input string into camelCase format, where words are joined without spaces and each word after the first starts with a capital letter.
|
|
49
|
-
* @param {string} text - The input string to be converted.
|
|
50
|
-
* @return {string} The input string converted to camelCase.
|
|
51
|
-
* @function toCamelCase
|
|
52
|
-
* @memberOf module:Logging
|
|
53
|
-
*/
|
|
54
|
-
export declare function toCamelCase(text: string): string;
|
|
55
|
-
/**
|
|
56
|
-
* @description Converts a string to ENVIRONMENT_VARIABLE format.
|
|
57
|
-
* @summary This function transforms the input string into uppercase with words separated by underscores, which is a format that is typically used for environment variable names.
|
|
58
|
-
* @param {string} text - The input string to be converted.
|
|
59
|
-
* @return {string} The input string converted to ENVIRONMENT_VARIABLE format.
|
|
60
|
-
* @function toENVFormat
|
|
61
|
-
* @memberOf module:Logging
|
|
62
|
-
*/
|
|
63
|
-
export declare function toENVFormat(text: string): string;
|
|
64
|
-
/**
|
|
65
|
-
* @description Converts a string to snake_case.
|
|
66
|
-
* @summary This function transforms the input string into lowercase with words separated by underscores.
|
|
67
|
-
* @param {string} text - The input string to be converted.
|
|
68
|
-
* @return {string} The input string converted to snake_case.
|
|
69
|
-
* @function toSnakeCase
|
|
70
|
-
* @memberOf module:Logging
|
|
71
|
-
*/
|
|
72
|
-
export declare function toSnakeCase(text: string): string;
|
|
73
|
-
/**
|
|
74
|
-
* @description Converts a string to kebab-case.
|
|
75
|
-
* @summary This function transforms the input string into lowercase with words separated by hyphens.
|
|
76
|
-
* @param {string} text - The input string to be converted.
|
|
77
|
-
* @return {string} The input string converted to kebab-case.
|
|
78
|
-
* @function toKebabCase
|
|
79
|
-
* @memberOf module:Logging
|
|
80
|
-
*/
|
|
81
|
-
export declare function toKebabCase(text: string): string;
|
|
82
|
-
/**
|
|
83
|
-
* @description Converts a string to PascalCase.
|
|
84
|
-
* @summary This function transforms the input string into PascalCase format, where words are joined without spaces and each word starts with a capital letter.
|
|
85
|
-
* @param {string} text - The input string to be converted.
|
|
86
|
-
* @return {string} The input string converted to PascalCase.
|
|
87
|
-
* @function toPascalCase
|
|
88
|
-
* @memberOf module:Logging
|
|
89
|
-
*/
|
|
90
|
-
export declare function toPascalCase(text: string): string;
|
|
91
|
-
/**
|
|
92
|
-
* @description Escapes special characters in a string for use in a regular expression.
|
|
93
|
-
* @summary This function adds backslashes before characters that have a special meaning in regular expressions, which allows the string to be used as a literal match in a RegExp.
|
|
94
|
-
* @param {string} string - The string to escape for regular expression use.
|
|
95
|
-
* @return {string} The escaped string that is safe for use in regular expressions.
|
|
96
|
-
* @function escapeRegExp
|
|
97
|
-
* @memberOf module:Logging
|
|
98
|
-
*/
|
|
99
|
-
export declare function escapeRegExp(string: string): string;
|
|
100
|
-
/**
|
|
101
|
-
* @description A utility function that provides string formatting functionality that is similar to C#'s string.format.
|
|
102
|
-
* @summary This function replaces placeholders in a string with the provided arguments.
|
|
103
|
-
* @param {string} string - The string to format.
|
|
104
|
-
* @param {...(string|number|Record<string, any>)} args - The arguments to use for formatting.
|
|
105
|
-
* @return {string} The formatted string.
|
|
106
|
-
* @function sf
|
|
107
|
-
* @memberOf module:Logging
|
|
108
|
-
*/
|
|
109
|
-
export declare function sf(string: string, ...args: (string | number | Record<string, any>)[]): string;
|
|
110
|
-
/**
|
|
111
|
-
* @description A utility function that provides string formatting functionality that is similar to C#'s string.format.
|
|
112
|
-
* @summary This function is deprecated. Use {@link sf} instead.
|
|
113
|
-
* @see sf
|
|
114
|
-
* @deprecated
|
|
115
|
-
* @function stringFormat
|
|
116
|
-
* @memberOf module:Logging
|
|
117
|
-
*/
|
|
118
|
-
export declare const stringFormat: typeof sf;
|
package/lib/text.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":";;;AAaA,wBAQC;AAuBD,8CAeC;AAYD,kCAUC;AAUD,kCAMC;AAUD,kCAEC;AAUD,kCAKC;AAUD,kCAKC;AAUD,oCAIC;AAUD,oCAEC;AAWD,gBA2BC;AA3MD,+CAAyD;AAEzD;;;;;;;;;;GAUG;AACH,SAAgB,MAAM,CACpB,GAAW,EACX,MAAc,EACd,OAAe,GAAG;IAElB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,OAAO,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,iBAAiB,CAC/B,KAAa,EACb,MAAuC,EACvC,SAAiB,sCAA0B,CAAC,CAAC,CAAC,EAC9C,SAAiB,sCAA0B,CAAC,CAAC,CAAC,EAC9C,QAAgB,GAAG;IAEnB,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAChD,CAAC,GAAwB,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE;QACvC,GAAG,CAAC,GAAG,MAAM,GAAG,GAAG,GAAG,MAAM,EAAE,CAAC,GAAG,GAAG,CAAC;QACtC,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAE,CACH,CAAC;IACF,OAAO,WAAW,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,WAAW,CACzB,KAAa,EACb,MAAuC,EACvC,QAAgB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,CAAC,QAAQ,EAAE;YACzB,CAAC,CAAC,WAAW,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACU,QAAA,YAAY,GAAG,EAAE,CAAC"}
|
package/lib/time.d.ts
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description A snapshot of a recorded lap interval.
|
|
3
|
-
* @summary This captures the lap index, an optional label, the elapsed milliseconds for the lap, and the cumulative elapsed time since the stopwatch started.
|
|
4
|
-
* @typedef {object} Lap
|
|
5
|
-
* @property {number} index - The zero-based lap order.
|
|
6
|
-
* @property {string} [label] - An optional label that describes the lap.
|
|
7
|
-
* @property {number} ms - The duration of the lap in milliseconds.
|
|
8
|
-
* @property {number} totalMs - The total elapsed time when the lap was recorded.
|
|
9
|
-
* @memberOf module:Logging
|
|
10
|
-
*/
|
|
11
|
-
export type Lap = {
|
|
12
|
-
index: number;
|
|
13
|
-
label?: string;
|
|
14
|
-
/** Duration of this lap in milliseconds */
|
|
15
|
-
ms: number;
|
|
16
|
-
/** Cumulative time up to this lap in milliseconds */
|
|
17
|
-
totalMs: number;
|
|
18
|
-
};
|
|
19
|
-
type NowFn = () => number;
|
|
20
|
-
/**
|
|
21
|
-
* @description A high-resolution clock accessor that returns milliseconds.
|
|
22
|
-
* @summary This function chooses the most precise timer available in the current runtime, preferring `performance.now` or `process.hrtime.bigint`.
|
|
23
|
-
* @return {number} The milliseconds that have elapsed, according to the best available clock.
|
|
24
|
-
* @function now
|
|
25
|
-
* @memberOf module:Logging
|
|
26
|
-
*/
|
|
27
|
-
export declare const now: NowFn;
|
|
28
|
-
/**
|
|
29
|
-
* @description A high-resolution stopwatch with pause, resume, and lap tracking.
|
|
30
|
-
* @summary This class tracks elapsed time using the highest precision timer available. It supports pausing, resuming, and recording labeled laps for diagnostics and benchmarking.
|
|
31
|
-
* @param {boolean} [autoStart=false] - When `true`, the stopwatch starts immediately upon construction.
|
|
32
|
-
* @class StopWatch
|
|
33
|
-
* @example
|
|
34
|
-
* const sw = new StopWatch(true);
|
|
35
|
-
* // ... work ...
|
|
36
|
-
* const lap = sw.lap("phase 1");
|
|
37
|
-
* sw.pause();
|
|
38
|
-
* console.log(`Elapsed: ${lap.totalMs}ms`);
|
|
39
|
-
* @mermaid
|
|
40
|
-
* sequenceDiagram
|
|
41
|
-
* participant Client
|
|
42
|
-
* participant StopWatch
|
|
43
|
-
* participant Clock as now()
|
|
44
|
-
* Client->>StopWatch: start()
|
|
45
|
-
* StopWatch->>Clock: now()
|
|
46
|
-
* Clock-->>StopWatch: timestamp
|
|
47
|
-
* Client->>StopWatch: lap()
|
|
48
|
-
* StopWatch->>Clock: now()
|
|
49
|
-
* Clock-->>StopWatch: timestamp
|
|
50
|
-
* StopWatch-->>Client: Lap
|
|
51
|
-
* Client->>StopWatch: pause()
|
|
52
|
-
* StopWatch->>Clock: now()
|
|
53
|
-
* Clock-->>StopWatch: timestamp
|
|
54
|
-
*/
|
|
55
|
-
export declare class StopWatch {
|
|
56
|
-
private _startMs;
|
|
57
|
-
private _elapsedMs;
|
|
58
|
-
private _running;
|
|
59
|
-
private _laps;
|
|
60
|
-
private _lastLapTotalMs;
|
|
61
|
-
constructor(autoStart?: boolean);
|
|
62
|
-
/**
|
|
63
|
-
* @description Indicates whether the stopwatch is actively running.
|
|
64
|
-
* @summary This method returns `true` when timing is in progress, and `false` when it is paused or stopped.
|
|
65
|
-
* @return {boolean} The current running state.
|
|
66
|
-
*/
|
|
67
|
-
get running(): boolean;
|
|
68
|
-
/**
|
|
69
|
-
* @description The elapsed time that has been captured by the stopwatch.
|
|
70
|
-
* @summary This method computes the total elapsed time in milliseconds, including the current session if it is running.
|
|
71
|
-
* @return {number} The milliseconds that have elapsed since the stopwatch started.
|
|
72
|
-
*/
|
|
73
|
-
get elapsedMs(): number;
|
|
74
|
-
/**
|
|
75
|
-
* @description Starts timing if the stopwatch is not already running.
|
|
76
|
-
* @summary This method records the current timestamp and transitions the stopwatch into the running state.
|
|
77
|
-
* @return {this} A fluent reference to the stopwatch.
|
|
78
|
-
*/
|
|
79
|
-
start(): this;
|
|
80
|
-
/**
|
|
81
|
-
* @description Pauses timing and accumulates the elapsed milliseconds.
|
|
82
|
-
* @summary This method captures the partial duration, updates the accumulator, and keeps the stopwatch ready to resume later.
|
|
83
|
-
* @return {this} A fluent reference to the stopwatch.
|
|
84
|
-
*/
|
|
85
|
-
pause(): this;
|
|
86
|
-
/**
|
|
87
|
-
* @description Resumes timing after a pause.
|
|
88
|
-
* @summary This method captures a fresh start timestamp, while keeping the previous elapsed time intact.
|
|
89
|
-
* @return {this} A fluent reference to the stopwatch.
|
|
90
|
-
*/
|
|
91
|
-
resume(): this;
|
|
92
|
-
/**
|
|
93
|
-
* @description Stops timing and returns the total elapsed milliseconds.
|
|
94
|
-
* @summary This method invokes {@link StopWatch.pause} to consolidate the elapsed time, and leaves the stopwatch in a non-running state.
|
|
95
|
-
* @return {number} The milliseconds that have accumulated across all runs.
|
|
96
|
-
*/
|
|
97
|
-
stop(): number;
|
|
98
|
-
/**
|
|
99
|
-
* @description Resets the stopwatch state, while optionally continuing to run.
|
|
100
|
-
* @summary This method clears the elapsed time and lap history, and preserves whether the stopwatch should continue ticking.
|
|
101
|
-
* @return {this} A fluent reference to the stopwatch.
|
|
102
|
-
*/
|
|
103
|
-
reset(): this;
|
|
104
|
-
/**
|
|
105
|
-
* @description Records a lap split since the stopwatch started, or since the previous lap.
|
|
106
|
-
* @summary This method stores the lap metadata, updates the cumulative tracking, and returns the newly created {@link Lap}.
|
|
107
|
-
* @param {string} [label] - An optional label that describes the lap.
|
|
108
|
-
* @return {Lap} A lap snapshot that captures incremental and cumulative timings.
|
|
109
|
-
*/
|
|
110
|
-
lap(label?: string): Lap;
|
|
111
|
-
/**
|
|
112
|
-
* @description Retrieves the recorded lap history.
|
|
113
|
-
* @summary This method returns the internal lap array as a read-only view to prevent external mutation.
|
|
114
|
-
* @return {Array<Lap>} The laps that have been captured by the stopwatch.
|
|
115
|
-
*/
|
|
116
|
-
get laps(): readonly Lap[];
|
|
117
|
-
/**
|
|
118
|
-
* @description Formats the elapsed time in a human-readable representation.
|
|
119
|
-
* @summary This method uses {@link formatMs} to produce an `hh:mm:ss.mmm` string for display and logging.
|
|
120
|
-
* @return {string} The elapsed time, formatted for presentation.
|
|
121
|
-
*/
|
|
122
|
-
toString(): string;
|
|
123
|
-
/**
|
|
124
|
-
* @description Serializes the stopwatch state.
|
|
125
|
-
* @summary This method provides a JSON-friendly snapshot that includes the running state, elapsed time, and lap details.
|
|
126
|
-
* @return {{running: boolean, elapsedMs: number, laps: Lap[]}} A serializable stopwatch representation.
|
|
127
|
-
*/
|
|
128
|
-
toJSON(): {
|
|
129
|
-
running: boolean;
|
|
130
|
-
elapsedMs: number;
|
|
131
|
-
laps: Lap[];
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* @description Formats milliseconds into `hh:mm:ss.mmm`.
|
|
136
|
-
* @summary This function breaks the duration into hours, minutes, seconds, and milliseconds, and returns a zero-padded string.
|
|
137
|
-
* @param {number} ms - The milliseconds to format.
|
|
138
|
-
* @return {string} The formatted duration string.
|
|
139
|
-
* @function formatMs
|
|
140
|
-
* @memberOf module:Logging
|
|
141
|
-
* @mermaid
|
|
142
|
-
* sequenceDiagram
|
|
143
|
-
* participant Caller
|
|
144
|
-
* participant Formatter as formatMs
|
|
145
|
-
* Caller->>Formatter: formatMs(ms)
|
|
146
|
-
* Formatter->>Formatter: derive hours/minutes/seconds
|
|
147
|
-
* Formatter->>Formatter: pad segments
|
|
148
|
-
* Formatter-->>Caller: hh:mm:ss.mmm
|
|
149
|
-
*/
|
|
150
|
-
export declare function formatMs(ms: number): string;
|
|
151
|
-
export {};
|
package/lib/time.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"time.js","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":";;;AA+OA,4BASC;AAnOD,SAAS,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,CAAC;IACvD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACpE,OAAO,GAAG,IAAI,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;AAC3F,CAAC"}
|
package/lib/types.d.ts
DELETED
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
import { styles } from "styled-string-builder";
|
|
2
|
-
import { LoggingMode, LogLevel } from "./constants";
|
|
3
|
-
/**
|
|
4
|
-
* @description A string-compatible value that can be accepted by the logging APIs.
|
|
5
|
-
* @summary Represents either a literal string or an object that has a `toString()` method. This allows for the lazy stringification of complex payloads.
|
|
6
|
-
* @typedef {(string|Object)} StringLike
|
|
7
|
-
* @memberOf module:Logging
|
|
8
|
-
*/
|
|
9
|
-
export type StringLike = string | {
|
|
10
|
-
toString: () => string;
|
|
11
|
-
};
|
|
12
|
-
export type LogMeta = Record<string, unknown>;
|
|
13
|
-
/**
|
|
14
|
-
* @description A generic function signature for loosely typed callbacks.
|
|
15
|
-
* @summary This type covers variadic functions where the arguments and return types are not constrained, which enables the logging layer to accept any callable.
|
|
16
|
-
* @typedef {function(...any[]): any} AnyFunction
|
|
17
|
-
* @memberOf module:Logging
|
|
18
|
-
*/
|
|
19
|
-
export type AnyFunction = (...args: any[]) => any;
|
|
20
|
-
/**
|
|
21
|
-
* @description A constructable class type.
|
|
22
|
-
* @summary Describes a constructor that produces instances of type `T`. This allows APIs to accept class references for context-aware logging.
|
|
23
|
-
* @template T
|
|
24
|
-
* @typedef Class
|
|
25
|
-
* @memberOf module:Logging
|
|
26
|
-
*/
|
|
27
|
-
export type Class<T> = {
|
|
28
|
-
new (...args: any[]): T;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* @description A context descriptor that is accepted when requesting a logger instance.
|
|
32
|
-
* @summary Allows the logging system to resolve context names from strings, constructors, or functions.
|
|
33
|
-
* @typedef {(string|Class<any>|AnyFunction)} LoggingContext
|
|
34
|
-
* @memberOf module:Logging
|
|
35
|
-
*/
|
|
36
|
-
export type LoggingContext = string | Class<any> | AnyFunction;
|
|
37
|
-
/**
|
|
38
|
-
* @description An interface for factories that create contextual clones of the receiver.
|
|
39
|
-
* @summary Declares a `for` method that returns another instance of `THIS` using the provided arguments. This enables chained logger customization.
|
|
40
|
-
* @template THIS
|
|
41
|
-
* @template ARGS
|
|
42
|
-
* @interface Impersonatable
|
|
43
|
-
* @memberOf module:Logging
|
|
44
|
-
*/
|
|
45
|
-
export interface Impersonatable<THIS, ARGS extends any[] = any[]> {
|
|
46
|
-
/**
|
|
47
|
-
* @description Produce a copy of the current instance with altered context.
|
|
48
|
-
* @summary Called by logging utilities to derive child objects with supplemental configuration and context metadata.
|
|
49
|
-
* @param {ARGS} args - Arguments forwarded to the impersonation strategy.
|
|
50
|
-
* @return {THIS} Derived instance using the provided arguments.
|
|
51
|
-
*/
|
|
52
|
-
for(...args: ARGS): THIS;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* @description An interface for loggers that support multiple verbosity levels.
|
|
56
|
-
* @summary This interface declares severity-specific log methods, configuration overrides, and factory helpers that are used throughout the logging toolkit.
|
|
57
|
-
* @interface Logger
|
|
58
|
-
* @memberOf module:Logging
|
|
59
|
-
*/
|
|
60
|
-
export interface Logger extends Impersonatable<Logger, [
|
|
61
|
-
(string | {
|
|
62
|
-
new (...args: any[]): any;
|
|
63
|
-
} | AnyFunction | Partial<LoggingConfig>),
|
|
64
|
-
Partial<LoggingConfig>,
|
|
65
|
-
...any[]
|
|
66
|
-
]> {
|
|
67
|
-
/**
|
|
68
|
-
* @description Logs a benchmark message.
|
|
69
|
-
* @summary Emits high-frequency performance metrics at the `benchmark` log level.
|
|
70
|
-
* @param {StringLike} msg - Message or payload to emit.
|
|
71
|
-
* @return {void}
|
|
72
|
-
*/
|
|
73
|
-
benchmark(msg: StringLike, meta?: LogMeta): void;
|
|
74
|
-
/**
|
|
75
|
-
* @description Logs a `way too verbose` or a silly message.
|
|
76
|
-
* @summary Emits playful or extremely verbose details at the `silly` log level.
|
|
77
|
-
* @param {StringLike} msg - Message or payload to emit.
|
|
78
|
-
* @return {void}
|
|
79
|
-
*/
|
|
80
|
-
silly(msg: StringLike, verbosity?: number | LogMeta, meta?: LogMeta): void;
|
|
81
|
-
/**
|
|
82
|
-
* @description Logs developer trace messages.
|
|
83
|
-
* @summary Emits playful or extremely verbose details at the `silly` log level.
|
|
84
|
-
* @param {StringLike} msg - Message or payload to emit.
|
|
85
|
-
* @return {void}
|
|
86
|
-
*/
|
|
87
|
-
trace(msg: StringLike, meta?: LogMeta): void;
|
|
88
|
-
/**
|
|
89
|
-
* @description Logs a verbose message.
|
|
90
|
-
* @summary Writes diagnostic output governed by the configured verbosity threshold.
|
|
91
|
-
* @param {StringLike} msg - Message or payload to emit.
|
|
92
|
-
* @param {number} [verbosity] - Verbosity level required for the message to pass through.
|
|
93
|
-
* @return {void}
|
|
94
|
-
*/
|
|
95
|
-
verbose(msg: StringLike, verbosityOrMeta?: number | LogMeta, meta?: LogMeta): void;
|
|
96
|
-
/**
|
|
97
|
-
* @description Logs an info message.
|
|
98
|
-
* @summary Emits general informational events that describe application progress.
|
|
99
|
-
* @param {StringLike} msg - Message or payload to emit.
|
|
100
|
-
* @return {void}
|
|
101
|
-
*/
|
|
102
|
-
info(msg: StringLike, meta?: LogMeta): void;
|
|
103
|
-
/**
|
|
104
|
-
* @description Logs an error message.
|
|
105
|
-
* @summary Records errors and exceptions, including optional stack traces.
|
|
106
|
-
* @param {StringLike|Error} msg - Message or {@link Error} instance to log.
|
|
107
|
-
* @param {Error} [e] - Optional secondary error or cause.
|
|
108
|
-
* @return {void}
|
|
109
|
-
*/
|
|
110
|
-
error(msg: StringLike | Error, error?: Error | LogMeta, meta?: LogMeta): void;
|
|
111
|
-
/**
|
|
112
|
-
* @description Logs a debug message.
|
|
113
|
-
* @summary Emits fine-grained diagnostic details useful during development and troubleshooting.
|
|
114
|
-
* @param {StringLike} msg - Message or payload to emit.
|
|
115
|
-
* @return {void}
|
|
116
|
-
*/
|
|
117
|
-
debug(msg: StringLike, meta?: LogMeta): void;
|
|
118
|
-
/**
|
|
119
|
-
* @description Logs a debug message.
|
|
120
|
-
* @summary Emits fine-grained diagnostic details useful during development and troubleshooting.
|
|
121
|
-
* @param {StringLike} msg - Message or payload to emit.
|
|
122
|
-
* @return {void}
|
|
123
|
-
*/
|
|
124
|
-
warn(msg: StringLike, meta?: LogMeta): void;
|
|
125
|
-
/**
|
|
126
|
-
* @description Creates a new logger for a specific method or context.
|
|
127
|
-
* @summary Produces a scoped logger that formats entries using the derived context and overrides supplied configuration.
|
|
128
|
-
* @param {any} method - Method name, callback, constructor, or partial configuration used to seed the child logger.
|
|
129
|
-
* @param {Partial<LoggingConfig>} [config] - Optional configuration overrides for the child logger.
|
|
130
|
-
* @param {...any[]} args - Extra arguments forwarded to factory implementations.
|
|
131
|
-
* @return {Logger} Logger instance tailored to the supplied context.
|
|
132
|
-
*/
|
|
133
|
-
for(config: Partial<LoggingConfig>): this;
|
|
134
|
-
for(context: string | {
|
|
135
|
-
new (...args: any[]): any;
|
|
136
|
-
} | AnyFunction | object): this;
|
|
137
|
-
for(method: string | {
|
|
138
|
-
new (...args: any[]): any;
|
|
139
|
-
} | AnyFunction | object | Partial<LoggingConfig>, config?: Partial<LoggingConfig>, ...args: any[]): this;
|
|
140
|
-
/**
|
|
141
|
-
* @description Clears any contextual overrides applied via {@link Logger.for}.
|
|
142
|
-
* @summary Resets temporary context/configuration so ensuing chains start from the base logger while preserving the concrete instance type.
|
|
143
|
-
* @return {this} The same logger instance to continue chaining.
|
|
144
|
-
*/
|
|
145
|
-
clear(): this;
|
|
146
|
-
/**
|
|
147
|
-
* @description Updates the logger configuration.
|
|
148
|
-
* @summary Merges the given options into the logger's existing configuration.
|
|
149
|
-
* @param {Partial<LoggingConfig>} config - Configuration overrides to apply.
|
|
150
|
-
* @return {void}
|
|
151
|
-
*/
|
|
152
|
-
setConfig(config: Partial<LoggingConfig>): void;
|
|
153
|
-
/**
|
|
154
|
-
* @description Immutable base context for the logger instance.
|
|
155
|
-
* @summary Returned as a copy so callers cannot mutate the internal base context while still allowing inspection.
|
|
156
|
-
*/
|
|
157
|
-
readonly root: string[];
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* @description An interface for filters that can mutate or reject log messages.
|
|
161
|
-
* @summary This allows for custom pre-processing of log entries before they are formatted or emitted.
|
|
162
|
-
* @interface LoggingFilter
|
|
163
|
-
* @memberOf module:Logging
|
|
164
|
-
*/
|
|
165
|
-
export interface LoggingFilter {
|
|
166
|
-
/**
|
|
167
|
-
* @description Apply filtering logic to an incoming message.
|
|
168
|
-
* @summary Receives the active configuration, original message, and context stack to produce the final message string.
|
|
169
|
-
* @param {LoggingConfig} config - Active logging configuration.
|
|
170
|
-
* @param {string} message - Message submitted for logging.
|
|
171
|
-
* @param {string[]} context - Context identifiers associated with the message.
|
|
172
|
-
* @return {string} Filtered message string.
|
|
173
|
-
*/
|
|
174
|
-
filter(config: LoggingConfig, message: string, context: string[]): string;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* @description Configuration for the logging system.
|
|
178
|
-
* @summary Defines the log level, verbosity, and other settings for logging.
|
|
179
|
-
* @template TRANSPORT
|
|
180
|
-
* @typedef {object} LoggingConfig
|
|
181
|
-
* @property {string} env - The environment, e.g., "development", "production".
|
|
182
|
-
* @property {LogLevel} level - The logging level.
|
|
183
|
-
* @property {boolean} [logLevel] - Whether to display the log level in the output.
|
|
184
|
-
* @property {number} verbose - The verbosity level.
|
|
185
|
-
* @property {string} contextSeparator - The separator to use between context entries.
|
|
186
|
-
* @property {string} separator - The separator to use between log components.
|
|
187
|
-
* @property {boolean} [style] - Whether to apply styling to the log output.
|
|
188
|
-
* @property {boolean} [timestamp] - Whether to include timestamps in log messages.
|
|
189
|
-
* @property {string} [timestampFormat] - The format for timestamps.
|
|
190
|
-
* @property {boolean} [context] - Whether to include context information in log messages.
|
|
191
|
-
* @property {Theme} [theme] - The theme to use for styling log messages.
|
|
192
|
-
* @property {LoggingMode} format - The output format for log messages.
|
|
193
|
-
* @property {string} pattern - The pattern to use for formatting log messages.
|
|
194
|
-
* @property {(string|number)} [correlationId] - A correlation ID for tracking related log messages.
|
|
195
|
-
* @property {(string[]|LoggingFilter[])} [filters] - An array of filters to apply to log messages.
|
|
196
|
-
* @property {TRANSPORT[]} [transports] - An array of transports to use for logging.
|
|
197
|
-
* @memberOf module:Logging
|
|
198
|
-
*/
|
|
199
|
-
export type LoggingConfig<TRANSPORT = object> = {
|
|
200
|
-
env: "development" | "production" | "test" | "staging" | string;
|
|
201
|
-
level: LogLevel;
|
|
202
|
-
logLevel?: boolean;
|
|
203
|
-
verbose: number;
|
|
204
|
-
contextSeparator: string;
|
|
205
|
-
separator: string;
|
|
206
|
-
style?: boolean;
|
|
207
|
-
timestamp?: boolean;
|
|
208
|
-
timestampFormat?: string;
|
|
209
|
-
context?: boolean;
|
|
210
|
-
meta?: boolean;
|
|
211
|
-
theme?: Theme;
|
|
212
|
-
format: LoggingMode;
|
|
213
|
-
pattern: string;
|
|
214
|
-
correlationId?: string | number;
|
|
215
|
-
filters?: string[] | LoggingFilter[];
|
|
216
|
-
transports?: TRANSPORT[];
|
|
217
|
-
};
|
|
218
|
-
/**
|
|
219
|
-
* @description A factory signature for creating logger instances.
|
|
220
|
-
* @summary This allows consumers to override the logger construction with custom implementations.
|
|
221
|
-
* @template L
|
|
222
|
-
* @typedef {function(string, Partial<LoggingConfig>, ...any[]): L} LoggerFactory
|
|
223
|
-
* @memberOf module:Logging
|
|
224
|
-
*/
|
|
225
|
-
export type LoggerFactory<L extends Logger = Logger> = (object?: string, config?: Partial<LoggingConfig>, ...args: any[]) => L;
|
|
226
|
-
/**
|
|
227
|
-
* @description A theme option that is applied to a specific log element.
|
|
228
|
-
* @summary This interface configures the foreground and background colors, as well as additional style directives for styled console output.
|
|
229
|
-
* @interface ThemeOption
|
|
230
|
-
* @memberOf module:Logging
|
|
231
|
-
*/
|
|
232
|
-
export interface ThemeOption {
|
|
233
|
-
fg?: number | [number] | [number, number, number];
|
|
234
|
-
bg?: number | [number] | [number, number, number];
|
|
235
|
-
style?: number[] | [keyof typeof styles];
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* @description A mapping between log levels and theme overrides.
|
|
239
|
-
* @summary This enables level-specific styling by associating each {@link LogLevel} with a {@link ThemeOption} configuration.
|
|
240
|
-
* @typedef {Partial<Record<LogLevel, ThemeOption>>} ThemeOptionByLogLevel
|
|
241
|
-
* @memberOf module:Logging
|
|
242
|
-
*/
|
|
243
|
-
export type ThemeOptionByLogLevel = Partial<Record<LogLevel, ThemeOption>>;
|
|
244
|
-
/**
|
|
245
|
-
* @description A theme definition that is applied to the console output.
|
|
246
|
-
* @summary This interface specifies the styling for each console log element and supports overrides based on {@link LogLevel} values.
|
|
247
|
-
* @interface Theme
|
|
248
|
-
* @memberOf module:Logging
|
|
249
|
-
*/
|
|
250
|
-
export interface Theme {
|
|
251
|
-
/**
|
|
252
|
-
* @description Styling for application identifiers in the output.
|
|
253
|
-
*/
|
|
254
|
-
app: ThemeOption | ThemeOptionByLogLevel;
|
|
255
|
-
/**
|
|
256
|
-
* @description Styling for separators inserted between log sections.
|
|
257
|
-
*/
|
|
258
|
-
separator: ThemeOption | ThemeOptionByLogLevel;
|
|
259
|
-
/**
|
|
260
|
-
* @description Styling for class names in the output.
|
|
261
|
-
*/
|
|
262
|
-
class: ThemeOption | ThemeOptionByLogLevel;
|
|
263
|
-
/**
|
|
264
|
-
* @description Styling for timestamps in the output.
|
|
265
|
-
*/
|
|
266
|
-
timestamp: ThemeOption | ThemeOptionByLogLevel;
|
|
267
|
-
/**
|
|
268
|
-
* @description Styling for the main message text in the output.
|
|
269
|
-
*/
|
|
270
|
-
message: ThemeOption | ThemeOptionByLogLevel;
|
|
271
|
-
/**
|
|
272
|
-
* @description Styling for method names in the output.
|
|
273
|
-
*/
|
|
274
|
-
method: ThemeOption | ThemeOptionByLogLevel;
|
|
275
|
-
/**
|
|
276
|
-
* @description Styling for identifier elements in the output.
|
|
277
|
-
*/
|
|
278
|
-
id: ThemeOption | ThemeOptionByLogLevel;
|
|
279
|
-
/**
|
|
280
|
-
* @description Styling for stack trace blocks in the output.
|
|
281
|
-
*/
|
|
282
|
-
stack: ThemeOption;
|
|
283
|
-
/**
|
|
284
|
-
* @description Styling overrides keyed by {@link LogLevel}.
|
|
285
|
-
*/
|
|
286
|
-
logLevel: ThemeOptionByLogLevel;
|
|
287
|
-
}
|
package/lib/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|