traceperf 0.2.0 → 1.3.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/README.md +612 -209
- package/dist/__tests__/helpers/console.d.ts +9 -0
- package/dist/__tests__/helpers/console.js +25 -0
- package/dist/__tests__/helpers/console.js.map +1 -0
- package/dist/auto.d.ts +30 -0
- package/dist/auto.js +91 -0
- package/dist/auto.js.map +1 -0
- package/dist/browser.d.ts +52 -144
- package/dist/browser.js +112 -439
- package/dist/browser.js.map +1 -1
- package/dist/cli.d.ts +68 -0
- package/dist/cli.js +528 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/allocations.d.ts +38 -0
- package/dist/core/allocations.js +85 -0
- package/dist/core/allocations.js.map +1 -0
- package/dist/core/cpu-profile.d.ts +84 -0
- package/dist/core/cpu-profile.js +181 -0
- package/dist/core/cpu-profile.js.map +1 -0
- package/dist/core/env.d.ts +10 -0
- package/dist/core/env.js +40 -0
- package/dist/core/env.js.map +1 -0
- package/dist/core/event-loop.d.ts +30 -0
- package/dist/core/event-loop.js +43 -0
- package/dist/core/event-loop.js.map +1 -0
- package/dist/core/explain.d.ts +48 -0
- package/dist/core/explain.js +236 -0
- package/dist/core/explain.js.map +1 -0
- package/dist/core/exporters.d.ts +111 -0
- package/dist/core/exporters.js +236 -0
- package/dist/core/exporters.js.map +1 -0
- package/dist/core/index.d.ts +9 -3
- package/dist/core/index.js +9 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/optimized-performance-monitor.d.ts +180 -26
- package/dist/core/optimized-performance-monitor.js +687 -175
- package/dist/core/optimized-performance-monitor.js.map +1 -1
- package/dist/core/prometheus.d.ts +36 -0
- package/dist/core/prometheus.js +93 -0
- package/dist/core/prometheus.js.map +1 -0
- package/dist/core/records.d.ts +97 -0
- package/dist/core/records.js +87 -0
- package/dist/core/records.js.map +1 -0
- package/dist/core/stats.d.ts +45 -0
- package/dist/core/stats.js +136 -0
- package/dist/core/stats.js.map +1 -0
- package/dist/core/timeline.d.ts +28 -0
- package/dist/core/timeline.js +65 -0
- package/dist/core/timeline.js.map +1 -0
- package/dist/drivers.d.ts +51 -0
- package/dist/drivers.js +205 -0
- package/dist/drivers.js.map +1 -0
- package/dist/esm/auto.d.ts +30 -0
- package/dist/esm/auto.js +87 -0
- package/dist/esm/auto.js.map +1 -0
- package/dist/esm/browser.d.ts +52 -144
- package/dist/esm/browser.js +101 -445
- package/dist/esm/browser.js.map +1 -1
- package/dist/esm/cli.d.ts +68 -0
- package/dist/esm/cli.js +520 -0
- package/dist/esm/cli.js.map +1 -0
- package/dist/esm/core/allocations.d.ts +38 -0
- package/dist/esm/core/allocations.js +82 -0
- package/dist/esm/core/allocations.js.map +1 -0
- package/dist/esm/core/cpu-profile.d.ts +84 -0
- package/dist/esm/core/cpu-profile.js +176 -0
- package/dist/esm/core/cpu-profile.js.map +1 -0
- package/dist/esm/core/env.d.ts +10 -0
- package/dist/esm/core/env.js +35 -0
- package/dist/esm/core/env.js.map +1 -0
- package/dist/esm/core/event-loop.d.ts +30 -0
- package/dist/esm/core/event-loop.js +40 -0
- package/dist/esm/core/event-loop.js.map +1 -0
- package/dist/esm/core/explain.d.ts +48 -0
- package/dist/esm/core/explain.js +232 -0
- package/dist/esm/core/explain.js.map +1 -0
- package/dist/esm/core/exporters.d.ts +111 -0
- package/dist/esm/core/exporters.js +229 -0
- package/dist/esm/core/exporters.js.map +1 -0
- package/dist/esm/core/index.d.ts +10 -4
- package/dist/esm/core/index.js +10 -4
- package/dist/esm/core/index.js.map +1 -1
- package/dist/esm/core/optimized-performance-monitor.d.ts +180 -26
- package/dist/esm/core/optimized-performance-monitor.js +685 -173
- package/dist/esm/core/optimized-performance-monitor.js.map +1 -1
- package/dist/esm/core/prometheus.d.ts +36 -0
- package/dist/esm/core/prometheus.js +89 -0
- package/dist/esm/core/prometheus.js.map +1 -0
- package/dist/esm/core/records.d.ts +97 -0
- package/dist/esm/core/records.js +82 -0
- package/dist/esm/core/records.js.map +1 -0
- package/dist/esm/core/stats.d.ts +45 -0
- package/dist/esm/core/stats.js +131 -0
- package/dist/esm/core/stats.js.map +1 -0
- package/dist/esm/core/timeline.d.ts +28 -0
- package/dist/esm/core/timeline.js +62 -0
- package/dist/esm/core/timeline.js.map +1 -0
- package/dist/esm/drivers.d.ts +51 -0
- package/dist/esm/drivers.js +197 -0
- package/dist/esm/drivers.js.map +1 -0
- package/dist/esm/index.d.ts +13 -5
- package/dist/esm/index.js +21 -17
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/instrument.d.ts +88 -0
- package/dist/esm/instrument.js +274 -0
- package/dist/esm/instrument.js.map +1 -0
- package/dist/esm/integrations.d.ts +70 -0
- package/dist/esm/integrations.js +197 -0
- package/dist/esm/integrations.js.map +1 -0
- package/dist/esm/node-builtins.d.ts +1 -0
- package/dist/esm/node-builtins.js +32 -0
- package/dist/esm/node-builtins.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/register.d.ts +20 -0
- package/dist/esm/register.js +98 -0
- package/dist/esm/register.js.map +1 -0
- package/dist/esm/report-html.d.ts +11 -0
- package/dist/esm/report-html.js +106 -0
- package/dist/esm/report-html.js.map +1 -0
- package/dist/esm/types/index.d.ts +4 -80
- package/dist/esm/types/index.js +1 -2
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/options.d.ts +72 -0
- package/dist/esm/types/options.js +2 -0
- package/dist/esm/types/options.js.map +1 -0
- package/dist/esm/watch.d.ts +17 -0
- package/dist/esm/watch.js +87 -0
- package/dist/esm/watch.js.map +1 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +26 -29
- package/dist/index.js.map +1 -1
- package/dist/instrument.d.ts +88 -0
- package/dist/instrument.js +282 -0
- package/dist/instrument.js.map +1 -0
- package/dist/integrations.d.ts +70 -0
- package/dist/integrations.js +205 -0
- package/dist/integrations.js.map +1 -0
- package/dist/node-builtins.d.ts +1 -0
- package/dist/node-builtins.js +67 -0
- package/dist/node-builtins.js.map +1 -0
- package/dist/register.d.ts +20 -0
- package/dist/register.js +103 -0
- package/dist/register.js.map +1 -0
- package/dist/report-html.d.ts +11 -0
- package/dist/report-html.js +109 -0
- package/dist/report-html.js.map +1 -0
- package/dist/traceperf.browser.js +1910 -0
- package/dist/traceperf.browser.min.js +6 -0
- package/dist/types/index.d.ts +4 -80
- package/dist/types/index.js +1 -2
- package/dist/types/index.js.map +1 -1
- package/dist/types/options.d.ts +72 -0
- package/dist/types/{config.js → options.js} +1 -1
- package/dist/types/options.js.map +1 -0
- package/dist/watch.d.ts +17 -0
- package/dist/watch.js +90 -0
- package/dist/watch.js.map +1 -0
- package/package.json +99 -19
- package/dist/core/config.d.ts +0 -77
- package/dist/core/config.js +0 -116
- package/dist/core/config.js.map +0 -1
- package/dist/core/constants.d.ts +0 -78
- package/dist/core/constants.js +0 -109
- package/dist/core/constants.js.map +0 -1
- package/dist/core/logger.d.ts +0 -97
- package/dist/core/logger.js +0 -186
- package/dist/core/logger.js.map +0 -1
- package/dist/esm/core/config.d.ts +0 -77
- package/dist/esm/core/config.js +0 -112
- package/dist/esm/core/config.js.map +0 -1
- package/dist/esm/core/constants.d.ts +0 -78
- package/dist/esm/core/constants.js +0 -106
- package/dist/esm/core/constants.js.map +0 -1
- package/dist/esm/core/logger.d.ts +0 -97
- package/dist/esm/core/logger.js +0 -182
- package/dist/esm/core/logger.js.map +0 -1
- package/dist/esm/formatters/ascii.d.ts +0 -52
- package/dist/esm/formatters/ascii.js +0 -100
- package/dist/esm/formatters/ascii.js.map +0 -1
- package/dist/esm/formatters/cli.d.ts +0 -50
- package/dist/esm/formatters/cli.js +0 -96
- package/dist/esm/formatters/cli.js.map +0 -1
- package/dist/esm/formatters/index.d.ts +0 -3
- package/dist/esm/formatters/index.js +0 -4
- package/dist/esm/formatters/index.js.map +0 -1
- package/dist/esm/formatters/json.d.ts +0 -45
- package/dist/esm/formatters/json.js +0 -85
- package/dist/esm/formatters/json.js.map +0 -1
- package/dist/esm/trackers/execution.d.ts +0 -101
- package/dist/esm/trackers/execution.js +0 -226
- package/dist/esm/trackers/execution.js.map +0 -1
- package/dist/esm/trackers/index.d.ts +0 -2
- package/dist/esm/trackers/index.js +0 -3
- package/dist/esm/trackers/index.js.map +0 -1
- package/dist/esm/trackers/performance.d.ts +0 -68
- package/dist/esm/trackers/performance.js +0 -112
- package/dist/esm/trackers/performance.js.map +0 -1
- package/dist/esm/types/config.d.ts +0 -142
- package/dist/esm/types/config.js +0 -2
- package/dist/esm/types/config.js.map +0 -1
- package/dist/esm/types/logger.d.ts +0 -147
- package/dist/esm/types/logger.js +0 -2
- package/dist/esm/types/logger.js.map +0 -1
- package/dist/esm/utils/colors.d.ts +0 -87
- package/dist/esm/utils/colors.js +0 -146
- package/dist/esm/utils/colors.js.map +0 -1
- package/dist/esm/utils/index.d.ts +0 -3
- package/dist/esm/utils/index.js +0 -4
- package/dist/esm/utils/index.js.map +0 -1
- package/dist/esm/utils/proxy-tracker.d.ts +0 -68
- package/dist/esm/utils/proxy-tracker.js +0 -127
- package/dist/esm/utils/proxy-tracker.js.map +0 -1
- package/dist/esm/utils/stack.d.ts +0 -63
- package/dist/esm/utils/stack.js +0 -110
- package/dist/esm/utils/stack.js.map +0 -1
- package/dist/esm/utils/string.d.ts +0 -29
- package/dist/esm/utils/string.js +0 -45
- package/dist/esm/utils/string.js.map +0 -1
- package/dist/esm/utils/timing.d.ts +0 -65
- package/dist/esm/utils/timing.js +0 -99
- package/dist/esm/utils/timing.js.map +0 -1
- package/dist/formatters/ascii.d.ts +0 -52
- package/dist/formatters/ascii.js +0 -104
- package/dist/formatters/ascii.js.map +0 -1
- package/dist/formatters/cli.d.ts +0 -50
- package/dist/formatters/cli.js +0 -100
- package/dist/formatters/cli.js.map +0 -1
- package/dist/formatters/index.d.ts +0 -3
- package/dist/formatters/index.js +0 -20
- package/dist/formatters/index.js.map +0 -1
- package/dist/formatters/json.d.ts +0 -45
- package/dist/formatters/json.js +0 -89
- package/dist/formatters/json.js.map +0 -1
- package/dist/trackers/execution.d.ts +0 -101
- package/dist/trackers/execution.js +0 -230
- package/dist/trackers/execution.js.map +0 -1
- package/dist/trackers/index.d.ts +0 -2
- package/dist/trackers/index.js +0 -19
- package/dist/trackers/index.js.map +0 -1
- package/dist/trackers/performance.d.ts +0 -68
- package/dist/trackers/performance.js +0 -116
- package/dist/trackers/performance.js.map +0 -1
- package/dist/types/config.d.ts +0 -142
- package/dist/types/config.js.map +0 -1
- package/dist/types/logger.d.ts +0 -147
- package/dist/types/logger.js +0 -3
- package/dist/types/logger.js.map +0 -1
- package/dist/types.d.ts +0 -65
- package/dist/types.js +0 -6
- package/dist/types.js.map +0 -1
- package/dist/utils/colors.d.ts +0 -87
- package/dist/utils/colors.js +0 -160
- package/dist/utils/colors.js.map +0 -1
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.js +0 -20
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/proxy-tracker.d.ts +0 -68
- package/dist/utils/proxy-tracker.js +0 -131
- package/dist/utils/proxy-tracker.js.map +0 -1
- package/dist/utils/stack.d.ts +0 -63
- package/dist/utils/stack.js +0 -116
- package/dist/utils/stack.js.map +0 -1
- package/dist/utils/string.d.ts +0 -29
- package/dist/utils/string.js +0 -50
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/timing.d.ts +0 -65
- package/dist/utils/timing.js +0 -106
- package/dist/utils/timing.js.map +0 -1
package/dist/core/config.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConfigManager = void 0;
|
|
4
|
-
const constants_1 = require("./constants");
|
|
5
|
-
/**
|
|
6
|
-
* Configuration manager for the logger
|
|
7
|
-
* Handles merging user config with defaults and provides utility methods
|
|
8
|
-
*/
|
|
9
|
-
class ConfigManager {
|
|
10
|
-
/**
|
|
11
|
-
* Create a new ConfigManager instance
|
|
12
|
-
*
|
|
13
|
-
* @param userConfig - User-provided configuration options
|
|
14
|
-
*/
|
|
15
|
-
constructor(userConfig = {}) {
|
|
16
|
-
this._config = { ...constants_1.DEFAULT_CONFIG, ...userConfig };
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Get the current configuration
|
|
20
|
-
*
|
|
21
|
-
* @returns The current configuration
|
|
22
|
-
*/
|
|
23
|
-
getConfig() {
|
|
24
|
-
return { ...this._config };
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Update the configuration
|
|
28
|
-
*
|
|
29
|
-
* @param newConfig - New configuration options to merge
|
|
30
|
-
*/
|
|
31
|
-
updateConfig(newConfig) {
|
|
32
|
-
this._config = { ...this._config, ...newConfig };
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Get the current mode
|
|
36
|
-
*
|
|
37
|
-
* @returns The current mode
|
|
38
|
-
*/
|
|
39
|
-
getMode() {
|
|
40
|
-
var _a;
|
|
41
|
-
return (_a = this._config.mode) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_CONFIG.mode;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Set the current mode
|
|
45
|
-
*
|
|
46
|
-
* @param mode - The mode to set
|
|
47
|
-
*/
|
|
48
|
-
setMode(mode) {
|
|
49
|
-
this._config.mode = mode;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Check if a log level should be displayed based on the current mode and level
|
|
53
|
-
*
|
|
54
|
-
* @param level - The log level to check
|
|
55
|
-
* @returns Whether the log level should be displayed
|
|
56
|
-
*/
|
|
57
|
-
shouldLog(level) {
|
|
58
|
-
var _a;
|
|
59
|
-
const currentMode = this.getMode();
|
|
60
|
-
const configLevel = (_a = this._config.level) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_CONFIG.level;
|
|
61
|
-
// Get the minimum level for the current mode
|
|
62
|
-
const modeMinLevel = constants_1.MODE_MIN_LEVELS[currentMode] || 'info';
|
|
63
|
-
// Use the higher of the mode's minimum level and the configured level
|
|
64
|
-
const effectiveMinLevel = this.getHigherPriorityLevel(modeMinLevel, configLevel);
|
|
65
|
-
// Check if the provided level meets the minimum threshold
|
|
66
|
-
return constants_1.LOG_LEVEL_PRIORITY[level] >= constants_1.LOG_LEVEL_PRIORITY[effectiveMinLevel];
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Get the higher priority level between two log levels
|
|
70
|
-
*
|
|
71
|
-
* @param levelA - First log level
|
|
72
|
-
* @param levelB - Second log level
|
|
73
|
-
* @returns The higher priority level
|
|
74
|
-
*/
|
|
75
|
-
getHigherPriorityLevel(levelA, levelB) {
|
|
76
|
-
return constants_1.LOG_LEVEL_PRIORITY[levelA] >= constants_1.LOG_LEVEL_PRIORITY[levelB] ? levelA : levelB;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Get the performance threshold
|
|
80
|
-
*
|
|
81
|
-
* @returns The performance threshold in milliseconds
|
|
82
|
-
*/
|
|
83
|
-
getPerformanceThreshold() {
|
|
84
|
-
var _a;
|
|
85
|
-
return (_a = this._config.performanceThreshold) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_CONFIG.performanceThreshold;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Get the indentation size
|
|
89
|
-
*
|
|
90
|
-
* @returns The number of spaces for each indentation level
|
|
91
|
-
*/
|
|
92
|
-
getIndentSize() {
|
|
93
|
-
var _a;
|
|
94
|
-
return (_a = this._config.indentSize) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_CONFIG.indentSize;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Check if colorization is enabled
|
|
98
|
-
*
|
|
99
|
-
* @returns Whether colorization is enabled
|
|
100
|
-
*/
|
|
101
|
-
isColorEnabled() {
|
|
102
|
-
var _a;
|
|
103
|
-
return (_a = this._config.colorize) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_CONFIG.colorize;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Check if timestamps are enabled
|
|
107
|
-
*
|
|
108
|
-
* @returns Whether timestamps are enabled
|
|
109
|
-
*/
|
|
110
|
-
isTimestampEnabled() {
|
|
111
|
-
var _a;
|
|
112
|
-
return (_a = this._config.timestamp) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_CONFIG.timestamp;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
exports.ConfigManager = ConfigManager;
|
|
116
|
-
//# sourceMappingURL=config.js.map
|
package/dist/core/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":";;;AACA,2CAAkF;AAElF;;;GAGG;AACH,MAAa,aAAa;IAGxB;;;;OAIG;IACH,YAAY,aAAqC,EAAE;QACjD,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,0BAAc,EAAE,GAAG,UAAU,EAAE,CAAC;IACtD,CAAC;IAED;;;;OAIG;IACI,SAAS;QACd,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,SAAiC;QACnD,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,SAAS,EAAE,CAAC;IACnD,CAAC;IAED;;;;OAIG;IACI,OAAO;;QACZ,OAAO,MAAA,IAAI,CAAC,OAAO,CAAC,IAAI,mCAAI,0BAAc,CAAC,IAAe,CAAC;IAC7D,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,IAAa;QAC1B,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IACI,SAAS,CAAC,KAAe;;QAC9B,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QACnC,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,KAAK,mCAAI,0BAAc,CAAC,KAAiB,CAAC;QAE3E,6CAA6C;QAC7C,MAAM,YAAY,GAAG,2BAAe,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC;QAE5D,sEAAsE;QACtE,MAAM,iBAAiB,GAAG,IAAI,CAAC,sBAAsB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;QAEjF,0DAA0D;QAC1D,OAAO,8BAAkB,CAAC,KAAK,CAAC,IAAI,8BAAkB,CAAC,iBAAiB,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;;OAMG;IACK,sBAAsB,CAAC,MAAgB,EAAE,MAAgB;QAC/D,OAAO,8BAAkB,CAAC,MAAM,CAAC,IAAI,8BAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IACpF,CAAC;IAED;;;;OAIG;IACI,uBAAuB;;QAC5B,OAAO,MAAA,IAAI,CAAC,OAAO,CAAC,oBAAoB,mCAAI,0BAAc,CAAC,oBAA8B,CAAC;IAC5F,CAAC;IAED;;;;OAIG;IACI,aAAa;;QAClB,OAAO,MAAA,IAAI,CAAC,OAAO,CAAC,UAAU,mCAAI,0BAAc,CAAC,UAAoB,CAAC;IACxE,CAAC;IAED;;;;OAIG;IACI,cAAc;;QACnB,OAAO,MAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,mCAAI,0BAAc,CAAC,QAAmB,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACI,kBAAkB;;QACvB,OAAO,MAAA,IAAI,CAAC,OAAO,CAAC,SAAS,mCAAI,0BAAc,CAAC,SAAoB,CAAC;IACvE,CAAC;CACF;AAlHD,sCAkHC"}
|
package/dist/core/constants.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { LogLevel, LogMode, ILoggerConfig } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Default configuration for the logger
|
|
4
|
-
*/
|
|
5
|
-
export declare const DEFAULT_CONFIG: ILoggerConfig;
|
|
6
|
-
/**
|
|
7
|
-
* Log level priorities (higher number = higher priority)
|
|
8
|
-
*/
|
|
9
|
-
export declare const LOG_LEVEL_PRIORITY: Record<LogLevel, number>;
|
|
10
|
-
/**
|
|
11
|
-
* Minimum log level for each mode
|
|
12
|
-
*/
|
|
13
|
-
export declare const MODE_MIN_LEVELS: Record<LogMode, LogLevel>;
|
|
14
|
-
/**
|
|
15
|
-
* ANSI color codes for terminal output
|
|
16
|
-
*/
|
|
17
|
-
export declare const COLORS: {
|
|
18
|
-
reset: string;
|
|
19
|
-
bright: string;
|
|
20
|
-
dim: string;
|
|
21
|
-
underscore: string;
|
|
22
|
-
fg: {
|
|
23
|
-
black: string;
|
|
24
|
-
red: string;
|
|
25
|
-
green: string;
|
|
26
|
-
yellow: string;
|
|
27
|
-
blue: string;
|
|
28
|
-
magenta: string;
|
|
29
|
-
cyan: string;
|
|
30
|
-
white: string;
|
|
31
|
-
gray: string;
|
|
32
|
-
};
|
|
33
|
-
bg: {
|
|
34
|
-
black: string;
|
|
35
|
-
red: string;
|
|
36
|
-
green: string;
|
|
37
|
-
yellow: string;
|
|
38
|
-
blue: string;
|
|
39
|
-
magenta: string;
|
|
40
|
-
cyan: string;
|
|
41
|
-
white: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Log level colors
|
|
46
|
-
*/
|
|
47
|
-
export declare const LEVEL_COLORS: Record<LogLevel, string>;
|
|
48
|
-
/**
|
|
49
|
-
* Log level icons
|
|
50
|
-
*/
|
|
51
|
-
export declare const LEVEL_ICONS: Record<LogLevel, string>;
|
|
52
|
-
/**
|
|
53
|
-
* Box drawing characters for ASCII flow charts
|
|
54
|
-
*/
|
|
55
|
-
export declare const BOX_CHARS: {
|
|
56
|
-
topLeft: string;
|
|
57
|
-
topRight: string;
|
|
58
|
-
bottomLeft: string;
|
|
59
|
-
bottomRight: string;
|
|
60
|
-
horizontal: string;
|
|
61
|
-
vertical: string;
|
|
62
|
-
verticalRight: string;
|
|
63
|
-
verticalLeft: string;
|
|
64
|
-
horizontalDown: string;
|
|
65
|
-
horizontalUp: string;
|
|
66
|
-
cross: string;
|
|
67
|
-
downArrow: string;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Performance icons
|
|
71
|
-
*/
|
|
72
|
-
export declare const PERFORMANCE_ICONS: {
|
|
73
|
-
timer: string;
|
|
74
|
-
slow: string;
|
|
75
|
-
memory: string;
|
|
76
|
-
bottleneck: string;
|
|
77
|
-
fix: string;
|
|
78
|
-
};
|
package/dist/core/constants.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PERFORMANCE_ICONS = exports.BOX_CHARS = exports.LEVEL_ICONS = exports.LEVEL_COLORS = exports.COLORS = exports.MODE_MIN_LEVELS = exports.LOG_LEVEL_PRIORITY = exports.DEFAULT_CONFIG = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Default configuration for the logger
|
|
6
|
-
*/
|
|
7
|
-
exports.DEFAULT_CONFIG = {
|
|
8
|
-
mode: 'dev',
|
|
9
|
-
level: 'debug',
|
|
10
|
-
colorize: true,
|
|
11
|
-
timestamp: true,
|
|
12
|
-
performanceThreshold: 100, // ms
|
|
13
|
-
indentSize: 2,
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Log level priorities (higher number = higher priority)
|
|
17
|
-
*/
|
|
18
|
-
exports.LOG_LEVEL_PRIORITY = {
|
|
19
|
-
debug: 0,
|
|
20
|
-
info: 1,
|
|
21
|
-
warn: 2,
|
|
22
|
-
error: 3,
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Minimum log level for each mode
|
|
26
|
-
*/
|
|
27
|
-
exports.MODE_MIN_LEVELS = {
|
|
28
|
-
dev: 'debug', // In dev mode, show all logs
|
|
29
|
-
staging: 'warn', // In staging, show only warnings and errors
|
|
30
|
-
prod: 'error', // In prod, show only errors
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* ANSI color codes for terminal output
|
|
34
|
-
*/
|
|
35
|
-
exports.COLORS = {
|
|
36
|
-
reset: '\x1b[0m',
|
|
37
|
-
bright: '\x1b[1m',
|
|
38
|
-
dim: '\x1b[2m',
|
|
39
|
-
underscore: '\x1b[4m',
|
|
40
|
-
// Foreground colors
|
|
41
|
-
fg: {
|
|
42
|
-
black: '\x1b[30m',
|
|
43
|
-
red: '\x1b[31m',
|
|
44
|
-
green: '\x1b[32m',
|
|
45
|
-
yellow: '\x1b[33m',
|
|
46
|
-
blue: '\x1b[34m',
|
|
47
|
-
magenta: '\x1b[35m',
|
|
48
|
-
cyan: '\x1b[36m',
|
|
49
|
-
white: '\x1b[37m',
|
|
50
|
-
gray: '\x1b[90m',
|
|
51
|
-
},
|
|
52
|
-
// Background colors
|
|
53
|
-
bg: {
|
|
54
|
-
black: '\x1b[40m',
|
|
55
|
-
red: '\x1b[41m',
|
|
56
|
-
green: '\x1b[42m',
|
|
57
|
-
yellow: '\x1b[43m',
|
|
58
|
-
blue: '\x1b[44m',
|
|
59
|
-
magenta: '\x1b[45m',
|
|
60
|
-
cyan: '\x1b[46m',
|
|
61
|
-
white: '\x1b[47m',
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Log level colors
|
|
66
|
-
*/
|
|
67
|
-
exports.LEVEL_COLORS = {
|
|
68
|
-
debug: exports.COLORS.fg.gray,
|
|
69
|
-
info: exports.COLORS.fg.blue,
|
|
70
|
-
warn: exports.COLORS.fg.yellow,
|
|
71
|
-
error: exports.COLORS.fg.red,
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* Log level icons
|
|
75
|
-
*/
|
|
76
|
-
exports.LEVEL_ICONS = {
|
|
77
|
-
debug: '🔍',
|
|
78
|
-
info: 'ℹ️',
|
|
79
|
-
warn: '⚠️',
|
|
80
|
-
error: '❌',
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Box drawing characters for ASCII flow charts
|
|
84
|
-
*/
|
|
85
|
-
exports.BOX_CHARS = {
|
|
86
|
-
topLeft: '┌',
|
|
87
|
-
topRight: '┐',
|
|
88
|
-
bottomLeft: '└',
|
|
89
|
-
bottomRight: '┘',
|
|
90
|
-
horizontal: '─',
|
|
91
|
-
vertical: '│',
|
|
92
|
-
verticalRight: '├',
|
|
93
|
-
verticalLeft: '┤',
|
|
94
|
-
horizontalDown: '┬',
|
|
95
|
-
horizontalUp: '┴',
|
|
96
|
-
cross: '┼',
|
|
97
|
-
downArrow: '▼',
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Performance icons
|
|
101
|
-
*/
|
|
102
|
-
exports.PERFORMANCE_ICONS = {
|
|
103
|
-
timer: '⏱',
|
|
104
|
-
slow: '⚠️',
|
|
105
|
-
memory: '📊',
|
|
106
|
-
bottleneck: '🛑',
|
|
107
|
-
fix: '🛠',
|
|
108
|
-
};
|
|
109
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,cAAc,GAAkB;IAC3C,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,IAAI;IACf,oBAAoB,EAAE,GAAG,EAAE,KAAK;IAChC,UAAU,EAAE,CAAC;CACd,CAAC;AAEF;;GAEG;AACU,QAAA,kBAAkB,GAA6B;IAC1D,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;CACT,CAAC;AAEF;;GAEG;AACU,QAAA,eAAe,GAA8B;IACxD,GAAG,EAAE,OAAO,EAAK,6BAA6B;IAC9C,OAAO,EAAE,MAAM,EAAG,4CAA4C;IAC9D,IAAI,EAAE,OAAO,EAAK,4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,YAAY,EAAE,GAAG;IACjB,cAAc,EAAE,GAAG;IACnB,YAAY,EAAE,GAAG;IACjB,KAAK,EAAE,GAAG;IACV,SAAS,EAAE,GAAG;CACf,CAAC;AAEF;;GAEG;AACU,QAAA,iBAAiB,GAAG;IAC/B,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;IACZ,UAAU,EAAE,IAAI;IAChB,GAAG,EAAE,IAAI;CACV,CAAC"}
|
package/dist/core/logger.d.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { ILogger, ILoggerConfig, LogMode, ITrackOptions } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Main logger class that implements the ILogger interface
|
|
4
|
-
*/
|
|
5
|
-
export declare class Logger implements ILogger {
|
|
6
|
-
private _config;
|
|
7
|
-
private _executionTracker;
|
|
8
|
-
private _performanceMonitor;
|
|
9
|
-
private _indentLevel;
|
|
10
|
-
private _transports;
|
|
11
|
-
private _formatters;
|
|
12
|
-
/**
|
|
13
|
-
* Create a new Logger instance
|
|
14
|
-
*
|
|
15
|
-
* @param config - Logger configuration
|
|
16
|
-
*/
|
|
17
|
-
constructor(config?: Partial<ILoggerConfig>);
|
|
18
|
-
/**
|
|
19
|
-
* Log an informational message
|
|
20
|
-
*
|
|
21
|
-
* @param message - The message to log
|
|
22
|
-
* @param args - Additional arguments to include in the log
|
|
23
|
-
*/
|
|
24
|
-
info(message: string | object, ...args: any[]): void;
|
|
25
|
-
/**
|
|
26
|
-
* Log a warning message
|
|
27
|
-
*
|
|
28
|
-
* @param message - The message to log
|
|
29
|
-
* @param args - Additional arguments to include in the log
|
|
30
|
-
*/
|
|
31
|
-
warn(message: string | object, ...args: any[]): void;
|
|
32
|
-
/**
|
|
33
|
-
* Log an error message
|
|
34
|
-
*
|
|
35
|
-
* @param message - The message to log
|
|
36
|
-
* @param args - Additional arguments to include in the log
|
|
37
|
-
*/
|
|
38
|
-
error(message: string | object, ...args: any[]): void;
|
|
39
|
-
/**
|
|
40
|
-
* Log a debug message
|
|
41
|
-
*
|
|
42
|
-
* @param message - The message to log
|
|
43
|
-
* @param args - Additional arguments to include in the log
|
|
44
|
-
*/
|
|
45
|
-
debug(message: string | object, ...args: any[]): void;
|
|
46
|
-
/**
|
|
47
|
-
* Start a new log group with the given label
|
|
48
|
-
*
|
|
49
|
-
* @param label - The label for the group
|
|
50
|
-
*/
|
|
51
|
-
group(label: string): void;
|
|
52
|
-
/**
|
|
53
|
-
* End the current log group
|
|
54
|
-
*/
|
|
55
|
-
groupEnd(): void;
|
|
56
|
-
/**
|
|
57
|
-
* Set the operational mode for the logger
|
|
58
|
-
*
|
|
59
|
-
* @param mode - The mode to set
|
|
60
|
-
*/
|
|
61
|
-
setMode(mode: LogMode): void;
|
|
62
|
-
/**
|
|
63
|
-
* Get the current operational mode
|
|
64
|
-
*
|
|
65
|
-
* @returns The current mode
|
|
66
|
-
*/
|
|
67
|
-
getMode(): LogMode;
|
|
68
|
-
/**
|
|
69
|
-
* Track the execution of a function
|
|
70
|
-
*
|
|
71
|
-
* @param fn - The function to track
|
|
72
|
-
* @param options - Options for tracking
|
|
73
|
-
* @returns The return value of the tracked function
|
|
74
|
-
*/
|
|
75
|
-
track<T>(fn: () => T, options?: ITrackOptions): T;
|
|
76
|
-
/**
|
|
77
|
-
* Create a trackable version of a function
|
|
78
|
-
*
|
|
79
|
-
* This is a helper method to create a tracked version of a function
|
|
80
|
-
* that can be used for nested function tracking.
|
|
81
|
-
*
|
|
82
|
-
* @param fn - The function to make trackable
|
|
83
|
-
* @param options - Options for tracking
|
|
84
|
-
* @returns A tracked version of the function
|
|
85
|
-
*/
|
|
86
|
-
createTrackable<T extends (...args: any[]) => any>(fn: T, options?: Omit<ITrackOptions, 'label'> & {
|
|
87
|
-
label?: string;
|
|
88
|
-
}): (...args: Parameters<T>) => ReturnType<T>;
|
|
89
|
-
/**
|
|
90
|
-
* Internal method to log a message
|
|
91
|
-
*
|
|
92
|
-
* @param level - The log level
|
|
93
|
-
* @param message - The message to log
|
|
94
|
-
* @param args - Additional arguments
|
|
95
|
-
*/
|
|
96
|
-
private log;
|
|
97
|
-
}
|
package/dist/core/logger.js
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Logger = void 0;
|
|
4
|
-
const config_1 = require("./config");
|
|
5
|
-
const execution_1 = require("../trackers/execution");
|
|
6
|
-
const performance_1 = require("../trackers/performance");
|
|
7
|
-
const cli_1 = require("../formatters/cli");
|
|
8
|
-
/**
|
|
9
|
-
* Console transport for outputting logs to the console
|
|
10
|
-
*/
|
|
11
|
-
class ConsoleTransport {
|
|
12
|
-
/**
|
|
13
|
-
* Write a log entry to the console
|
|
14
|
-
*
|
|
15
|
-
* @param entry - The formatted log entry
|
|
16
|
-
*/
|
|
17
|
-
write(entry) {
|
|
18
|
-
console.log(entry);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Main logger class that implements the ILogger interface
|
|
23
|
-
*/
|
|
24
|
-
class Logger {
|
|
25
|
-
/**
|
|
26
|
-
* Create a new Logger instance
|
|
27
|
-
*
|
|
28
|
-
* @param config - Logger configuration
|
|
29
|
-
*/
|
|
30
|
-
constructor(config = {}) {
|
|
31
|
-
this._indentLevel = 0;
|
|
32
|
-
this._config = new config_1.ConfigManager(config);
|
|
33
|
-
// Set up trackers
|
|
34
|
-
this._executionTracker = new execution_1.ExecutionTracker({
|
|
35
|
-
defaultThreshold: this._config.getPerformanceThreshold(),
|
|
36
|
-
});
|
|
37
|
-
this._performanceMonitor = new performance_1.PerformanceMonitor({
|
|
38
|
-
defaultThreshold: this._config.getPerformanceThreshold(),
|
|
39
|
-
});
|
|
40
|
-
// Set up transports
|
|
41
|
-
this._transports = config.transports || [new ConsoleTransport()];
|
|
42
|
-
// Set up formatters
|
|
43
|
-
this._formatters = config.formatters || [
|
|
44
|
-
new cli_1.CliFormatter({
|
|
45
|
-
colorEnabled: this._config.isColorEnabled(),
|
|
46
|
-
indentSize: this._config.getIndentSize(),
|
|
47
|
-
}),
|
|
48
|
-
];
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Log an informational message
|
|
52
|
-
*
|
|
53
|
-
* @param message - The message to log
|
|
54
|
-
* @param args - Additional arguments to include in the log
|
|
55
|
-
*/
|
|
56
|
-
info(message, ...args) {
|
|
57
|
-
this.log('info', message, args);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Log a warning message
|
|
61
|
-
*
|
|
62
|
-
* @param message - The message to log
|
|
63
|
-
* @param args - Additional arguments to include in the log
|
|
64
|
-
*/
|
|
65
|
-
warn(message, ...args) {
|
|
66
|
-
this.log('warn', message, args);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Log an error message
|
|
70
|
-
*
|
|
71
|
-
* @param message - The message to log
|
|
72
|
-
* @param args - Additional arguments to include in the log
|
|
73
|
-
*/
|
|
74
|
-
error(message, ...args) {
|
|
75
|
-
this.log('error', message, args);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Log a debug message
|
|
79
|
-
*
|
|
80
|
-
* @param message - The message to log
|
|
81
|
-
* @param args - Additional arguments to include in the log
|
|
82
|
-
*/
|
|
83
|
-
debug(message, ...args) {
|
|
84
|
-
// Skip debug logs in production mode
|
|
85
|
-
if (this.getMode() === 'prod') {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
this.log('debug', message, args);
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Start a new log group with the given label
|
|
92
|
-
*
|
|
93
|
-
* @param label - The label for the group
|
|
94
|
-
*/
|
|
95
|
-
group(label) {
|
|
96
|
-
this.info(label);
|
|
97
|
-
this._indentLevel++;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* End the current log group
|
|
101
|
-
*/
|
|
102
|
-
groupEnd() {
|
|
103
|
-
if (this._indentLevel > 0) {
|
|
104
|
-
this._indentLevel--;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Set the operational mode for the logger
|
|
109
|
-
*
|
|
110
|
-
* @param mode - The mode to set
|
|
111
|
-
*/
|
|
112
|
-
setMode(mode) {
|
|
113
|
-
this._config.setMode(mode);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Get the current operational mode
|
|
117
|
-
*
|
|
118
|
-
* @returns The current mode
|
|
119
|
-
*/
|
|
120
|
-
getMode() {
|
|
121
|
-
return this._config.getMode();
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Track the execution of a function
|
|
125
|
-
*
|
|
126
|
-
* @param fn - The function to track
|
|
127
|
-
* @param options - Options for tracking
|
|
128
|
-
* @returns The return value of the tracked function
|
|
129
|
-
*/
|
|
130
|
-
track(fn, options) {
|
|
131
|
-
var _a;
|
|
132
|
-
const silent = (_a = options === null || options === void 0 ? void 0 : options.silent) !== null && _a !== void 0 ? _a : false;
|
|
133
|
-
// Track the function execution
|
|
134
|
-
const result = this._executionTracker.track(fn, options);
|
|
135
|
-
// Log the execution flow if not silent
|
|
136
|
-
if (!silent) {
|
|
137
|
-
const flowChart = this._executionTracker.generateFlowChart();
|
|
138
|
-
// Log the flow chart directly to console to preserve ASCII art
|
|
139
|
-
// Skip formatters to avoid messing up the ASCII art
|
|
140
|
-
console.log(flowChart);
|
|
141
|
-
}
|
|
142
|
-
return result;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Create a trackable version of a function
|
|
146
|
-
*
|
|
147
|
-
* This is a helper method to create a tracked version of a function
|
|
148
|
-
* that can be used for nested function tracking.
|
|
149
|
-
*
|
|
150
|
-
* @param fn - The function to make trackable
|
|
151
|
-
* @param options - Options for tracking
|
|
152
|
-
* @returns A tracked version of the function
|
|
153
|
-
*/
|
|
154
|
-
createTrackable(fn, options) {
|
|
155
|
-
return this._executionTracker.createTrackable(fn, options);
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Internal method to log a message
|
|
159
|
-
*
|
|
160
|
-
* @param level - The log level
|
|
161
|
-
* @param message - The message to log
|
|
162
|
-
* @param args - Additional arguments
|
|
163
|
-
*/
|
|
164
|
-
log(level, message, args) {
|
|
165
|
-
// Check if this log level should be displayed
|
|
166
|
-
if (!this._config.shouldLog(level)) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
// Create metadata for the log entry
|
|
170
|
-
const meta = {
|
|
171
|
-
timestamp: new Date(),
|
|
172
|
-
level,
|
|
173
|
-
indentLevel: this._indentLevel,
|
|
174
|
-
};
|
|
175
|
-
// Format the log entry using each formatter
|
|
176
|
-
for (const formatter of this._formatters) {
|
|
177
|
-
const formattedEntry = formatter.format(level, message, args, meta);
|
|
178
|
-
// Send to each transport
|
|
179
|
-
for (const transport of this._transports) {
|
|
180
|
-
transport.write(formattedEntry);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
exports.Logger = Logger;
|
|
186
|
-
//# sourceMappingURL=logger.js.map
|
package/dist/core/logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":";;;AACA,qCAAyC;AACzC,qDAAyD;AACzD,yDAA6D;AAC7D,2CAAiD;AAEjD;;GAEG;AACH,MAAM,gBAAgB;IACpB;;;;OAIG;IACI,KAAK,CAAC,KAAa;QACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;CACF;AAED;;GAEG;AACH,MAAa,MAAM;IAQjB;;;;OAIG;IACH,YAAY,SAAiC,EAAE;QATvC,iBAAY,GAAW,CAAC,CAAC;QAU/B,IAAI,CAAC,OAAO,GAAG,IAAI,sBAAa,CAAC,MAAM,CAAC,CAAC;QAEzC,kBAAkB;QAClB,IAAI,CAA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;QAC9C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;YACnC,OAAO;QACT,CAAC;QAED,oCAAoC;QACpC,MAAM,IAAI,GAAY;YACpB,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,KAAK;YACL,WAAW,EAAE,IAAI,CAAC,YAAY;SAC/B,CAAC;QAEF,4CAA4C;QAC5C,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACzC,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YAEpE,yBAAyB;YACzB,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;gBACzC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA/LD,wBA+LC"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { ILoggerConfig, LogLevel, LogMode } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Configuration manager for the logger
|
|
4
|
-
* Handles merging user config with defaults and provides utility methods
|
|
5
|
-
*/
|
|
6
|
-
export declare class ConfigManager {
|
|
7
|
-
private _config;
|
|
8
|
-
/**
|
|
9
|
-
* Create a new ConfigManager instance
|
|
10
|
-
*
|
|
11
|
-
* @param userConfig - User-provided configuration options
|
|
12
|
-
*/
|
|
13
|
-
constructor(userConfig?: Partial<ILoggerConfig>);
|
|
14
|
-
/**
|
|
15
|
-
* Get the current configuration
|
|
16
|
-
*
|
|
17
|
-
* @returns The current configuration
|
|
18
|
-
*/
|
|
19
|
-
getConfig(): ILoggerConfig;
|
|
20
|
-
/**
|
|
21
|
-
* Update the configuration
|
|
22
|
-
*
|
|
23
|
-
* @param newConfig - New configuration options to merge
|
|
24
|
-
*/
|
|
25
|
-
updateConfig(newConfig: Partial<ILoggerConfig>): void;
|
|
26
|
-
/**
|
|
27
|
-
* Get the current mode
|
|
28
|
-
*
|
|
29
|
-
* @returns The current mode
|
|
30
|
-
*/
|
|
31
|
-
getMode(): LogMode;
|
|
32
|
-
/**
|
|
33
|
-
* Set the current mode
|
|
34
|
-
*
|
|
35
|
-
* @param mode - The mode to set
|
|
36
|
-
*/
|
|
37
|
-
setMode(mode: LogMode): void;
|
|
38
|
-
/**
|
|
39
|
-
* Check if a log level should be displayed based on the current mode and level
|
|
40
|
-
*
|
|
41
|
-
* @param level - The log level to check
|
|
42
|
-
* @returns Whether the log level should be displayed
|
|
43
|
-
*/
|
|
44
|
-
shouldLog(level: LogLevel): boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Get the higher priority level between two log levels
|
|
47
|
-
*
|
|
48
|
-
* @param levelA - First log level
|
|
49
|
-
* @param levelB - Second log level
|
|
50
|
-
* @returns The higher priority level
|
|
51
|
-
*/
|
|
52
|
-
private getHigherPriorityLevel;
|
|
53
|
-
/**
|
|
54
|
-
* Get the performance threshold
|
|
55
|
-
*
|
|
56
|
-
* @returns The performance threshold in milliseconds
|
|
57
|
-
*/
|
|
58
|
-
getPerformanceThreshold(): number;
|
|
59
|
-
/**
|
|
60
|
-
* Get the indentation size
|
|
61
|
-
*
|
|
62
|
-
* @returns The number of spaces for each indentation level
|
|
63
|
-
*/
|
|
64
|
-
getIndentSize(): number;
|
|
65
|
-
/**
|
|
66
|
-
* Check if colorization is enabled
|
|
67
|
-
*
|
|
68
|
-
* @returns Whether colorization is enabled
|
|
69
|
-
*/
|
|
70
|
-
isColorEnabled(): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Check if timestamps are enabled
|
|
73
|
-
*
|
|
74
|
-
* @returns Whether timestamps are enabled
|
|
75
|
-
*/
|
|
76
|
-
isTimestampEnabled(): boolean;
|
|
77
|
-
}
|