@decaf-ts/logging 0.15.0 → 0.17.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.
Files changed (98) hide show
  1. package/dist/logging.cjs +1 -1
  2. package/lib/cjs/LoggedClass.cjs +3 -2
  3. package/lib/cjs/LoggedClass.cjs.map +1 -0
  4. package/lib/cjs/constants.cjs +5 -20
  5. package/lib/cjs/constants.cjs.map +1 -0
  6. package/lib/cjs/decorators.cjs +20 -19
  7. package/lib/cjs/decorators.cjs.map +1 -0
  8. package/lib/cjs/environment.cjs +16 -15
  9. package/lib/cjs/environment.cjs.map +1 -0
  10. package/lib/cjs/filters/LogFilter.cjs +3 -2
  11. package/lib/cjs/filters/LogFilter.cjs.map +1 -0
  12. package/lib/cjs/filters/PatternFilter.cjs +15 -9
  13. package/lib/cjs/filters/PatternFilter.cjs.map +1 -0
  14. package/lib/cjs/filters/index.cjs +1 -0
  15. package/lib/cjs/filters/index.cjs.map +1 -0
  16. package/lib/cjs/index.cjs +2 -1
  17. package/lib/cjs/index.cjs.map +1 -0
  18. package/lib/cjs/logParameters.cjs +1 -0
  19. package/lib/cjs/logParameters.cjs.map +1 -0
  20. package/lib/cjs/logging.cjs +41 -38
  21. package/lib/cjs/logging.cjs.map +1 -0
  22. package/lib/cjs/pino/index.cjs +1 -0
  23. package/lib/cjs/pino/index.cjs.map +1 -0
  24. package/lib/cjs/pino/pino.cjs +21 -20
  25. package/lib/cjs/pino/pino.cjs.map +1 -0
  26. package/lib/cjs/text.cjs +3 -2
  27. package/lib/cjs/text.cjs.map +1 -0
  28. package/lib/cjs/time.cjs +1 -0
  29. package/lib/cjs/time.cjs.map +1 -0
  30. package/lib/cjs/types.cjs +1 -0
  31. package/lib/cjs/types.cjs.map +1 -0
  32. package/lib/cjs/utils.cjs +1 -0
  33. package/lib/cjs/utils.cjs.map +1 -0
  34. package/lib/cjs/web.cjs +1 -0
  35. package/lib/cjs/web.cjs.map +1 -0
  36. package/lib/cjs/winston/index.cjs +1 -0
  37. package/lib/cjs/winston/index.cjs.map +1 -0
  38. package/lib/cjs/winston/winston.cjs +4 -3
  39. package/lib/cjs/winston/winston.cjs.map +1 -0
  40. package/lib/esm/index.js +1 -1
  41. package/lib/types/LoggedClass.d.cts +39 -0
  42. package/lib/types/LoggedClass.d.mts +39 -0
  43. package/lib/types/constants.d.cts +104 -0
  44. package/lib/types/constants.d.mts +104 -0
  45. package/lib/types/decorators.d.cts +109 -0
  46. package/lib/types/decorators.d.mts +109 -0
  47. package/lib/types/environment.d.cts +120 -0
  48. package/lib/types/environment.d.mts +120 -0
  49. package/lib/types/filters/LogFilter.d.cts +43 -0
  50. package/lib/types/filters/LogFilter.d.mts +43 -0
  51. package/lib/types/filters/PatternFilter.d.cts +56 -0
  52. package/lib/types/filters/PatternFilter.d.mts +56 -0
  53. package/lib/types/filters/index.d.cts +7 -0
  54. package/lib/types/filters/index.d.mts +7 -0
  55. package/lib/types/index.d.cts +34 -0
  56. package/lib/types/index.d.mts +34 -0
  57. package/lib/types/logParameters.d.cts +56 -0
  58. package/lib/types/logParameters.d.mts +56 -0
  59. package/lib/types/logging.d.cts +373 -0
  60. package/lib/types/logging.d.mts +373 -0
  61. package/lib/types/pino/index.d.cts +7 -0
  62. package/lib/types/pino/index.d.mts +7 -0
  63. package/lib/types/pino/pino.d.cts +29 -0
  64. package/lib/types/pino/pino.d.mts +29 -0
  65. package/lib/types/text.d.cts +118 -0
  66. package/lib/types/text.d.mts +118 -0
  67. package/lib/types/time.d.cts +151 -0
  68. package/lib/types/time.d.mts +151 -0
  69. package/lib/types/types.d.cts +287 -0
  70. package/lib/types/types.d.mts +287 -0
  71. package/lib/types/utils.d.cts +48 -0
  72. package/lib/types/utils.d.mts +48 -0
  73. package/lib/types/web.d.cts +8 -0
  74. package/lib/types/web.d.mts +8 -0
  75. package/lib/types/winston/index.d.cts +7 -0
  76. package/lib/types/winston/index.d.mts +7 -0
  77. package/lib/types/winston/winston.d.cts +47 -0
  78. package/lib/types/winston/winston.d.mts +47 -0
  79. package/package.json +4 -4
  80. package/lib/cjs/LoggedClass.js.map +0 -1
  81. package/lib/cjs/constants.js.map +0 -1
  82. package/lib/cjs/decorators.js.map +0 -1
  83. package/lib/cjs/environment.js.map +0 -1
  84. package/lib/cjs/filters/LogFilter.js.map +0 -1
  85. package/lib/cjs/filters/PatternFilter.js.map +0 -1
  86. package/lib/cjs/filters/index.js.map +0 -1
  87. package/lib/cjs/index.js.map +0 -1
  88. package/lib/cjs/logParameters.js.map +0 -1
  89. package/lib/cjs/logging.js.map +0 -1
  90. package/lib/cjs/pino/index.js.map +0 -1
  91. package/lib/cjs/pino/pino.js.map +0 -1
  92. package/lib/cjs/text.js.map +0 -1
  93. package/lib/cjs/time.js.map +0 -1
  94. package/lib/cjs/types.js.map +0 -1
  95. package/lib/cjs/utils.js.map +0 -1
  96. package/lib/cjs/web.js.map +0 -1
  97. package/lib/cjs/winston/index.js.map +0 -1
  98. package/lib/cjs/winston/winston.js.map +0 -1
@@ -0,0 +1,118 @@
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;
@@ -0,0 +1,151 @@
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 {};
@@ -0,0 +1,151 @@
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 {};