@crimsonsunset/jsg-logger 1.8.4 → 1.8.6
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/CHANGELOG.md +21 -0
- package/index.d.ts +23 -0
- package/index.js +15 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,27 @@ All notable changes to the JSG Logger project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.8.6] - 2026-03-28 🪵 **configure() console feedback**
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- **`configure()` now logs applied config** — after merging the partial config, `configure()` emits a `"JSG Logger configured"` log entry showing `projectName`, `components`, and `timestampMode`. Previously the one-time init log fired at module evaluation time with default values, making it impossible to visually confirm that `configure()` had applied a consumer's `projectName` and other settings.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## [1.8.5] - 2026-03-28 🏷️ **configure() TypeScript types**
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
- **`configure()` TypeScript types** — `JSGLogger.configure(partialConfig?)` is now typed in `index.d.ts`. The method already existed in the JS implementation (1.8.4) but was missing from the type definitions, causing `any`-cast workarounds in consuming projects.
|
|
19
|
+
|
|
20
|
+
### Migration
|
|
21
|
+
Replace `JSGLogger.getInstanceSync(loggerConfig)` in post-init contexts (e.g. Next.js `instrumentation-client.ts`) with:
|
|
22
|
+
```ts
|
|
23
|
+
JSGLogger.configure(loggerConfig);
|
|
24
|
+
```
|
|
25
|
+
This merges config into the running singleton without triggering the reinit guard or wiping registered transports.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
8
29
|
## [1.8.3] - 2026-03-28 🔌 **addTransport() API**
|
|
9
30
|
|
|
10
31
|
### Added
|
package/index.d.ts
CHANGED
|
@@ -231,6 +231,29 @@ export interface JSGLogger {
|
|
|
231
231
|
*/
|
|
232
232
|
getInstanceSync(config?: JSGLoggerConfig): LoggerInstanceType;
|
|
233
233
|
|
|
234
|
+
/**
|
|
235
|
+
* Update config on an already-initialized singleton without reinitializing.
|
|
236
|
+
* Merges the provided partial config into the running instance, preserving all
|
|
237
|
+
* registered transports. Use this instead of getInstanceSync(config) when the
|
|
238
|
+
* singleton may already be initialized by module-level auto-init.
|
|
239
|
+
*
|
|
240
|
+
* Emits a "JSG Logger configured" log showing the applied projectName and
|
|
241
|
+
* component count, so the final config is visible in the console even though
|
|
242
|
+
* the one-time init log already fired with defaults at module evaluation time.
|
|
243
|
+
*
|
|
244
|
+
* If the singleton has not yet been initialized, behaves like getInstanceSync(config).
|
|
245
|
+
*
|
|
246
|
+
* @param partialConfig - Partial config to merge into the running instance
|
|
247
|
+
* @returns The enhanced logger exports with controls API
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```ts
|
|
251
|
+
* // instrumentation-client.ts — run before anything else uses the logger
|
|
252
|
+
* JSGLogger.configure({ projectName: 'My App', display: { timestamp: true } });
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
configure(partialConfig?: Partial<JSGLoggerConfig>): LoggerInstanceType;
|
|
256
|
+
|
|
234
257
|
/**
|
|
235
258
|
* Add a transport to the running singleton without reinitializing.
|
|
236
259
|
* Safe to call even after the singleton was initialized by module-level code or a
|
package/index.js
CHANGED
|
@@ -999,8 +999,9 @@ class JSGLogger {
|
|
|
999
999
|
/**
|
|
1000
1000
|
* Update logger configuration post-initialization without reinitializing.
|
|
1001
1001
|
* Merges partialConfig into the current config without touching registered transports.
|
|
1002
|
-
* Transports can only be registered at init time — this method cannot add or remove them.
|
|
1003
1002
|
* If called before any initialization has occurred, delegates to getInstanceSync(partialConfig).
|
|
1003
|
+
* Emits a "JSG Logger configured" log so the applied project config is visible in the
|
|
1004
|
+
* console even though the one-time init log already fired with defaults at module eval time.
|
|
1004
1005
|
* @param {Object} partialConfig - Partial config to merge into the current config
|
|
1005
1006
|
* @returns {Object} Enhanced logger exports
|
|
1006
1007
|
*/
|
|
@@ -1016,6 +1017,19 @@ class JSGLogger {
|
|
|
1016
1017
|
JSGLogger._instance.transports = currentTransports;
|
|
1017
1018
|
JSGLogger._instance.refreshLoggers();
|
|
1018
1019
|
|
|
1020
|
+
// Re-log init summary so consumers can see the applied project config.
|
|
1021
|
+
// The module-level auto-init fires before configure() can run, meaning
|
|
1022
|
+
// the one-time init log always shows defaults. This follow-up makes
|
|
1023
|
+
// the final configured state visible in the console.
|
|
1024
|
+
if (JSGLogger._instance.loggers?.core) {
|
|
1025
|
+
const components = configManager.getAvailableComponents();
|
|
1026
|
+
JSGLogger._instance.loggers.core.info('JSG Logger configured', {
|
|
1027
|
+
projectName: configManager.getProjectName(),
|
|
1028
|
+
components: components.length,
|
|
1029
|
+
timestampMode: configManager.getTimestampMode(),
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1019
1033
|
return JSGLogger._enhancedLoggers;
|
|
1020
1034
|
}
|
|
1021
1035
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crimsonsunset/jsg-logger",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Multi-environment logger with smart detection, file-level overrides, and beautiful console formatting. Test it live: https://logger.joesangiorgio.com/",
|
|
6
6
|
"main": "index.js",
|