@crimsonsunset/jsg-logger 1.1.6 โ 1.2.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/CONTRIBUTING.md +1 -1
- package/README.md +2 -2
- package/config/component-schemes.js +1 -10
- package/config/config-manager.js +1 -1
- package/config/default-config.json +1 -55
- package/docs/next-session.md +2 -2
- package/docs/roadmap.md +52 -56
- package/examples/advanced-config.json +68 -78
- package/formatters/cli-formatter.js +1 -1
- package/index.js +13 -9
- package/package.json +1 -1
package/CONTRIBUTING.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
**This is a personal utility project that has been extracted and published for reuse.**
|
|
6
6
|
|
|
7
7
|
Contributions are welcome, but please note:
|
|
8
|
-
- This project emerged from a specific use case
|
|
8
|
+
- This project emerged from a specific use case but is now a generic multi-environment logger
|
|
9
9
|
- The core functionality is stable and feature-complete for most use cases
|
|
10
10
|
- Major architectural changes should be discussed in an issue first
|
|
11
11
|
|
package/README.md
CHANGED
|
@@ -345,12 +345,12 @@ const stats = logger.controls.getStats();
|
|
|
345
345
|
### **๐ BREAKTHROUGH: Perfect Browser Formatting**
|
|
346
346
|
```
|
|
347
347
|
// Direct browser logger with 100% style control:
|
|
348
|
-
12:00 AM ๐ฏ [
|
|
348
|
+
12:00 AM ๐ฏ [JSG-CORE] โจ JSG Application v1.0.0 - Logger Ready!
|
|
349
349
|
12:00 AM ๐ต [SOUNDCLOUD] MediaSession track change detected
|
|
350
350
|
โโ title: Alt-J - Breezeblocks (Gkat Remix)
|
|
351
351
|
โโ artist: Gkat
|
|
352
352
|
โโ hasArtwork: true
|
|
353
|
-
12:00 AM ๐ฏ [
|
|
353
|
+
12:00 AM ๐ฏ [JSG-CORE] ๐งช Testing JSON context display
|
|
354
354
|
โโ testData: {nested: {...}, simple: 'test string', boolean: true}
|
|
355
355
|
โโ location: {href: 'https://soundcloud.com/discover', hostname: 'soundcloud.com'}
|
|
356
356
|
โโ timestamp: 2025-07-29T06:00:53.837Z
|
|
@@ -4,16 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export const COMPONENT_SCHEME = {
|
|
7
|
-
'
|
|
8
|
-
'soundcloud': { emoji: '๐ต', color: '#FF5500', name: 'SoundCloud' },
|
|
9
|
-
'youtube': { emoji: '๐น', color: '#FF0000', name: 'YouTube' },
|
|
10
|
-
'site-detector': { emoji: '๐', color: '#00C896', name: 'SiteDetector' },
|
|
11
|
-
'websocket': { emoji: '๐', color: '#9B59B6', name: 'WebSocket' },
|
|
12
|
-
'popup': { emoji: '๐๏ธ', color: '#FF6B6B', name: 'Popup' },
|
|
13
|
-
'background': { emoji: '๐ง', color: '#4ECDC4', name: 'Background' },
|
|
14
|
-
'priority-manager': { emoji: 'โ๏ธ', color: '#45B7D1', name: 'PriorityManager' },
|
|
15
|
-
'settings': { emoji: 'โ๏ธ', color: '#96CEB4', name: 'Settings' },
|
|
16
|
-
'test': { emoji: '๐งช', color: '#FFEAA7', name: 'Test' }
|
|
7
|
+
'core': { emoji: '๐ฏ', color: '#8E44AD', name: 'JSG-CORE' }
|
|
17
8
|
};
|
|
18
9
|
|
|
19
10
|
export const LEVEL_SCHEME = {
|
package/config/config-manager.js
CHANGED
|
@@ -406,7 +406,7 @@ export class ConfigManager {
|
|
|
406
406
|
* @returns {Object} Component configuration
|
|
407
407
|
*/
|
|
408
408
|
getComponentConfig(componentName, filePath = null) {
|
|
409
|
-
const baseComponent = this.config.components?.[componentName] || COMPONENT_SCHEME[componentName] || COMPONENT_SCHEME['
|
|
409
|
+
const baseComponent = this.config.components?.[componentName] || COMPONENT_SCHEME[componentName] || COMPONENT_SCHEME['core'];
|
|
410
410
|
|
|
411
411
|
// Check for file-specific overrides
|
|
412
412
|
const checkFile = filePath || this.currentFile;
|
|
@@ -26,65 +26,11 @@
|
|
|
26
26
|
"60": { "name": "FATAL", "emoji": "๐", "color": "#D63031" }
|
|
27
27
|
},
|
|
28
28
|
"components": {
|
|
29
|
-
"
|
|
29
|
+
"core": {
|
|
30
30
|
"emoji": "๐ฏ",
|
|
31
31
|
"color": "#4A90E2",
|
|
32
32
|
"name": "JSG-CORE",
|
|
33
33
|
"level": "info"
|
|
34
|
-
},
|
|
35
|
-
"soundcloud": {
|
|
36
|
-
"emoji": "๐ต",
|
|
37
|
-
"color": "#FF5500",
|
|
38
|
-
"name": "SoundCloud",
|
|
39
|
-
"level": "info"
|
|
40
|
-
},
|
|
41
|
-
"youtube": {
|
|
42
|
-
"emoji": "๐น",
|
|
43
|
-
"color": "#FF0000",
|
|
44
|
-
"name": "YouTube",
|
|
45
|
-
"level": "info"
|
|
46
|
-
},
|
|
47
|
-
"site-detector": {
|
|
48
|
-
"emoji": "๐",
|
|
49
|
-
"color": "#00C896",
|
|
50
|
-
"name": "SiteDetector",
|
|
51
|
-
"level": "info"
|
|
52
|
-
},
|
|
53
|
-
"websocket": {
|
|
54
|
-
"emoji": "๐",
|
|
55
|
-
"color": "#9B59B6",
|
|
56
|
-
"name": "WebSocket",
|
|
57
|
-
"level": "info"
|
|
58
|
-
},
|
|
59
|
-
"popup": {
|
|
60
|
-
"emoji": "๐๏ธ",
|
|
61
|
-
"color": "#FF6B6B",
|
|
62
|
-
"name": "Popup",
|
|
63
|
-
"level": "info"
|
|
64
|
-
},
|
|
65
|
-
"background": {
|
|
66
|
-
"emoji": "๐ง",
|
|
67
|
-
"color": "#4ECDC4",
|
|
68
|
-
"name": "Background",
|
|
69
|
-
"level": "info"
|
|
70
|
-
},
|
|
71
|
-
"priority-manager": {
|
|
72
|
-
"emoji": "โ๏ธ",
|
|
73
|
-
"color": "#45B7D1",
|
|
74
|
-
"name": "PriorityManager",
|
|
75
|
-
"level": "info"
|
|
76
|
-
},
|
|
77
|
-
"settings": {
|
|
78
|
-
"emoji": "โ๏ธ",
|
|
79
|
-
"color": "#96CEB4",
|
|
80
|
-
"name": "Settings",
|
|
81
|
-
"level": "info"
|
|
82
|
-
},
|
|
83
|
-
"test": {
|
|
84
|
-
"emoji": "๐งช",
|
|
85
|
-
"color": "#FFEAA7",
|
|
86
|
-
"name": "Test",
|
|
87
|
-
"level": "debug"
|
|
88
34
|
}
|
|
89
35
|
},
|
|
90
36
|
"fileOverrides": {
|
package/docs/next-session.md
CHANGED
|
@@ -68,10 +68,10 @@
|
|
|
68
68
|
**Solution**: Build essential patterns directly into the JSG Logger package
|
|
69
69
|
|
|
70
70
|
### **โ
COMPLETED THIS SESSION:**
|
|
71
|
-
- [x] **Static Singleton Pattern** - `
|
|
71
|
+
- [x] **Static Singleton Pattern** - `JSGLogger.getInstance()` methods
|
|
72
72
|
- [x] **Auto-Discovery Getters** - Both camelCase and kebab-case component access
|
|
73
73
|
- [x] **Non-Destructive Error Handling** - Missing components log but don't break
|
|
74
|
-
- [x] **Static Performance Logging** - `
|
|
74
|
+
- [x] **Static Performance Logging** - `JSGLogger.logPerformance()` utility
|
|
75
75
|
- [x] **Enhanced Export Structure** - Components and getComponent available
|
|
76
76
|
|
|
77
77
|
### **โ
PHASE 8 API ENHANCEMENT COMPLETE:**
|
package/docs/roadmap.md
CHANGED
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
|
|
22
22
|
## ๐ฏ Current Status
|
|
23
23
|
**Last Updated:** August 21, 2025
|
|
24
|
-
**Current Phase:** Phase 9 - Genericize Logger (Remove
|
|
25
|
-
**Status:** ๐ **IN PROGRESS** - Making JSG Logger truly generic by removing
|
|
26
|
-
**Current Issue:** Logger still loads
|
|
24
|
+
**Current Phase:** Phase 9 - Genericize Logger (Remove Legacy Hardcoding)
|
|
25
|
+
**Status:** ๐ **IN PROGRESS** - Making JSG Logger truly generic by removing legacy-specific hardcoded components
|
|
26
|
+
**Current Issue:** Logger still loads legacy defaults instead of project-specific `logger-config.json` files
|
|
27
27
|
|
|
28
28
|
### Progress Overview
|
|
29
29
|
- โ
**COMPLETED:** Multi-environment logger with smart detection
|
|
@@ -340,22 +340,22 @@ Console filtering updates
|
|
|
340
340
|
|
|
341
341
|
## ๐ Recent Progress
|
|
342
342
|
|
|
343
|
-
### August 21, 2025 - Phase 9 Discovery:
|
|
344
|
-
- ๐ **Critical Discovery**: JSG Logger still deeply hardcoded for
|
|
345
|
-
- ๐ **Issue Identified**: `logger-config.json` files being ignored, falling back to
|
|
343
|
+
### August 21, 2025 - Phase 9 Discovery: Legacy Hardcoding Issues ๐
|
|
344
|
+
- ๐ **Critical Discovery**: JSG Logger still deeply hardcoded for legacy use cases
|
|
345
|
+
- ๐ **Issue Identified**: `logger-config.json` files being ignored, falling back to legacy defaults
|
|
346
346
|
- ๐ **Root Causes Documented**: 6 major areas requiring genericization
|
|
347
|
-
1. `
|
|
348
|
-
2. Default config with 10 hardcoded
|
|
347
|
+
1. `JSGLogger` class name and all references โ
COMPLETED
|
|
348
|
+
2. Default config with 10 hardcoded legacy components
|
|
349
349
|
3. Component schemes duplication
|
|
350
|
-
4. Hardcoded legacy aliases for
|
|
351
|
-
5. Core component dependency on '
|
|
350
|
+
4. Hardcoded legacy aliases for legacy components
|
|
351
|
+
5. โ
Core component dependency on 'core' logger
|
|
352
352
|
6. Config loading path resolution issues
|
|
353
353
|
- ๐ฏ **Phase 9 Planned**: Complete roadmap for making logger truly generic
|
|
354
354
|
- โ
**Testing Successful**: JSG Logger v1.1.0 API features work, but components wrong
|
|
355
355
|
|
|
356
356
|
### August 21, 2025 - Phase 8 API Enhancement Complete โ
|
|
357
357
|
- โ
**JSG Logger v1.1.0** - Major API simplification enhancements shipped
|
|
358
|
-
- โ
**Static Singleton Pattern** - `
|
|
358
|
+
- โ
**Static Singleton Pattern** - `JSGLogger.getInstance()` with auto-initialization
|
|
359
359
|
- โ
**Auto-Discovery Components** - Both camelCase and kebab-case access patterns
|
|
360
360
|
- โ
**Non-Destructive Error Handling** - Missing components log but don't break apps
|
|
361
361
|
- โ
**Built-in Performance Logging** - `JSGLogger.logPerformance()` static utility
|
|
@@ -433,7 +433,7 @@ Projects using JSG Logger currently need to implement ~220 lines of boilerplate:
|
|
|
433
433
|
#### **Solution - Built-in Enhancement Features**
|
|
434
434
|
|
|
435
435
|
**โ
Design Decisions Made:**
|
|
436
|
-
1. **getInstance location**: Static on
|
|
436
|
+
1. **getInstance location**: Static on JSGLogger class
|
|
437
437
|
2. **Auto-discovery naming**: Both camelCase and kebab-case support
|
|
438
438
|
3. **Performance logging**: Static utility `JSGLogger.logPerformance(...)`
|
|
439
439
|
4. **Error handling**: Non-destructive with helpful logging (no fallbacks)
|
|
@@ -444,12 +444,12 @@ Projects using JSG Logger currently need to implement ~220 lines of boilerplate:
|
|
|
444
444
|
|
|
445
445
|
##### **Enhancement 1: Static Singleton Pattern**
|
|
446
446
|
```javascript
|
|
447
|
-
// Static method on
|
|
448
|
-
const logger =
|
|
449
|
-
const logger2 =
|
|
447
|
+
// Static method on JSGLogger class
|
|
448
|
+
const logger = JSGLogger.getInstance(config);
|
|
449
|
+
const logger2 = JSGLogger.getInstance(); // Same instance, no config needed
|
|
450
450
|
```
|
|
451
451
|
|
|
452
|
-
**Implementation Location**: `index.js`
|
|
452
|
+
**Implementation Location**: `index.js` JSGLogger class
|
|
453
453
|
- Add `static _instance = null`
|
|
454
454
|
- Add `static async getInstance(options = {})`
|
|
455
455
|
- Add `static getInstanceSync(options = {})` for sync environments
|
|
@@ -575,65 +575,61 @@ export { logger, JSGLogger };
|
|
|
575
575
|
|
|
576
576
|
---
|
|
577
577
|
|
|
578
|
-
### **Phase 9: Genericize Logger (Remove
|
|
579
|
-
**Goal**: Make JSG Logger truly generic by removing all
|
|
578
|
+
### **Phase 9: Genericize Logger (Remove Legacy Hardcoding)** ๐ IN PROGRESS
|
|
579
|
+
**Goal**: Make JSG Logger truly generic by removing all legacy-specific hardcoded components and references
|
|
580
580
|
|
|
581
581
|
#### **Background - The Problem**
|
|
582
|
-
During Phase 8 integration testing with jsg-tech-check-site, we discovered the logger is still deeply hardcoded for
|
|
582
|
+
During Phase 8 integration testing with jsg-tech-check-site, we discovered the logger is still deeply hardcoded for legacy use cases:
|
|
583
583
|
|
|
584
584
|
**Observable Issues:**
|
|
585
585
|
```
|
|
586
|
-
[JSG-LOGGER] Component 'astro-build' not found. Available:
|
|
586
|
+
[JSG-LOGGER] Component 'astro-build' not found. Available: core
|
|
587
587
|
```
|
|
588
588
|
|
|
589
|
-
Despite providing a proper `logger-config.json` with Astro-specific components, the logger falls back to
|
|
589
|
+
Despite providing a proper `logger-config.json` with Astro-specific components, the logger falls back to legacy defaults instead of loading the project's configuration.
|
|
590
590
|
|
|
591
|
-
#### **Root Causes - What Makes It
|
|
591
|
+
#### **Root Causes - What Makes It Legacy-Specific**
|
|
592
592
|
|
|
593
593
|
##### **1. Class Name & Core References**
|
|
594
|
-
- `
|
|
595
|
-
- All static method references (`
|
|
596
|
-
- Error messages mentioning "
|
|
597
|
-
- `window.
|
|
594
|
+
- โ
`JSGLogger` class name updated
|
|
595
|
+
- โ
All static method references (`JSGLogger.getInstance()`, etc.)
|
|
596
|
+
- โ
Error messages mentioning "JSG Logger"
|
|
597
|
+
- โ
`window.JSG_Logger` global updated
|
|
598
598
|
|
|
599
599
|
##### **2. Default Configuration Hardcoding**
|
|
600
600
|
**File:** `/config/default-config.json`
|
|
601
|
-
- **Hardcoded project name**: `"
|
|
602
|
-
- **
|
|
603
|
-
|
|
604
|
-
- `soundcloud` (๐ต SoundCloud)
|
|
605
|
-
- `youtube` (๐น YouTube)
|
|
606
|
-
- `site-detector` (๐ SiteDetector)
|
|
607
|
-
- `websocket` (๐ WebSocket)
|
|
608
|
-
- `popup` (๐๏ธ Popup)
|
|
609
|
-
- `background` (๐ง Background)
|
|
610
|
-
- `priority-manager` (โ๏ธ PriorityManager)
|
|
611
|
-
- `settings` (โ๏ธ Settings)
|
|
612
|
-
- `test` (๐งช Test)
|
|
601
|
+
- **Hardcoded project name**: โ
`"JSG Logger"`
|
|
602
|
+
- โ
**Minimal generic components**: Only `core` component by default
|
|
603
|
+
- โ
**Projects define their own**: Components specified in project config files
|
|
613
604
|
|
|
614
605
|
##### **3. Component Schemes Duplication**
|
|
615
606
|
**File:** `/config/component-schemes.js`
|
|
616
|
-
- Duplicates the same 10 hardcoded
|
|
607
|
+
- Duplicates the same 10 hardcoded legacy components
|
|
617
608
|
- Should be empty/minimal by default for generic usage
|
|
618
609
|
|
|
619
610
|
##### **4. Hardcoded Legacy Aliases**
|
|
620
611
|
```javascript
|
|
621
612
|
// In createAliases() method:
|
|
622
|
-
|
|
623
|
-
this.loggers.
|
|
613
|
+
// Auto-generate camelCase aliases for kebab-case components
|
|
614
|
+
Object.keys(this.loggers).forEach(componentName => {
|
|
615
|
+
if (componentName.includes('-')) {
|
|
616
|
+
const camelCase = componentName.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
617
|
+
this.loggers[camelCase] = this.loggers[componentName];
|
|
618
|
+
}
|
|
619
|
+
});
|
|
624
620
|
```
|
|
625
621
|
|
|
626
622
|
##### **5. Core Component Dependency**
|
|
627
623
|
```javascript
|
|
628
|
-
// Initialization
|
|
629
|
-
if (this.loggers.
|
|
630
|
-
this.loggers.
|
|
624
|
+
// Initialization uses 'core' component:
|
|
625
|
+
if (this.loggers.core) {
|
|
626
|
+
this.loggers.core.info('JSG Logger initialized', {...});
|
|
631
627
|
}
|
|
632
628
|
```
|
|
633
629
|
|
|
634
630
|
##### **6. Config Loading Path Issue**
|
|
635
631
|
- **Critical**: The logger isn't loading our `logger-config.json` properly
|
|
636
|
-
- Falls back to default
|
|
632
|
+
- Falls back to default legacy config instead of using project-specific configurations
|
|
637
633
|
- **Why our Astro config is ignored**: Path resolution or config merging logic issues
|
|
638
634
|
|
|
639
635
|
#### **๐ง Implementation Plan**
|
|
@@ -657,10 +653,10 @@ if (this.loggers.cacp) {
|
|
|
657
653
|
|
|
658
654
|
##### **Fix 2: Rename Core Class**
|
|
659
655
|
**Target**: `/index.js`
|
|
660
|
-
- `
|
|
656
|
+
- โ
`JSGLogger` class renamed
|
|
661
657
|
- Update all static method references
|
|
662
658
|
- Update error messages
|
|
663
|
-
- Update browser global: `window.
|
|
659
|
+
- โ
Update browser global: `window.JSG_Logger`
|
|
664
660
|
|
|
665
661
|
##### **Fix 3: Fix Config Loading**
|
|
666
662
|
**Target**: Config manager and initialization
|
|
@@ -668,34 +664,34 @@ if (this.loggers.cacp) {
|
|
|
668
664
|
- Ensure project configs override defaults instead of falling back
|
|
669
665
|
- Fix path resolution for various environments (Node.js vs browser)
|
|
670
666
|
|
|
671
|
-
##### **Fix 4: Remove
|
|
667
|
+
##### **Fix 4: Remove Legacy-Specific Logic**
|
|
672
668
|
**Target**: `/index.js` `createAliases()` method
|
|
673
|
-
- Remove hardcoded legacy aliases
|
|
669
|
+
- โ
Remove hardcoded legacy aliases, use generic camelCase generation
|
|
674
670
|
- Make aliases configurable if needed, not hardcoded
|
|
675
671
|
|
|
676
672
|
##### **Fix 5: Use Configurable Core Component**
|
|
677
673
|
**Target**: Initialization logging
|
|
678
|
-
- Replace `this.loggers.
|
|
674
|
+
- โ
Replace `this.loggers.core.info()` with generic core component
|
|
679
675
|
- Use `this.loggers.core` or first available component
|
|
680
676
|
- Graceful fallback if no components configured
|
|
681
677
|
|
|
682
678
|
##### **Fix 6: Clean Component Schemes**
|
|
683
679
|
**Target**: `/config/component-schemes.js`
|
|
684
|
-
- Remove all
|
|
680
|
+
- Remove all legacy-specific hardcoded components
|
|
685
681
|
- Keep only minimal example or make it empty
|
|
686
682
|
- Let projects define their own components
|
|
687
683
|
|
|
688
684
|
#### **๐ฏ Success Criteria**
|
|
689
|
-
1. โ
**Generic by Default**: Fresh installations work without
|
|
685
|
+
1. โ
**Generic by Default**: Fresh installations work without legacy references
|
|
690
686
|
2. โ
**Config Loading Works**: Project-specific `logger-config.json` files are properly loaded
|
|
691
|
-
3. โ
**No
|
|
692
|
-
4. โ
**Clean API**: `JSGLogger.getInstance()`
|
|
687
|
+
3. โ
**No Legacy Dependencies**: Logger works without any legacy-specific components
|
|
688
|
+
4. โ
**Clean API**: `JSGLogger.getInstance()` working correctly
|
|
693
689
|
5. โ
**Test with Real Project**: jsg-tech-check-site loads Astro components correctly
|
|
694
690
|
|
|
695
691
|
#### **๐ Implementation Steps**
|
|
696
692
|
1. **Debug config loading** - Fix why `logger-config.json` is ignored
|
|
697
|
-
2. **Rename core class** - `
|
|
698
|
-
3. **Replace default config** -
|
|
693
|
+
2. โ
**Rename core class** - `JSGLogger` completed
|
|
694
|
+
3. โ
**Replace default config** - Minimal generic with only 'core' component
|
|
699
695
|
4. **Remove hardcoded aliases** - Make legacy aliases configurable
|
|
700
696
|
5. **Fix core component** - Use configurable core for init logging
|
|
701
697
|
6. **Update browser global** - `window.JSG_Logger`
|
|
@@ -11,141 +11,131 @@
|
|
|
11
11
|
"timestamp": true,
|
|
12
12
|
"emoji": true,
|
|
13
13
|
"component": true,
|
|
14
|
-
"level":
|
|
14
|
+
"level": true,
|
|
15
15
|
"message": true,
|
|
16
16
|
"jsonPayload": true,
|
|
17
17
|
"stackTrace": true
|
|
18
18
|
},
|
|
19
19
|
"components": {
|
|
20
|
-
"
|
|
20
|
+
"core": {
|
|
21
21
|
"emoji": "๐ฏ",
|
|
22
22
|
"color": "#4A90E2",
|
|
23
23
|
"name": "JSG-CORE",
|
|
24
24
|
"level": "debug"
|
|
25
25
|
},
|
|
26
|
-
"
|
|
27
|
-
"emoji": "
|
|
26
|
+
"api": {
|
|
27
|
+
"emoji": "๐",
|
|
28
28
|
"color": "#FF5500",
|
|
29
|
-
"name": "
|
|
29
|
+
"name": "API",
|
|
30
30
|
"level": "trace"
|
|
31
31
|
},
|
|
32
|
-
"
|
|
33
|
-
"emoji": "
|
|
32
|
+
"database": {
|
|
33
|
+
"emoji": "๐พ",
|
|
34
34
|
"color": "#FF0000",
|
|
35
|
-
"name": "
|
|
35
|
+
"name": "Database",
|
|
36
36
|
"level": "info"
|
|
37
37
|
},
|
|
38
|
-
"
|
|
39
|
-
"emoji": "
|
|
38
|
+
"auth": {
|
|
39
|
+
"emoji": "๐",
|
|
40
40
|
"color": "#00C896",
|
|
41
|
-
"name": "
|
|
41
|
+
"name": "Auth",
|
|
42
42
|
"level": "debug"
|
|
43
43
|
},
|
|
44
|
-
"
|
|
45
|
-
"emoji": "
|
|
44
|
+
"utils": {
|
|
45
|
+
"emoji": "๐ ๏ธ",
|
|
46
46
|
"color": "#9B59B6",
|
|
47
|
-
"name": "
|
|
47
|
+
"name": "Utils",
|
|
48
48
|
"level": "warn"
|
|
49
49
|
},
|
|
50
|
-
"
|
|
51
|
-
"emoji": "
|
|
50
|
+
"ui": {
|
|
51
|
+
"emoji": "๐จ",
|
|
52
52
|
"color": "#FF6B6B",
|
|
53
|
-
"name": "
|
|
54
|
-
"level": "debug"
|
|
55
|
-
},
|
|
56
|
-
"background": {
|
|
57
|
-
"emoji": "๐ง",
|
|
58
|
-
"color": "#4ECDC4",
|
|
59
|
-
"name": "Background",
|
|
53
|
+
"name": "UI",
|
|
60
54
|
"level": "info"
|
|
61
55
|
},
|
|
62
|
-
"
|
|
63
|
-
"emoji": "โ๏ธ",
|
|
64
|
-
"color": "#45B7D1",
|
|
65
|
-
"name": "PriorityManager",
|
|
66
|
-
"level": "warn"
|
|
67
|
-
},
|
|
68
|
-
"settings": {
|
|
56
|
+
"service": {
|
|
69
57
|
"emoji": "โ๏ธ",
|
|
70
|
-
"color": "#
|
|
71
|
-
"name": "
|
|
72
|
-
"level": "
|
|
58
|
+
"color": "#4ECDC4",
|
|
59
|
+
"name": "Service",
|
|
60
|
+
"level": "error"
|
|
73
61
|
},
|
|
74
62
|
"test": {
|
|
75
63
|
"emoji": "๐งช",
|
|
76
64
|
"color": "#FFEAA7",
|
|
77
65
|
"name": "Test",
|
|
78
|
-
"level": "
|
|
66
|
+
"level": "debug"
|
|
79
67
|
}
|
|
80
68
|
},
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"component": "soundcloud",
|
|
85
|
-
"emoji": "๐ต",
|
|
69
|
+
"environments": {
|
|
70
|
+
"development": {
|
|
71
|
+
"globalLevel": "debug",
|
|
86
72
|
"display": {
|
|
87
|
-
"timestamp": true,
|
|
88
|
-
"emoji": true,
|
|
89
|
-
"component": true,
|
|
90
73
|
"level": true,
|
|
91
|
-
"
|
|
92
|
-
"jsonPayload": true,
|
|
74
|
+
"timestamp": true,
|
|
93
75
|
"stackTrace": true
|
|
76
|
+
},
|
|
77
|
+
"components": {
|
|
78
|
+
"api": "trace",
|
|
79
|
+
"database": "debug",
|
|
80
|
+
"auth": "trace"
|
|
94
81
|
}
|
|
95
82
|
},
|
|
96
|
-
"
|
|
97
|
-
"
|
|
83
|
+
"test": {
|
|
84
|
+
"globalLevel": "warn",
|
|
98
85
|
"display": {
|
|
99
|
-
"
|
|
86
|
+
"emoji": false,
|
|
87
|
+
"timestamp": false
|
|
88
|
+
},
|
|
89
|
+
"components": {
|
|
90
|
+
"test": "trace",
|
|
91
|
+
"api": "debug"
|
|
100
92
|
}
|
|
101
93
|
},
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"emoji": "๐๏ธ",
|
|
105
|
-
"timestampMode": "relative",
|
|
94
|
+
"production": {
|
|
95
|
+
"globalLevel": "error",
|
|
106
96
|
"display": {
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"
|
|
97
|
+
"emoji": false,
|
|
98
|
+
"component": false,
|
|
99
|
+
"stackTrace": false
|
|
100
|
+
},
|
|
101
|
+
"components": {
|
|
102
|
+
"core": "warn",
|
|
103
|
+
"auth": "info",
|
|
104
|
+
"api": "warn"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"fileOverrides": {
|
|
109
|
+
"src/api/auth.js": {
|
|
110
|
+
"level": "trace",
|
|
111
|
+
"component": "auth",
|
|
112
|
+
"description": "Debug auth endpoints",
|
|
113
|
+
"display": {
|
|
114
|
+
"jsonPayload": true,
|
|
113
115
|
"stackTrace": true
|
|
114
116
|
}
|
|
115
117
|
},
|
|
116
|
-
"src/
|
|
118
|
+
"src/database/*.js": {
|
|
119
|
+
"level": "debug",
|
|
120
|
+
"component": "database",
|
|
121
|
+
"description": "Database operations debugging"
|
|
122
|
+
},
|
|
123
|
+
"src/ui/components/**": {
|
|
117
124
|
"level": "info",
|
|
125
|
+
"component": "ui",
|
|
126
|
+
"description": "UI component lifecycle",
|
|
118
127
|
"display": {
|
|
119
128
|
"jsonPayload": false,
|
|
120
129
|
"stackTrace": false
|
|
121
130
|
}
|
|
122
131
|
},
|
|
123
|
-
"src/
|
|
132
|
+
"src/core.js": {
|
|
124
133
|
"level": "debug",
|
|
125
134
|
"emoji": "๐ฏ",
|
|
126
135
|
"display": {
|
|
127
136
|
"level": true,
|
|
128
137
|
"jsonPayload": true
|
|
129
138
|
}
|
|
130
|
-
},
|
|
131
|
-
"src/sites/youtube.js": {
|
|
132
|
-
"level": "info",
|
|
133
|
-
"emoji": "๐น",
|
|
134
|
-
"timestampMode": "readable",
|
|
135
|
-
"display": {
|
|
136
|
-
"timestamp": true,
|
|
137
|
-
"jsonPayload": false
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
"src/test-*.js": {
|
|
141
|
-
"level": "trace",
|
|
142
|
-
"emoji": "๐งช",
|
|
143
|
-
"timestampMode": "disable",
|
|
144
|
-
"display": {
|
|
145
|
-
"timestamp": false,
|
|
146
|
-
"level": true,
|
|
147
|
-
"jsonPayload": true
|
|
148
|
-
}
|
|
149
139
|
}
|
|
150
140
|
}
|
|
151
141
|
}
|
|
@@ -25,7 +25,7 @@ export const createCLIFormatter = () => {
|
|
|
25
25
|
const log = JSON.parse(chunk);
|
|
26
26
|
|
|
27
27
|
// Get component info
|
|
28
|
-
const component = COMPONENT_SCHEME[log.name] || COMPONENT_SCHEME['
|
|
28
|
+
const component = COMPONENT_SCHEME[log.name] || COMPONENT_SCHEME['core'];
|
|
29
29
|
const componentName = component.name.toUpperCase().replace(/([a-z])([A-Z])/g, '$1-$2');
|
|
30
30
|
|
|
31
31
|
// Get level info
|
package/index.js
CHANGED
|
@@ -86,8 +86,8 @@ class JSGLogger {
|
|
|
86
86
|
this.initialized = true;
|
|
87
87
|
|
|
88
88
|
// Log initialization success
|
|
89
|
-
if (this.loggers.
|
|
90
|
-
this.loggers.
|
|
89
|
+
if (this.loggers.core) {
|
|
90
|
+
this.loggers.core.info('JSG Logger initialized', {
|
|
91
91
|
environment: this.environment,
|
|
92
92
|
components: components.length,
|
|
93
93
|
projectName: configManager.getProjectName(),
|
|
@@ -129,8 +129,8 @@ class JSGLogger {
|
|
|
129
129
|
this.initialized = true;
|
|
130
130
|
|
|
131
131
|
// Log initialization success
|
|
132
|
-
if (this.loggers.
|
|
133
|
-
this.loggers.
|
|
132
|
+
if (this.loggers.core) {
|
|
133
|
+
this.loggers.core.info('JSG Logger initialized (sync)', {
|
|
134
134
|
environment: this.environment,
|
|
135
135
|
components: components.length,
|
|
136
136
|
projectName: configManager.getProjectName(),
|
|
@@ -184,13 +184,17 @@ class JSGLogger {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
/**
|
|
187
|
-
* Create
|
|
187
|
+
* Create component aliases (for camelCase/kebab-case compatibility)
|
|
188
188
|
* @private
|
|
189
189
|
*/
|
|
190
190
|
createAliases() {
|
|
191
|
-
//
|
|
192
|
-
this.loggers.
|
|
193
|
-
|
|
191
|
+
// Auto-generate camelCase aliases for kebab-case component names
|
|
192
|
+
Object.keys(this.loggers).forEach(componentName => {
|
|
193
|
+
if (componentName.includes('-')) {
|
|
194
|
+
const camelCase = componentName.replace(/-([a-z])/g, (match, letter) => letter.toUpperCase());
|
|
195
|
+
this.loggers[camelCase] = this.loggers[componentName];
|
|
196
|
+
}
|
|
197
|
+
});
|
|
194
198
|
}
|
|
195
199
|
|
|
196
200
|
/**
|
|
@@ -428,7 +432,7 @@ class JSGLogger {
|
|
|
428
432
|
};
|
|
429
433
|
|
|
430
434
|
return {
|
|
431
|
-
|
|
435
|
+
core: fallback,
|
|
432
436
|
createLogger: () => fallback,
|
|
433
437
|
config: {environment: 'fallback'},
|
|
434
438
|
logStore: {getRecent: () => [], clear: () => {}},
|
package/package.json
CHANGED