@crimsonsunset/jsg-logger 1.7.10 → 1.7.11

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.
Files changed (2) hide show
  1. package/index.js +9 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -13,6 +13,7 @@ import {createCLIFormatter} from './formatters/cli-formatter.js';
13
13
  import {createServerFormatter, getServerConfig} from './formatters/server-formatter.js';
14
14
  import {LogStore} from './stores/log-store.js';
15
15
  import {metaLog, metaWarn, metaError} from './utils/meta-logger.js';
16
+ import packageJson from './package.json' with {type: 'json'};
16
17
 
17
18
  // Check default config for devtools at module load time
18
19
  // This allows bundlers to tree-shake if disabled
@@ -156,6 +157,7 @@ class JSGLogger {
156
157
  // Log initialization success (only on first initialization)
157
158
  if (!JSGLogger._hasLoggedInitialization && this.loggers.core) {
158
159
  this.loggers.core.info('JSG Logger initialized', {
160
+ version: packageJson.version,
159
161
  environment: this.environment,
160
162
  components: components.length,
161
163
  projectName: configManager.getProjectName(),
@@ -185,6 +187,9 @@ class JSGLogger {
185
187
  */
186
188
  initSync(options = {}) {
187
189
  try {
190
+ // Track if this is a reinitialization (already initialized)
191
+ const isReinit = this.initialized;
192
+
188
193
  // Load inline config if provided (sync loading for objects)
189
194
  if (options && Object.keys(options).length > 0) {
190
195
  // Reset to default config for clean reinitialization
@@ -231,9 +236,11 @@ class JSGLogger {
231
236
 
232
237
  this.initialized = true;
233
238
 
234
- // Log initialization success (only on first initialization)
235
- if (!JSGLogger._hasLoggedInitialization && this.loggers.core) {
239
+ // Log initialization success (only on first initialization, not on reinit)
240
+ // This prevents duplicate logs when multiple libraries call getInstanceSync
241
+ if (!JSGLogger._hasLoggedInitialization && !isReinit && this.loggers.core) {
236
242
  this.loggers.core.info('JSG Logger initialized (sync)', {
243
+ version: packageJson.version,
237
244
  environment: this.environment,
238
245
  components: components.length,
239
246
  projectName: configManager.getProjectName(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crimsonsunset/jsg-logger",
3
- "version": "1.7.10",
3
+ "version": "1.7.11",
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",