@mks2508/better-logger 0.0.2-alpha.2 → 0.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/.claude/settings.local.json +18 -2
- package/.github/workflows/ci-quality.yml +357 -0
- package/.github/workflows/docs-demo.yml +119 -0
- package/.github/workflows/releases-core.yml +512 -0
- package/.github/workflows/releases-full.yml +582 -0
- package/.github/{workflows → workflows-backup}/ci.yml +12 -110
- package/.github/workflows-backup/nightly.yml +196 -0
- package/.github/workflows-backup/release-optimized.yml +373 -0
- package/.release-notes-0.2.0.md +129 -0
- package/.yamllint +28 -0
- package/CHANGELOG.json +783 -0
- package/CLAUDE.md +92 -1
- package/README.md +198 -490
- package/bun.lock +323 -0
- package/demo.html +9 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/Logger.d.ts +272 -0
- package/dist/Logger.d.ts.map +1 -0
- package/dist/Logger.js +680 -0
- package/dist/ScopedLogger.d.ts +126 -0
- package/dist/ScopedLogger.d.ts.map +1 -0
- package/dist/ScopedLogger.js +234 -0
- package/dist/chunks/Logger-BpeuYIxR.js +2 -0
- package/dist/chunks/Logger-BpeuYIxR.js.map +1 -0
- package/dist/chunks/Logger-Didxtr23.js +3275 -0
- package/dist/chunks/Logger-Didxtr23.js.map +1 -0
- package/dist/chunks/RemoteLogHandler-CjWpWZGl.js +33 -0
- package/dist/chunks/RemoteLogHandler-CjWpWZGl.js.map +1 -0
- package/dist/chunks/RemoteLogHandler-ymkQ97xl.js +2 -0
- package/dist/chunks/RemoteLogHandler-ymkQ97xl.js.map +1 -0
- package/dist/chunks/environment-Bxbnw4pd.js +544 -0
- package/dist/chunks/environment-Bxbnw4pd.js.map +1 -0
- package/dist/chunks/environment-Dm66zOML.js +4 -0
- package/dist/chunks/environment-Dm66zOML.js.map +1 -0
- package/dist/chunks/formatting-C0riPC5_.js +95 -0
- package/dist/chunks/formatting-C0riPC5_.js.map +1 -0
- package/dist/chunks/formatting-DNCAV66-.js +2 -0
- package/dist/chunks/formatting-DNCAV66-.js.map +1 -0
- package/dist/cli/CommandProcessor.d.ts +103 -0
- package/dist/cli/CommandProcessor.d.ts.map +1 -0
- package/dist/cli/CommandProcessor.js +184 -0
- package/dist/cli/commands/ConfigCommand.d.ts +17 -0
- package/dist/cli/commands/ConfigCommand.d.ts.map +1 -0
- package/dist/cli/commands/ConfigCommand.js +88 -0
- package/dist/cli/commands/ExportCommand.d.ts +51 -0
- package/dist/cli/commands/ExportCommand.d.ts.map +1 -0
- package/dist/cli/commands/ExportCommand.js +243 -0
- package/dist/cli/commands/HistoryCommand.d.ts +50 -0
- package/dist/cli/commands/HistoryCommand.d.ts.map +1 -0
- package/dist/cli/commands/HistoryCommand.js +96 -0
- package/dist/cli/commands/StatusCommand.d.ts +33 -0
- package/dist/cli/commands/StatusCommand.d.ts.map +1 -0
- package/dist/cli/commands/StatusCommand.js +93 -0
- package/dist/cli/commands/ThemeCommand.d.ts +33 -0
- package/dist/cli/commands/ThemeCommand.d.ts.map +1 -0
- package/dist/cli/commands/ThemeCommand.js +79 -0
- package/dist/cli/help.d.ts +15 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +118 -0
- package/dist/cli/index.d.ts +15 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +46 -0
- package/dist/constants.d.ts +122 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +159 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +134 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +315 -242
- package/dist/core.js.map +1 -1
- package/dist/example.d.ts +18 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +154 -0
- package/dist/exports-module.d.ts +203 -0
- package/dist/exports-module.d.ts.map +1 -0
- package/dist/exports-module.js +260 -0
- package/dist/exports.cjs +1 -1
- package/dist/exports.cjs.map +1 -1
- package/dist/exports.js +5 -4
- package/dist/exports.js.map +1 -1
- package/dist/handlers/AnalyticsLogHandler.d.ts +11 -0
- package/dist/handlers/AnalyticsLogHandler.d.ts.map +1 -0
- package/dist/handlers/AnalyticsLogHandler.js +19 -0
- package/dist/handlers/ExportLogHandler.d.ts +103 -0
- package/dist/handlers/ExportLogHandler.d.ts.map +1 -0
- package/dist/handlers/ExportLogHandler.js +516 -0
- package/dist/handlers/FileLogHandler.d.ts +36 -0
- package/dist/handlers/FileLogHandler.d.ts.map +1 -0
- package/dist/handlers/FileLogHandler.js +156 -0
- package/dist/handlers/RemoteLogHandler.d.ts +14 -0
- package/dist/handlers/RemoteLogHandler.d.ts.map +1 -0
- package/dist/handlers/RemoteLogHandler.js +37 -0
- package/dist/handlers/index.d.ts +8 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +7 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +86 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +89 -103
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +139 -0
- package/dist/styling/LogStyleBuilder.d.ts +149 -0
- package/dist/styling/LogStyleBuilder.d.ts.map +1 -0
- package/dist/styling/LogStyleBuilder.js +289 -0
- package/dist/styling/SemanticStyles.d.ts +181 -0
- package/dist/styling/SemanticStyles.d.ts.map +1 -0
- package/dist/styling/SemanticStyles.js +339 -0
- package/dist/styling/SmartPresets.d.ts +25 -0
- package/dist/styling/SmartPresets.d.ts.map +1 -0
- package/dist/styling/SmartPresets.js +276 -0
- package/dist/styling/StyleBuilder.d.ts +140 -0
- package/dist/styling/StyleBuilder.d.ts.map +1 -0
- package/dist/styling/StyleBuilder.js +280 -0
- package/dist/styling/banners.d.ts +45 -0
- package/dist/styling/banners.d.ts.map +1 -0
- package/dist/styling/banners.js +155 -0
- package/dist/styling/index.d.ts +10 -0
- package/dist/styling/index.d.ts.map +1 -0
- package/dist/styling/index.js +9 -0
- package/dist/styling/themes.d.ts +10 -0
- package/dist/styling/themes.d.ts.map +1 -0
- package/dist/styling/themes.js +231 -0
- package/dist/styling-module.d.ts +185 -0
- package/dist/styling-module.d.ts.map +1 -0
- package/dist/styling-module.js +199 -0
- package/dist/styling.cjs +1 -1
- package/dist/styling.cjs.map +1 -1
- package/dist/styling.js +6 -6
- package/dist/styling.js.map +1 -1
- package/dist/types/Logger.d.ts +268 -0
- package/dist/types/Logger.d.ts.map +1 -0
- package/dist/types/ScopedLogger.d.ts +123 -0
- package/dist/types/ScopedLogger.d.ts.map +1 -0
- package/dist/types/cli/CommandProcessor.d.ts +100 -0
- package/dist/types/cli/CommandProcessor.d.ts.map +1 -0
- package/dist/types/cli/commands/ConfigCommand.d.ts +14 -0
- package/dist/types/cli/commands/ConfigCommand.d.ts.map +1 -0
- package/dist/types/cli/commands/ExportCommand.d.ts +48 -0
- package/dist/types/cli/commands/ExportCommand.d.ts.map +1 -0
- package/dist/types/cli/commands/HistoryCommand.d.ts +47 -0
- package/dist/types/cli/commands/HistoryCommand.d.ts.map +1 -0
- package/dist/types/cli/commands/StatusCommand.d.ts +30 -0
- package/dist/types/cli/commands/StatusCommand.d.ts.map +1 -0
- package/dist/types/cli/commands/ThemeCommand.d.ts +30 -0
- package/dist/types/cli/commands/ThemeCommand.d.ts.map +1 -0
- package/dist/types/cli/help.d.ts +12 -0
- package/dist/types/cli/help.d.ts.map +1 -0
- package/dist/types/cli/index.d.ts +15 -0
- package/dist/types/cli/index.d.ts.map +1 -0
- package/dist/types/constants.d.ts +119 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/core.d.ts +125 -211
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/core.js +13 -0
- package/dist/types/example.d.ts +18 -0
- package/dist/types/example.d.ts.map +1 -0
- package/dist/types/exports-module.d.ts +196 -0
- package/dist/types/exports-module.d.ts.map +1 -0
- package/dist/types/handlers/AnalyticsLogHandler.d.ts +8 -0
- package/dist/types/handlers/AnalyticsLogHandler.d.ts.map +1 -0
- package/dist/types/handlers/ExportLogHandler.d.ts +100 -0
- package/dist/types/handlers/ExportLogHandler.d.ts.map +1 -0
- package/dist/types/handlers/FileLogHandler.d.ts +33 -0
- package/dist/types/handlers/FileLogHandler.d.ts.map +1 -0
- package/dist/types/handlers/RemoteLogHandler.d.ts +11 -0
- package/dist/types/handlers/RemoteLogHandler.d.ts.map +1 -0
- package/dist/types/handlers/index.d.ts +8 -0
- package/dist/types/handlers/index.d.ts.map +1 -0
- package/dist/types/handlers.d.ts +88 -0
- package/dist/types/handlers.d.ts.map +1 -0
- package/dist/types/handlers.js +4 -0
- package/dist/types/index.d.ts +7 -675
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/main.d.ts +2 -0
- package/dist/types/main.d.ts.map +1 -0
- package/dist/types/styling/LogStyleBuilder.d.ts +146 -0
- package/dist/types/styling/LogStyleBuilder.d.ts.map +1 -0
- package/dist/types/styling/SemanticStyles.d.ts +178 -0
- package/dist/types/styling/SemanticStyles.d.ts.map +1 -0
- package/dist/types/styling/SmartPresets.d.ts +22 -0
- package/dist/types/styling/SmartPresets.d.ts.map +1 -0
- package/dist/types/styling/StyleBuilder.d.ts +140 -0
- package/dist/types/styling/StyleBuilder.d.ts.map +1 -0
- package/dist/types/styling/banners.d.ts +42 -0
- package/dist/types/styling/banners.d.ts.map +1 -0
- package/dist/types/styling/index.d.ts +10 -0
- package/dist/types/styling/index.d.ts.map +1 -0
- package/dist/types/styling/themes.d.ts +7 -0
- package/dist/types/styling/themes.d.ts.map +1 -0
- package/dist/types/styling-module.d.ts +178 -0
- package/dist/types/styling-module.d.ts.map +1 -0
- package/dist/types/types/core.d.ts +125 -0
- package/dist/types/types/core.d.ts.map +1 -0
- package/dist/types/types/handlers.d.ts +85 -0
- package/dist/types/types/handlers.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +7 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/utils/environment.d.ts +47 -0
- package/dist/types/utils/environment.d.ts.map +1 -0
- package/dist/types/utils/formatting.d.ts +37 -0
- package/dist/types/utils/formatting.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +7 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/opentui-detection.d.ts +34 -0
- package/dist/types/utils/opentui-detection.d.ts.map +1 -0
- package/dist/types/utils/output.d.ts +41 -0
- package/dist/types/utils/output.d.ts.map +1 -0
- package/dist/types/utils/stackTrace.d.ts +6 -0
- package/dist/types/utils/stackTrace.d.ts.map +1 -0
- package/dist/types/utils/timestamps.d.ts +20 -0
- package/dist/types/utils/timestamps.d.ts.map +1 -0
- package/dist/utils/environment.d.ts +47 -0
- package/dist/utils/environment.d.ts.map +1 -0
- package/dist/utils/environment.js +85 -0
- package/dist/utils/formatting.d.ts +40 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/formatting.js +117 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/opentui-detection.d.ts +34 -0
- package/dist/utils/opentui-detection.d.ts.map +1 -0
- package/dist/utils/opentui-detection.js +116 -0
- package/dist/utils/output.d.ts +44 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +150 -0
- package/dist/utils/stackTrace.d.ts +9 -0
- package/dist/utils/stackTrace.d.ts.map +1 -0
- package/dist/utils/stackTrace.js +81 -0
- package/dist/utils/timestamps.d.ts +20 -0
- package/dist/utils/timestamps.d.ts.map +1 -0
- package/dist/utils/timestamps.js +71 -0
- package/docs/API.md +691 -0
- package/docs/CORE.md +10 -10
- package/docs/DEVELOPMENT.md +731 -0
- package/docs/PACKAGES.md +244 -0
- package/docs/_config.yml +36 -0
- package/docs/index.md +179 -0
- package/examples/README.md +208 -0
- package/examples/basic-logging.js +75 -0
- package/examples/data-export.js +234 -0
- package/examples/package.json +16 -0
- package/examples/performance-timing.js +170 -0
- package/examples/simplified-api.js +124 -0
- package/examples/styling-themes.js +207 -0
- package/package.json +37 -21
- package/packages/core/package.json +57 -0
- package/packages/exports/package.json +41 -0
- package/packages/nodejs-opentui/README.md +232 -0
- package/packages/nodejs-opentui/package.json +72 -0
- package/packages/nodejs-opentui/src/LogRenderer.ts +171 -0
- package/packages/nodejs-opentui/src/OpenTUILogHandler.ts +178 -0
- package/packages/nodejs-opentui/src/components/LogBadge.tsx +131 -0
- package/packages/nodejs-opentui/src/index.ts +133 -0
- package/packages/nodejs-opentui/src/types.ts +158 -0
- package/packages/nodejs-opentui/tsconfig.json +20 -0
- package/packages/styling/package.json +41 -0
- package/project-utils/README.md +172 -0
- package/project-utils/auto-release-gemini.ts +1193 -0
- package/project-utils/auto-release-ui.ts +1329 -0
- package/project-utils/commit-generator.ts +1385 -0
- package/project-utils/commit-ui.ts +264 -0
- package/project-utils/git-utils.ts +199 -0
- package/project-utils/github-release-manager.ts +466 -0
- package/project-utils/project-config.ts +260 -0
- package/project-utils/prompt-templates.js +345 -0
- package/project-utils/prompt-templates.ts +422 -0
- package/project-utils/version-manager.ts +1078 -0
- package/src/Logger.ts +251 -16
- package/src/ScopedLogger.ts +262 -0
- package/src/cli/CommandProcessor.ts +173 -2
- package/src/cli/commands/HistoryCommand.ts +117 -0
- package/src/cli/index.ts +12 -0
- package/src/constants.ts +84 -2
- package/src/core.ts +119 -46
- package/src/example.ts +4 -4
- package/src/exports-module.ts +1 -1
- package/src/handlers/ExportLogHandler.ts +141 -0
- package/src/handlers/FileLogHandler.ts +144 -5
- package/src/index.ts +1 -1
- package/src/main.ts +3 -3
- package/src/styling/LogStyleBuilder.ts +355 -0
- package/src/styling/SemanticStyles.ts +380 -0
- package/src/styling/SmartPresets.ts +288 -0
- package/src/styling/StyleBuilder.ts +14 -0
- package/src/styling/index.ts +16 -1
- package/src/styling-module.ts +1 -1
- package/src/types/core.ts +60 -0
- package/src/types/index.ts +6 -0
- package/src/utils/environment.ts +94 -0
- package/src/utils/formatting.ts +142 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/opentui-detection.ts +138 -0
- package/src/utils/output.ts +66 -8
- package/test-core-browser.html +237 -0
- package/test-core-node.js +63 -0
- package/tests/test-conflict-resolution.ts +391 -0
- package/tests/validate-workflows.sh +131 -0
- package/tests/yaml-autofix.sh +146 -0
- package/vite.config.ts +189 -50
- package/.npmrc.bak +0 -1
- package/dist/chunks/Logger-BQhMKy_T.js +0 -2
- package/dist/chunks/Logger-BQhMKy_T.js.map +0 -1
- package/dist/chunks/Logger-BrFKFZcD.js +0 -978
- package/dist/chunks/Logger-BrFKFZcD.js.map +0 -1
- package/dist/chunks/core-2opW4Pi3.js +0 -194
- package/dist/chunks/core-2opW4Pi3.js.map +0 -1
- package/dist/chunks/core-DyugwSYZ.js +0 -4
- package/dist/chunks/core-DyugwSYZ.js.map +0 -1
- package/dist/chunks/exports-BNP3R7dp.js +0 -421
- package/dist/chunks/exports-BNP3R7dp.js.map +0 -1
- package/dist/chunks/exports-U1xLBXrY.js +0 -2
- package/dist/chunks/exports-U1xLBXrY.js.map +0 -1
- package/dist/chunks/styling-DhUDzwlE.js +0 -654
- package/dist/chunks/styling-DhUDzwlE.js.map +0 -1
- package/dist/chunks/styling-tmRDI28D.js +0 -2
- package/dist/chunks/styling-tmRDI28D.js.map +0 -1
- package/dist/types/exports.d.ts +0 -600
- package/dist/types/styling.d.ts +0 -751
- package/src/Logger.ts.backup +0 -1684
- /package/.github/{workflows → workflows-backup}/release.yml +0 -0
package/src/Logger.ts
CHANGED
|
@@ -20,7 +20,8 @@ import type {
|
|
|
20
20
|
import {
|
|
21
21
|
parseStackTrace,
|
|
22
22
|
formatTimestamp,
|
|
23
|
-
createStyledOutput
|
|
23
|
+
createStyledOutput,
|
|
24
|
+
setupThemeChangeListener
|
|
24
25
|
} from './utils/index.js';
|
|
25
26
|
|
|
26
27
|
// Styling imports
|
|
@@ -32,6 +33,11 @@ import {
|
|
|
32
33
|
StyleBuilder
|
|
33
34
|
} from './styling/index.js';
|
|
34
35
|
|
|
36
|
+
// Smart presets and scoped loggers
|
|
37
|
+
import { getSmartPreset, getAvailablePresets, hasPreset } from './styling/SmartPresets.js';
|
|
38
|
+
import { ScopedLogger, APILogger, ComponentLogger } from './ScopedLogger.js';
|
|
39
|
+
import { createLogStyleBuilder } from './styling/LogStyleBuilder.js';
|
|
40
|
+
|
|
35
41
|
// Handler imports
|
|
36
42
|
import { ExportLogHandler } from './handlers/index.js';
|
|
37
43
|
|
|
@@ -57,6 +63,12 @@ export class Logger {
|
|
|
57
63
|
private groupDepth: number = 0;
|
|
58
64
|
private exportHandler?: ExportLogHandler;
|
|
59
65
|
private cliProcessor?: CommandProcessor;
|
|
66
|
+
private themeChangeListener?: (() => void) | null;
|
|
67
|
+
private displaySettings = {
|
|
68
|
+
showTimestamp: true,
|
|
69
|
+
showLocation: true,
|
|
70
|
+
showBadges: true
|
|
71
|
+
};
|
|
60
72
|
|
|
61
73
|
/**
|
|
62
74
|
* Creates a new Logger instance
|
|
@@ -75,6 +87,31 @@ export class Logger {
|
|
|
75
87
|
|
|
76
88
|
// Initialize CLI processor
|
|
77
89
|
this.cliProcessor = createDefaultCLI();
|
|
90
|
+
|
|
91
|
+
// Set up theme change listener if auto-detection is enabled
|
|
92
|
+
if (this.config.autoDetectTheme) {
|
|
93
|
+
this.setupAutoThemeDetection();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ===== PRIVATE HELPER METHODS =====
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Sets up automatic theme detection with change listener
|
|
101
|
+
*/
|
|
102
|
+
private setupAutoThemeDetection(): void {
|
|
103
|
+
// Clean up existing listener if any
|
|
104
|
+
if (this.themeChangeListener) {
|
|
105
|
+
this.themeChangeListener();
|
|
106
|
+
this.themeChangeListener = null;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Set up new listener
|
|
110
|
+
this.themeChangeListener = setupThemeChangeListener((theme) => {
|
|
111
|
+
// Theme changed - logs will automatically use new colors on next call
|
|
112
|
+
// No need to update anything as colors are resolved dynamically
|
|
113
|
+
this.debug(`DevTools theme changed to: ${theme}`);
|
|
114
|
+
});
|
|
78
115
|
}
|
|
79
116
|
|
|
80
117
|
// ===== CONFIGURATION METHODS =====
|
|
@@ -90,7 +127,18 @@ export class Logger {
|
|
|
90
127
|
* Update configuration
|
|
91
128
|
*/
|
|
92
129
|
updateConfig(updates: Partial<LoggerConfig>): void {
|
|
130
|
+
const previousAutoDetect = this.config.autoDetectTheme;
|
|
93
131
|
this.config = { ...this.config, ...updates };
|
|
132
|
+
|
|
133
|
+
// Handle auto-detection changes
|
|
134
|
+
if (updates.autoDetectTheme !== undefined && updates.autoDetectTheme !== previousAutoDetect) {
|
|
135
|
+
if (updates.autoDetectTheme) {
|
|
136
|
+
this.setupAutoThemeDetection();
|
|
137
|
+
} else if (this.themeChangeListener) {
|
|
138
|
+
this.themeChangeListener();
|
|
139
|
+
this.themeChangeListener = null;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
94
142
|
}
|
|
95
143
|
|
|
96
144
|
/**
|
|
@@ -111,6 +159,13 @@ export class Logger {
|
|
|
111
159
|
* Sets the logger theme
|
|
112
160
|
*/
|
|
113
161
|
setTheme(theme: ThemeVariant): void {
|
|
162
|
+
// First check if it's a smart preset
|
|
163
|
+
if (hasPreset(theme)) {
|
|
164
|
+
this.preset(theme);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Fallback to old theme system
|
|
114
169
|
if (theme in THEME_PRESETS) {
|
|
115
170
|
LEVEL_STYLES = (THEME_PRESETS as any)[theme];
|
|
116
171
|
this.config.theme = theme;
|
|
@@ -123,7 +178,7 @@ export class Logger {
|
|
|
123
178
|
|
|
124
179
|
this.success(`Theme changed to: ${theme}`);
|
|
125
180
|
} else {
|
|
126
|
-
this.error(`Invalid theme: ${theme}. Available
|
|
181
|
+
this.error(`Invalid theme: ${theme}. Available:`, [...getAvailablePresets(), ...Object.keys(THEME_PRESETS)]);
|
|
127
182
|
}
|
|
128
183
|
}
|
|
129
184
|
|
|
@@ -139,22 +194,172 @@ export class Logger {
|
|
|
139
194
|
* Reset logger to default configuration
|
|
140
195
|
*/
|
|
141
196
|
resetConfig(): void {
|
|
197
|
+
// Clean up theme listener
|
|
198
|
+
if (this.themeChangeListener) {
|
|
199
|
+
this.themeChangeListener();
|
|
200
|
+
this.themeChangeListener = null;
|
|
201
|
+
}
|
|
202
|
+
|
|
142
203
|
this.config = { ...DEFAULT_CONFIG };
|
|
143
204
|
LEVEL_STYLES = THEME_PRESETS.default;
|
|
205
|
+
|
|
206
|
+
// Re-setup auto theme detection if enabled in default config
|
|
207
|
+
if (this.config.autoDetectTheme) {
|
|
208
|
+
this.setupAutoThemeDetection();
|
|
209
|
+
}
|
|
210
|
+
|
|
144
211
|
this.success('Logger configuration reset to defaults');
|
|
145
212
|
}
|
|
146
213
|
|
|
147
|
-
|
|
214
|
+
/**
|
|
215
|
+
* Cleanup method to remove event listeners and free resources
|
|
216
|
+
*/
|
|
217
|
+
cleanup(): void {
|
|
218
|
+
if (this.themeChangeListener) {
|
|
219
|
+
this.themeChangeListener();
|
|
220
|
+
this.themeChangeListener = null;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// ===== SIMPLIFIED API =====
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Apply a smart preset - works perfectly out-of-the-box
|
|
228
|
+
*/
|
|
229
|
+
preset(name: string): void {
|
|
230
|
+
if (!hasPreset(name)) {
|
|
231
|
+
this.error(`Unknown preset: ${name}. Available presets:`, getAvailablePresets());
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const presetConfig = getSmartPreset(name);
|
|
236
|
+
if (presetConfig) {
|
|
237
|
+
// Apply the smart preset configuration
|
|
238
|
+
this.displaySettings.showTimestamp = presetConfig.timestamp?.show ?? true;
|
|
239
|
+
this.displaySettings.showLocation = presetConfig.location?.show ?? true;
|
|
240
|
+
|
|
241
|
+
// Store the preset config for use in createStyledOutput
|
|
242
|
+
(this as any)._activePreset = presetConfig;
|
|
243
|
+
(this as any)._activePresetName = name;
|
|
244
|
+
|
|
245
|
+
this.success(`Applied preset: ${name}`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* List available presets
|
|
251
|
+
*/
|
|
252
|
+
presets(): string[] {
|
|
253
|
+
return getAvailablePresets();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// ===== TOGGLE METHODS =====
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Hide timestamp in logs
|
|
260
|
+
*/
|
|
261
|
+
hideTimestamp(): void {
|
|
262
|
+
this.displaySettings.showTimestamp = false;
|
|
263
|
+
this.success('Timestamp hidden');
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Show timestamp in logs
|
|
268
|
+
*/
|
|
269
|
+
showTimestamp(): void {
|
|
270
|
+
this.displaySettings.showTimestamp = true;
|
|
271
|
+
this.success('Timestamp shown');
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Hide location info in logs
|
|
276
|
+
*/
|
|
277
|
+
hideLocation(): void {
|
|
278
|
+
this.displaySettings.showLocation = false;
|
|
279
|
+
this.success('Location info hidden');
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Show location info in logs
|
|
284
|
+
*/
|
|
285
|
+
showLocation(): void {
|
|
286
|
+
this.displaySettings.showLocation = true;
|
|
287
|
+
this.success('Location info shown');
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Hide badges in logs
|
|
292
|
+
*/
|
|
293
|
+
hideBadges(): void {
|
|
294
|
+
this.displaySettings.showBadges = false;
|
|
295
|
+
this.success('Badges hidden');
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Show badges in logs
|
|
300
|
+
*/
|
|
301
|
+
showBadges(): void {
|
|
302
|
+
this.displaySettings.showBadges = true;
|
|
303
|
+
this.success('Badges shown');
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// ===== SCOPED LOGGERS =====
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Create a component logger with automatic styling
|
|
310
|
+
*/
|
|
311
|
+
component(name: string): ComponentLogger {
|
|
312
|
+
return new ComponentLogger(this, name);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Create an API logger with automatic badges
|
|
317
|
+
*/
|
|
318
|
+
api(name: string): APILogger {
|
|
319
|
+
return new APILogger(this, name);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Create a general scoped logger with badges support
|
|
324
|
+
*/
|
|
325
|
+
scope(name: string): ScopedLogger {
|
|
326
|
+
return new ScopedLogger(this, name);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// ===== SIMPLE CUSTOMIZATION =====
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Simple customization with minimal configuration
|
|
333
|
+
*/
|
|
334
|
+
customize(overrides: {
|
|
335
|
+
message?: { color?: string; font?: string; size?: string };
|
|
336
|
+
timestamp?: { show?: boolean; color?: string };
|
|
337
|
+
location?: { show?: boolean; color?: string };
|
|
338
|
+
level?: { uppercase?: boolean; style?: string };
|
|
339
|
+
prefix?: { show?: boolean; style?: string };
|
|
340
|
+
spacing?: 'compact' | 'normal' | 'spacious';
|
|
341
|
+
}): void {
|
|
342
|
+
// Apply simple overrides
|
|
343
|
+
if (overrides.timestamp?.show !== undefined) {
|
|
344
|
+
this.displaySettings.showTimestamp = overrides.timestamp.show;
|
|
345
|
+
}
|
|
346
|
+
if (overrides.location?.show !== undefined) {
|
|
347
|
+
this.displaySettings.showLocation = overrides.location.show;
|
|
348
|
+
}
|
|
349
|
+
if (overrides.prefix?.show !== undefined) {
|
|
350
|
+
// Will be handled when we integrate with preset system
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// Store customization for use in createStyledOutput
|
|
354
|
+
(this as any)._customization = overrides;
|
|
355
|
+
this.success('Customization applied');
|
|
356
|
+
}
|
|
148
357
|
|
|
149
358
|
/**
|
|
150
|
-
*
|
|
359
|
+
* Access advanced styling API (for power users)
|
|
151
360
|
*/
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
scopedLogger.scopedPrefix = prefix;
|
|
155
|
-
scopedLogger.handlers = [...this.handlers];
|
|
156
|
-
scopedLogger.exportHandler = this.exportHandler;
|
|
157
|
-
return scopedLogger;
|
|
361
|
+
styles(): any {
|
|
362
|
+
return createLogStyleBuilder(this);
|
|
158
363
|
}
|
|
159
364
|
|
|
160
365
|
// ===== HANDLER MANAGEMENT =====
|
|
@@ -202,7 +407,7 @@ export class Logger {
|
|
|
202
407
|
/**
|
|
203
408
|
* Core logging method that handles styling and formatting
|
|
204
409
|
*/
|
|
205
|
-
|
|
410
|
+
protected log(level: LogLevel, ...args: any[]): void {
|
|
206
411
|
if (!this.shouldLog(level)) return;
|
|
207
412
|
|
|
208
413
|
const stackInfo = this.config.enableStackTrace ? parseStackTrace() : null;
|
|
@@ -210,8 +415,15 @@ export class Logger {
|
|
|
210
415
|
const message = args.length > 0 ? String(args[0]) : '';
|
|
211
416
|
const additionalArgs = args.slice(1);
|
|
212
417
|
|
|
213
|
-
// Create styled output
|
|
214
|
-
const [format, ...styles] = createStyledOutput(
|
|
418
|
+
// Create styled output with theme detection and display settings
|
|
419
|
+
const [format, ...styles] = createStyledOutput(
|
|
420
|
+
level,
|
|
421
|
+
LEVEL_STYLES,
|
|
422
|
+
prefix,
|
|
423
|
+
message,
|
|
424
|
+
this.displaySettings.showLocation ? stackInfo : null,
|
|
425
|
+
this.config.autoDetectTheme
|
|
426
|
+
);
|
|
215
427
|
|
|
216
428
|
// Add group indentation
|
|
217
429
|
const groupIndent = ' '.repeat(this.groupDepth);
|
|
@@ -286,7 +498,14 @@ export class Logger {
|
|
|
286
498
|
const additionalArgs = args.slice(1);
|
|
287
499
|
|
|
288
500
|
// Handle success as special case - use info level with success styling
|
|
289
|
-
const [format, ...styles] = createStyledOutput(
|
|
501
|
+
const [format, ...styles] = createStyledOutput(
|
|
502
|
+
'info',
|
|
503
|
+
LEVEL_STYLES,
|
|
504
|
+
prefix,
|
|
505
|
+
message,
|
|
506
|
+
this.displaySettings.showLocation ? stackInfo : null,
|
|
507
|
+
this.config.autoDetectTheme
|
|
508
|
+
);
|
|
290
509
|
|
|
291
510
|
// Override with success styling
|
|
292
511
|
const successStyle = LEVEL_STYLES.success;
|
|
@@ -580,7 +799,6 @@ export const groupEnd = () => defaultLogger.groupEnd();
|
|
|
580
799
|
export const time = (label: string) => defaultLogger.time(label);
|
|
581
800
|
export const timeEnd = (label: string) => defaultLogger.timeEnd(label);
|
|
582
801
|
export const setGlobalPrefix = (prefix: string) => defaultLogger.setGlobalPrefix(prefix);
|
|
583
|
-
export const createScopedLogger = (prefix: string) => defaultLogger.createScopedLogger(prefix);
|
|
584
802
|
export const setVerbosity = (level: Verbosity) => defaultLogger.setVerbosity(level);
|
|
585
803
|
export const addHandler = (handler: ILogHandler) => defaultLogger.addHandler(handler);
|
|
586
804
|
export const setTheme = (theme: ThemeVariant) => defaultLogger.setTheme(theme);
|
|
@@ -591,7 +809,24 @@ export const logWithSVG = (message: string, svgContent?: string, options?: Style
|
|
|
591
809
|
export const logAnimated = (message: string, duration?: number) =>
|
|
592
810
|
defaultLogger.logAnimated(message, duration);
|
|
593
811
|
export const cli = (command: string) => defaultLogger.cli(command);
|
|
812
|
+
export const cleanup = () => defaultLogger.cleanup();
|
|
813
|
+
|
|
814
|
+
// Simplified API exports
|
|
815
|
+
export const preset = (name: string) => defaultLogger.preset(name);
|
|
816
|
+
export const presets = () => defaultLogger.presets();
|
|
817
|
+
export const hideTimestamp = () => defaultLogger.hideTimestamp();
|
|
818
|
+
export const showTimestamp = () => defaultLogger.showTimestamp();
|
|
819
|
+
export const hideLocation = () => defaultLogger.hideLocation();
|
|
820
|
+
export const showLocation = () => defaultLogger.showLocation();
|
|
821
|
+
export const hideBadges = () => defaultLogger.hideBadges();
|
|
822
|
+
export const showBadges = () => defaultLogger.showBadges();
|
|
823
|
+
export const component = (name: string) => defaultLogger.component(name);
|
|
824
|
+
export const api = (name: string) => defaultLogger.api(name);
|
|
825
|
+
export const scope = (name: string) => defaultLogger.scope(name);
|
|
826
|
+
export const customize = (overrides: any) => defaultLogger.customize(overrides);
|
|
827
|
+
export const styles = () => defaultLogger.styles();
|
|
594
828
|
|
|
595
829
|
// Re-export handlers and utilities for backward compatibility
|
|
596
830
|
export { FileLogHandler, RemoteLogHandler, AnalyticsLogHandler, ExportLogHandler } from './handlers/index.js';
|
|
597
|
-
export { StyleBuilder, StylePresets as Styles } from './styling/index.js';
|
|
831
|
+
export { StyleBuilder, StylePresets as Styles } from './styling/index.js';
|
|
832
|
+
export { ScopedLogger, APILogger, ComponentLogger } from './ScopedLogger.js';
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ScopedLogger with badges and contextual logging
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Logger } from './Logger.js';
|
|
6
|
+
import type { LoggerConfig, LogLevel, Verbosity, BannerType, StyleOptions, ILogHandler } from './types/index.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Enhanced scoped logger with badges and simplified API
|
|
10
|
+
*/
|
|
11
|
+
export class ScopedLogger extends Logger {
|
|
12
|
+
private parentLogger: Logger;
|
|
13
|
+
private scopeName: string;
|
|
14
|
+
private badgeList: string[] = [];
|
|
15
|
+
private contextStack: string[] = [];
|
|
16
|
+
|
|
17
|
+
constructor(parentLogger: Logger, scopeName: string, config?: Partial<LoggerConfig>) {
|
|
18
|
+
// Initialize with parent's config plus any overrides
|
|
19
|
+
super({ ...parentLogger.getConfig(), ...config });
|
|
20
|
+
this.parentLogger = parentLogger;
|
|
21
|
+
this.scopeName = scopeName;
|
|
22
|
+
|
|
23
|
+
// Inherit parent's handlers
|
|
24
|
+
const parentHandlers = parentLogger.getHandlers();
|
|
25
|
+
parentHandlers.forEach(handler => this.addHandler(handler));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Add badges to this scoped logger
|
|
30
|
+
*/
|
|
31
|
+
badges(badges: string[]): ScopedLogger {
|
|
32
|
+
this.badgeList = [...badges];
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Add a single badge
|
|
38
|
+
*/
|
|
39
|
+
badge(badge: string): ScopedLogger {
|
|
40
|
+
if (!this.badgeList.includes(badge)) {
|
|
41
|
+
this.badgeList.push(badge);
|
|
42
|
+
}
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Remove badges
|
|
48
|
+
*/
|
|
49
|
+
clearBadges(): ScopedLogger {
|
|
50
|
+
this.badgeList = [];
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Set style preset for this scoped logger
|
|
56
|
+
*/
|
|
57
|
+
style(presetName: string): ScopedLogger {
|
|
58
|
+
this.setTheme(presetName as any); // Will be updated when we implement presets
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Create a temporary context that gets automatically cleaned up
|
|
64
|
+
*/
|
|
65
|
+
context(contextName: string): ContextLogger {
|
|
66
|
+
return new ContextLogger(this, contextName);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Override core logging to include badges
|
|
71
|
+
*/
|
|
72
|
+
protected log(level: LogLevel, ...args: any[]): void {
|
|
73
|
+
// Build the enhanced message with badges
|
|
74
|
+
const badges = this.getBadgeString();
|
|
75
|
+
const scopePrefix = this.getScopePrefix();
|
|
76
|
+
|
|
77
|
+
let enhancedMessage = '';
|
|
78
|
+
if (badges) enhancedMessage += badges + ' ';
|
|
79
|
+
if (scopePrefix) enhancedMessage += `[${scopePrefix}] `;
|
|
80
|
+
|
|
81
|
+
if (args.length > 0) {
|
|
82
|
+
enhancedMessage += String(args[0]);
|
|
83
|
+
// Replace the first argument with our enhanced message
|
|
84
|
+
args[0] = enhancedMessage;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Call parent's log method
|
|
88
|
+
super.log(level, ...args);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get formatted badge string
|
|
93
|
+
*/
|
|
94
|
+
private getBadgeString(): string {
|
|
95
|
+
if (this.badgeList.length === 0) return '';
|
|
96
|
+
return this.badgeList.map(badge => `[${badge}]`).join('');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Get scope prefix (includes context stack)
|
|
101
|
+
*/
|
|
102
|
+
private getScopePrefix(): string {
|
|
103
|
+
const parts = [this.scopeName, ...this.contextStack].filter(Boolean);
|
|
104
|
+
return parts.join(':');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Internal method to push context
|
|
109
|
+
*/
|
|
110
|
+
_pushContext(context: string): void {
|
|
111
|
+
this.contextStack.push(context);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Internal method to pop context
|
|
116
|
+
*/
|
|
117
|
+
_popContext(): void {
|
|
118
|
+
this.contextStack.pop();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* API-specific scoped logger with common API badges
|
|
124
|
+
*/
|
|
125
|
+
export class APILogger extends ScopedLogger {
|
|
126
|
+
constructor(parentLogger: Logger, apiName: string, config?: Partial<LoggerConfig>) {
|
|
127
|
+
super(parentLogger, `API:${apiName}`, config);
|
|
128
|
+
this.badge('API');
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Log slow operations
|
|
133
|
+
*/
|
|
134
|
+
slow(message: string, duration?: number): void {
|
|
135
|
+
this.badge('SLOW');
|
|
136
|
+
const msg = duration ? `${message} (${duration}ms)` : message;
|
|
137
|
+
this.warn(msg);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Log rate limiting
|
|
142
|
+
*/
|
|
143
|
+
rateLimit(message: string): void {
|
|
144
|
+
this.badge('RATE_LIMIT');
|
|
145
|
+
this.warn(message);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Log authentication issues
|
|
150
|
+
*/
|
|
151
|
+
auth(message: string): void {
|
|
152
|
+
this.badge('AUTH');
|
|
153
|
+
this.error(message);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Log deprecation warnings
|
|
158
|
+
*/
|
|
159
|
+
deprecated(message: string): void {
|
|
160
|
+
this.badge('DEPRECATED');
|
|
161
|
+
this.warn(message);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Component-specific scoped logger
|
|
167
|
+
*/
|
|
168
|
+
export class ComponentLogger extends ScopedLogger {
|
|
169
|
+
constructor(parentLogger: Logger, componentName: string, config?: Partial<LoggerConfig>) {
|
|
170
|
+
super(parentLogger, componentName, config);
|
|
171
|
+
this.badge('COMPONENT');
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Log lifecycle events
|
|
176
|
+
*/
|
|
177
|
+
lifecycle(event: string, message?: string): void {
|
|
178
|
+
this.badge('LIFECYCLE');
|
|
179
|
+
const msg = message ? `${event}: ${message}` : event;
|
|
180
|
+
this.info(msg);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Log state changes
|
|
185
|
+
*/
|
|
186
|
+
stateChange(from: string, to: string, data?: any): void {
|
|
187
|
+
this.badge('STATE');
|
|
188
|
+
const msg = `${from} → ${to}`;
|
|
189
|
+
if (data) {
|
|
190
|
+
this.info(msg, data);
|
|
191
|
+
} else {
|
|
192
|
+
this.info(msg);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Log prop changes
|
|
198
|
+
*/
|
|
199
|
+
propsChange(changes: Record<string, any>): void {
|
|
200
|
+
this.badge('PROPS');
|
|
201
|
+
this.debug('Props changed:', changes);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Temporary context logger that auto-cleans up
|
|
207
|
+
*/
|
|
208
|
+
export class ContextLogger {
|
|
209
|
+
private parentLogger: ScopedLogger;
|
|
210
|
+
private contextName: string;
|
|
211
|
+
|
|
212
|
+
constructor(parentLogger: ScopedLogger, contextName: string) {
|
|
213
|
+
this.parentLogger = parentLogger;
|
|
214
|
+
this.contextName = contextName;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Run a function with this context active
|
|
219
|
+
*/
|
|
220
|
+
run<T>(fn: () => T): T {
|
|
221
|
+
this.parentLogger._pushContext(this.contextName);
|
|
222
|
+
try {
|
|
223
|
+
return fn();
|
|
224
|
+
} finally {
|
|
225
|
+
this.parentLogger._popContext();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Run an async function with this context active
|
|
231
|
+
*/
|
|
232
|
+
async runAsync<T>(fn: () => Promise<T>): Promise<T> {
|
|
233
|
+
this.parentLogger._pushContext(this.contextName);
|
|
234
|
+
try {
|
|
235
|
+
return await fn();
|
|
236
|
+
} finally {
|
|
237
|
+
this.parentLogger._popContext();
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Start the context (manual mode)
|
|
243
|
+
*/
|
|
244
|
+
start(): void {
|
|
245
|
+
this.parentLogger._pushContext(this.contextName);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* End the context (manual mode)
|
|
250
|
+
*/
|
|
251
|
+
end(): void {
|
|
252
|
+
this.parentLogger._popContext();
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Delegate logging methods to parent with context
|
|
256
|
+
debug(...args: any[]): void { this.parentLogger.debug(...args); }
|
|
257
|
+
info(...args: any[]): void { this.parentLogger.info(...args); }
|
|
258
|
+
warn(...args: any[]): void { this.parentLogger.warn(...args); }
|
|
259
|
+
error(...args: any[]): void { this.parentLogger.error(...args); }
|
|
260
|
+
success(...args: any[]): void { this.parentLogger.success(...args); }
|
|
261
|
+
critical(...args: any[]): void { this.parentLogger.critical(...args); }
|
|
262
|
+
}
|