@crimsonsunset/jsg-logger 1.1.5 โ 1.1.7
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/default-config.json +1 -1
- package/docs/next-session.md +2 -2
- package/docs/roadmap.md +38 -38
- package/examples/advanced-config.json +1 -1
- package/index.js +1 -1
- 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
|
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,14 +340,14 @@ 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
|
|
350
|
+
4. Hardcoded legacy aliases for legacy components
|
|
351
351
|
5. Core component dependency on 'cacp' logger
|
|
352
352
|
6. Config loading path resolution issues
|
|
353
353
|
- ๐ฏ **Phase 9 Planned**: Complete roadmap for making logger truly generic
|
|
@@ -355,7 +355,7 @@ Console filtering updates
|
|
|
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,32 +575,32 @@ 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
586
|
[JSG-LOGGER] Component 'astro-build' not found. Available: cacp, soundcloud, youtube, site-detector, websocket, popup, background, priority-manager, settings, test, siteDetector, priorityManager
|
|
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
|
-
- **10
|
|
603
|
-
- `cacp` (๐ฏ
|
|
601
|
+
- **Hardcoded project name**: โ
`"JSG Logger"`
|
|
602
|
+
- **10 legacy-specific components**:
|
|
603
|
+
- `cacp` (๐ฏ JSG-CORE) - should be generic `core`
|
|
604
604
|
- `soundcloud` (๐ต SoundCloud)
|
|
605
605
|
- `youtube` (๐น YouTube)
|
|
606
606
|
- `site-detector` (๐ SiteDetector)
|
|
@@ -613,7 +613,7 @@ Despite providing a proper `logger-config.json` with Astro-specific components,
|
|
|
613
613
|
|
|
614
614
|
##### **3. Component Schemes Duplication**
|
|
615
615
|
**File:** `/config/component-schemes.js`
|
|
616
|
-
- Duplicates the same 10 hardcoded
|
|
616
|
+
- Duplicates the same 10 hardcoded legacy components
|
|
617
617
|
- Should be empty/minimal by default for generic usage
|
|
618
618
|
|
|
619
619
|
##### **4. Hardcoded Legacy Aliases**
|
|
@@ -627,13 +627,13 @@ this.loggers.priorityManager = this.loggers['priority-manager'];
|
|
|
627
627
|
```javascript
|
|
628
628
|
// Initialization requires 'cacp' component:
|
|
629
629
|
if (this.loggers.cacp) {
|
|
630
|
-
this.loggers.cacp.info('
|
|
630
|
+
this.loggers.cacp.info('JSG Logger initialized', {...});
|
|
631
631
|
}
|
|
632
632
|
```
|
|
633
633
|
|
|
634
634
|
##### **6. Config Loading Path Issue**
|
|
635
635
|
- **Critical**: The logger isn't loading our `logger-config.json` properly
|
|
636
|
-
- Falls back to default
|
|
636
|
+
- Falls back to default legacy config instead of using project-specific configurations
|
|
637
637
|
- **Why our Astro config is ignored**: Path resolution or config merging logic issues
|
|
638
638
|
|
|
639
639
|
#### **๐ง Implementation Plan**
|
|
@@ -660,7 +660,7 @@ if (this.loggers.cacp) {
|
|
|
660
660
|
- `CACPLogger` โ `JSGLogger`
|
|
661
661
|
- Update all static method references
|
|
662
662
|
- Update error messages
|
|
663
|
-
- Update browser global: `window.
|
|
663
|
+
- โ
Update browser global: `window.JSG_Logger`
|
|
664
664
|
|
|
665
665
|
##### **Fix 3: Fix Config Loading**
|
|
666
666
|
**Target**: Config manager and initialization
|
|
@@ -668,7 +668,7 @@ if (this.loggers.cacp) {
|
|
|
668
668
|
- Ensure project configs override defaults instead of falling back
|
|
669
669
|
- Fix path resolution for various environments (Node.js vs browser)
|
|
670
670
|
|
|
671
|
-
##### **Fix 4: Remove
|
|
671
|
+
##### **Fix 4: Remove Legacy-Specific Logic**
|
|
672
672
|
**Target**: `/index.js` `createAliases()` method
|
|
673
673
|
- Remove hardcoded legacy aliases for `siteDetector`, `priorityManager`
|
|
674
674
|
- Make aliases configurable if needed, not hardcoded
|
|
@@ -681,21 +681,21 @@ if (this.loggers.cacp) {
|
|
|
681
681
|
|
|
682
682
|
##### **Fix 6: Clean Component Schemes**
|
|
683
683
|
**Target**: `/config/component-schemes.js`
|
|
684
|
-
- Remove all
|
|
684
|
+
- Remove all legacy-specific hardcoded components
|
|
685
685
|
- Keep only minimal example or make it empty
|
|
686
686
|
- Let projects define their own components
|
|
687
687
|
|
|
688
688
|
#### **๐ฏ Success Criteria**
|
|
689
|
-
1. โ
**Generic by Default**: Fresh installations work without
|
|
689
|
+
1. โ
**Generic by Default**: Fresh installations work without legacy references
|
|
690
690
|
2. โ
**Config Loading Works**: Project-specific `logger-config.json` files are properly loaded
|
|
691
|
-
3. โ
**No
|
|
692
|
-
4. โ
**Clean API**: `JSGLogger.getInstance()`
|
|
691
|
+
3. โ
**No Legacy Dependencies**: Logger works without any legacy-specific components
|
|
692
|
+
4. โ
**Clean API**: `JSGLogger.getInstance()` working correctly
|
|
693
693
|
5. โ
**Test with Real Project**: jsg-tech-check-site loads Astro components correctly
|
|
694
694
|
|
|
695
695
|
#### **๐ Implementation Steps**
|
|
696
696
|
1. **Debug config loading** - Fix why `logger-config.json` is ignored
|
|
697
|
-
2. **Rename core class** - `
|
|
698
|
-
3. **Replace default config** - Remove 10
|
|
697
|
+
2. โ
**Rename core class** - `JSGLogger` completed
|
|
698
|
+
3. **Replace default config** - Remove 10 legacy components, use minimal generic
|
|
699
699
|
4. **Remove hardcoded aliases** - Make legacy aliases configurable
|
|
700
700
|
5. **Fix core component** - Use configurable core for init logging
|
|
701
701
|
6. **Update browser global** - `window.JSG_Logger`
|
package/index.js
CHANGED
package/package.json
CHANGED