syntropylog 0.9.5 → 0.9.8

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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Security & Architecture: Completely removed `process.env` dependencies. Configuration like environment specific routing or config file paths are now explicitly passed into `loadLoggerConfig()` or `syntropyLog.init()`. This guarantees the library never sniffs environment variables on its own.
8
+
9
+ ## 0.9.7
10
+
11
+ ### Patch Changes
12
+
13
+ - Security: Refactored dynamic environment variable access to static access where possible, and documented env usage in README to resolve Socket.dev "Environment Variable Access" alerts.
14
+ Fixed: Addressed lingering missing configurations in examples causing TS lint errors.
15
+
16
+ ## 0.9.6
17
+
18
+ ### Patch Changes
19
+
20
+ - Security: Removed example IPs and URLs (e.g. 192.168.1.1, example.com) from source code, tests, and documentation to resolve Socket.dev supply chain security warnings.
21
+ Docs: Updated test coverage badge to 92.48%.
22
+
3
23
  All notable changes to this project will be documented in this file.
4
24
 
5
25
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@@ -8,21 +28,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
28
  ## [0.9.5] - 2026-03-07
9
29
 
10
30
  ### 🔧 Maintenance
31
+
11
32
  - **License**: Fixed placeholder text in LICENSE file.
12
33
  - **Contributors**: Added Andres Pacheco as a contributor in package.json.
13
34
 
14
35
  ## [0.9.4] - 2026-03-07
15
36
 
16
37
  ### 🔧 Maintenance
38
+
17
39
  - **Security**: Excluded `docs/` folder from npm package to resolve false positive security alerts in Socket.dev regarding example URLs.
18
40
 
19
41
  ## [0.9.3] - 2026-03-07
20
42
 
21
43
  ### 📝 Documentation
44
+
22
45
  - **README intro**: Added to the "What is SyntropyLog?" list the ability to **add, remove, or override transports on demand** per log call (`.override()`, `.add()`, `.remove()`), without creating new logger instances.
23
46
  - **package.json**: Added `funding` field for open-source visibility.
24
47
 
25
48
  ### 🔧 Maintenance
49
+
26
50
  - No breaking changes. Patch release for documentation and second publication.
27
51
 
28
52
  ---
@@ -30,27 +54,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
30
54
  ## [0.9.2] - 2026-03-04
31
55
 
32
56
  ### ⚠️ Breaking changes
57
+
33
58
  - **HTTP and Brokers removed from main config and API**: The top-level config keys `http` and `brokers` are no longer accepted in `syntropyLog.init()`. The public methods `getHttp(name)` and `getBroker(name)` have been removed from `SyntropyLog`. Redis remains the only managed resource in the core. The HTTP and Broker modules (`syntropylog/http`, `syntropylog/brokers`) and their types remain available for programmatic use but are no longer wired from the facade or configuration.
34
59
 
35
60
  ### 📦 Migration (0.9.1 → 0.9.2)
61
+
36
62
  - **If you used `getHttp()` or `getBroker()`**: Obtain the HTTP or broker client from your own app (e.g. inject it, or create it from `syntropylog/http` / `syntropylog/brokers` directly). The core no longer exposes these from the facade.
37
63
  - **If you passed `http` or `brokers` in `init()`**: Remove those options from your config; the core no longer reads or manages them.
38
64
 
39
65
  ### 🚀 New features
66
+
40
67
  - **Transport pool and per-environment routing**: Logger config now supports `logger.transportList` (a named pool of transports) and `logger.env` (per-environment lists of transport names, e.g. `development: ['console']`, `production: ['console','db']`). When both are set, the effective transports are chosen by the current environment (`NODE_ENV` or `logger.envKey`).
41
68
  - **Per-call transport overrides**: Logger instances support `override(name)`, `add(name)`, and `remove(name)` to change which transports receive the next log entry only, then reset. Enables one-off routing (e.g. send this message only to a specific transport).
42
69
  - **`BeaconRedis.multi()`**: The real Redis client supports transactions (MULTI/EXEC). `multi()` returns an `IBeaconRedisTransaction`; `exec()` and `discard()` are instrumented with the same logging and error handling as single commands. `executeScript` inside a transaction is not supported and throws a clear error.
43
70
 
44
71
  ### 🎨 Console transports
72
+
45
73
  - **ColorfulConsoleTransport**: Reworked for full-line, level-based coloring (Python colorlog/rich style). Timestamp, level, service, message, and metadata all use the same level color scheme so the entire line is vivid end-to-end.
46
74
 
47
75
  ### 📝 Documentation and examples
76
+
48
77
  - **Code and user-facing strings in English**: Inline comments and runtime error messages are in English (e.g. `'Timeout error'`, `'Sanitization error'`, pipeline step descriptions).
49
78
  - **Configuration guide**: `docs/configuration.md` updated; HTTP and Brokers removed from the main config reference. Managed resources section now documents only Redis.
50
79
  - **Transport pool**: README section "Transport pool and per-environment routing" with a short example and links to `examples/TRANSPORT_POOL_AND_ENV.md` and `examples/TransportPoolExample.ts`.
51
80
  - **Runnable example**: `examples/TransportPoolExample.ts` (English) demonstrates `transportList`, `env`, and `override`/`add`/`remove`. Run with `npm run example:transport-pool` or `npx tsx examples/TransportPoolExample.ts`.
52
81
 
53
82
  ### 🔧 Maintenance
83
+
54
84
  - **Mocks and tests**: Removed HTTP/Broker from `SyntropyLogMock` and related tests. Config examples and tests no longer include `http` or `brokers` in `init()`.
55
85
  - **Scripts**: Added `example:transport-pool` script to `package.json`.
56
86
 
@@ -59,20 +89,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
59
89
  ## [0.9.1] - 2026-03-01
60
90
 
61
91
  ### 🛡️ Security
92
+
62
93
  - Eliminated obfuscated code patterns in Redis module to comply with security scanner requirements (Socket.dev).
63
94
 
64
95
  ### 🔧 Maintenance
96
+
65
97
  - Refactored `executeScript` in `RedisCommandExecutor` to use native `sendCommand`.
66
98
 
67
99
  ## [0.9.0] - 2026-03-01
68
100
 
69
101
  ### ⚠️ BREAKING CHANGES
102
+
70
103
  - **REMOVED `src/adapters`**: Legacy placeholders for brokers and HTTP adapters have been removed from the core. SyntropyLog is now a **self-contained framework** that exports interfaces for extensibility.
71
104
  - **REMOVED `serializers` config**: The `logger.serializers` dictionary in configuration has been removed. All serialization safety is now handled internally by the `SerializationPipeline`.
72
105
  - **REMOVED `@syntropylog/types` Reference**: The framework now internalizes and exports its own types, eliminating the need for an external types repository.
73
106
  - **`SerializerRegistry` Deprecated**: Replaced by `SerializationManager` and its step-based pipeline.
74
107
 
75
108
  ### 🚀 New Features
109
+
76
110
  - **Intelligent Serialization Pipeline**: A new declarative pipeline that processes metadata through specialized steps:
77
111
  - **`HygieneStep`**: Automatically detects and neutralizes circular references and limits object depth using `flatted`.
78
112
  - **`TimeoutStep`**: Global, declarative protection against slow serialization processes, ensuring the event loop is never blocked.
@@ -80,19 +114,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
80
114
  - **Universal Contracts**: Publicly exported interfaces (`ISerializer`, `IHttpClientAdapter`, `IBrokerAdapter`) allowing advanced users to extend the framework without modifying the core.
81
115
 
82
116
  ### 🛡️ Security
117
+
83
118
  - **Circular Reference Immunity**: The framework now handles complex, self-referencing objects by default without crashing or infinite loops.
84
119
  - **Guaranteed Timeouts**: Every serialization step is now protected by a mandatory timeout, preventing "Death by Log" in high-load scenarios.
85
120
 
86
121
  ### 🔧 Maintenance
122
+
87
123
  - **Refactored `Logger.ts`**: Deep integration with the `SerializationManager` for a cleaner, SOLID-compliant metadata processing flow.
88
124
  - **Refactored `LifecycleManager`**: Simplified initialization logic by removing manual serializer registration.
89
125
 
90
126
  ## [0.8.16] - 2026-02-28
91
127
 
92
128
  ### 🚀 Optimization
129
+
93
130
  - **`chalk` Dependency Strategy**: Moved `chalk` from `dependencies` to `peerDependencies` (optional). By design, SyntropyLog aims to keep the base bundle lightweight and free of unnecessary bloat. Users who want colored console transports (`Classic`, `Pretty`, `Compact`) should install `chalk` explicitly. The default plain-JSON production transport remains Zero-Dependency and requires no setup.
94
131
 
95
132
  ### 📝 Documentation
133
+
96
134
  - **Transports Section**: Updated README with `npm install chalk` instructions for dev environments.
97
135
 
98
136
  ---
@@ -100,6 +138,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
100
138
  ## [0.8.15] - 2026-02-28
101
139
 
102
140
  ### 📝 Documentation
141
+
103
142
  - **Console Transports**: Clarified that the default transport is a lightweight plain-JSON output requiring no configuration or imports. Added a transports comparison table showing which transports require `chalk` and their recommended use cases (production vs. development).
104
143
 
105
144
  ---
@@ -107,6 +146,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
107
146
  ## [0.8.14] - 2026-02-28
108
147
 
109
148
  ### 📝 Documentation
149
+
110
150
  - **Console Transports**: Added Socket.dev security badge to README header for supply chain transparency.
111
151
  - **Transport Imports**: Added `Available Console Transports` section documenting bundled chalk-based transports.
112
152
 
@@ -115,6 +155,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
115
155
  ## [0.8.13] - 2026-02-28
116
156
 
117
157
  ### 🛡️ Security
158
+
118
159
  - **False Positive Fix**: `executeScript()` in `RedisCommandExecutor` now builds the Redis `EVAL` method name dynamically at runtime (`['ev','al'].join('')`) instead of using the literal string `'eval'`. This eliminates the Socket.dev false-positive "Uses eval" warning without changing behavior — no JavaScript dynamic code execution occurs.
119
160
 
120
161
  ---
@@ -122,6 +163,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
122
163
  ## [0.8.12] - 2026-02-28
123
164
 
124
165
  ### 📝 Documentation
166
+
125
167
  - **README Rewrite**: Repositioned SyntropyLog as a structured observability framework built from scratch — not a utility logger.
126
168
  - **Regulated Industries**: Added dedicated section covering Banking Traceability, GDPR/LGPD, SOX, PCI-DSS, and HIPAA compliance scenarios.
127
169
  - **Fluent Logger API**: Added comprehensive section documenting `withRetention()`, `withSource()`, `withTransactionId()`, and `child()` as immutable builder pattern.
@@ -135,14 +177,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
135
177
  ## [0.8.10] - 2026-02-28
136
178
 
137
179
  ### ♻️ Cleanup
180
+
138
181
  - **Removed CLI Dependencies**: `inquirer` and `yargs` were production dependencies left over from the old built-in CLI. Since the CLI was moved to `@syntropysoft/praetorian`, these are no longer needed. This removes ~34 transitive packages and eliminates the `eslint@8`, `multer`, and `@azure/monitor-query` deprecation warnings users saw on install.
139
182
 
140
183
  ### ✅ Stability
184
+
141
185
  - All 727 tests pass after the dependency cleanup.
142
186
 
143
187
  ## [0.8.9] - 2026-02-28
144
188
 
145
189
  ### 📝 Documentation
190
+
146
191
  - **Technical Restoration**: Expanded `docs/` with deep-dive guides for `Serialization`, `Persistence`, and `Middleware`.
147
192
  - **Master Configuration**: Updated `docs/configuration.md` with complete property references, including `loggingMatrix` and `serializers`.
148
193
  - **Framework Patterns**: Added clear integration patterns for Express and NestJS.
@@ -150,63 +195,75 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
150
195
  ## [0.8.8] - 2026-02-28
151
196
 
152
197
  ### 📝 Documentation
198
+
153
199
  - **Reorganization**: Restored detailed content from the previous README into specialized files under the `docs/` directory.
154
200
  - **Cleaner README**: Main README now acts as a concise landing page, linking to `docs/enterprise.md`, `docs/configuration.md`, and others for deep dives.
155
201
 
156
202
  ## [0.8.7] - 2026-02-28
157
203
 
158
204
  ### 📝 Documentation
205
+
159
206
  - **README Overhaul**: Completely rewritten to focus on clarity, core value proposition, and simplicity.
160
207
  - **Improved Onboarding**: Simplified Quick Start guide and removed redundant enterprise sections.
161
208
 
162
209
  ## [0.8.6] - 2026-02-28
163
210
 
164
211
  ### 🚀 Enhanced
212
+
165
213
  - **NPM Package**: Added `assets`, `CHANGELOG.md`, `CONTRIBUTING.md`, and `NOTICE` to the published bundle for better visibility and compliance on NPM.
166
214
 
167
215
  ## [0.8.5] - 2026-02-28
168
216
 
169
217
  ### 🔧 Fixed
218
+
170
219
  - **Compatibility**: Broadened `redis` peer dependency range to `^4.6.12 || ^5.10.0` to eliminate installation warnings in modern environments.
171
220
  - **Dependencies**: Pinned `@typescript-eslint` versions to avoid unintentional pulls of legacy ESLint components.
172
221
 
173
222
  ## [0.8.4] - 2026-02-28
174
223
 
175
224
  ### 🛡️ Security
225
+
176
226
  - **Eval Refactor**: Renamed Redis `eval` method to `executeScript` across all interfaces and implementations to eliminate security scanner false positives.
177
227
  - **Bracket Access**: Native Redis calls now use bracket notation (`client['eval']`) to avoid detection by literal-string analysers.
178
228
 
179
229
  ### 🐛 Fixed
230
+
180
231
  - **Mock Fidelity**: Updated `BeaconRedisMock` to support `executeScript` and ensure consistency with the new interface.
181
232
 
182
233
  ## [0.8.3] - 2026-02-28
183
234
 
184
235
  ### 🚀 Enhanced
236
+
185
237
  - **Project Health**: Improved snyk health score and metadata.
186
238
  - **Maintenance**: Update legal documents, author info, and maintenance metadata.
187
239
 
188
240
  ## [0.8.2] - 2026-02-28
189
241
 
190
242
  ### 🚀 New Features
243
+
191
244
  - **Project Modernization**: Formalized Node.js 20 as the base environment.
192
245
  - **CI/CD Infrastructure**: Migrated GitHub Actions to `pnpm` and upgraded to Node.js 20.
193
246
 
194
247
  ### 🔧 Fixed
248
+
195
249
  - **Documentation**: Refreshed `README.md` with accurate version badges, coverage status, and system requirements.
196
250
  - **Environment**: Added `.nvmrc` and enforced Node.js versions in `package.json`.
197
251
 
198
252
  ## [0.8.1] - 2026-02-28
199
253
 
200
254
  ### 🚀 New Features
255
+
201
256
  - **Stable Dependency Update**: Updated `zod` and `redis` to their latest stable versions (Zod 3, Redis 4) for improved reliability.
202
257
  - **ESLint v9 Migration**: Successfully migrated to the flat configuration system (`eslint.config.js`).
203
258
 
204
259
  ### 🔧 Fixed
260
+
205
261
  - **Redis Cluster Initialization**: Fixed issue where `createClient` was used instead of `createCluster` for cluster mode.
206
262
  - **Type Safety**: Resolved several type mismatches and compilation errors in Redis command executors and config schemas.
207
263
  - **Test Integrity**: Refactored vitest mocks for better compatibility with Vitest 4 and fixed test regressions.
208
264
 
209
265
  ### 📦 Dependencies
266
+
210
267
  - Downgraded `zod` to `^3.23.8` (stable).
211
268
  - Downgraded `redis` to `^4.6.12` (stable).
212
269
  - Upgraded `rollup` and `vitest` to latest versions.
@@ -214,18 +271,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
214
271
  ## [0.8.0] - 2026-02-27
215
272
 
216
273
  ### 🚀 New Features
274
+
217
275
  - **Universal Persistence**: Integrated `UniversalAdapter` and `UniversalLogFormatter` directly into the Core.
218
276
  - **Audit Level**: Added a first-class `audit` log level for unified compliance logging.
219
277
  - **Storage Agnostic**: Support for mapping logs to any schema (SQL, NoSQL, etc.) via JSON templates.
220
278
 
221
279
  ### 🔧 Fixed
280
+
222
281
  - **Console Transports**: Added missing `audit` level coloring to `Classic`, `Compact`, and `Pretty` transports.
223
282
  - **Mocks**: Updated `BeaconRedisMock` to support the expanded `ILogger` interface.
224
283
 
225
284
  ### 📦 Dependencies
285
+
226
286
  - No new external dependencies.
227
287
 
228
288
  ### 🧪 Testing
289
+
229
290
  - **UniversalFormatter**: Added comprehensive unit tests for JSON mapping, path resolution, and template fallbacks.
230
291
 
231
292
  ---
@@ -233,24 +294,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
233
294
  ## [0.7.2] - 2024-12-20
234
295
 
235
296
  ### 🚀 Enhanced
297
+
236
298
  - **InstrumentedBrokerClient**: Improved correlation ID propagation logic to only propagate existing IDs instead of auto-generating new ones
237
299
  - **Context Management**: Enhanced context handling in message broker scenarios with better correlation ID comparison
238
300
  - **Logging**: Added correlation ID tracking in broker publish/receive logs for better observability
239
301
  - **TypeScript**: Improved type exports for better autocompletion and developer experience
240
302
 
241
303
  ### 🔧 Fixed
304
+
242
305
  - **Rollup Build**: Fixed deprecated `inlineDynamicImports` warning by moving option to output configuration
243
306
  - **Context Propagation**: Resolved issues with correlation ID generation in broker message handling
244
307
  - **Build Process**: Eliminated build warnings for cleaner compilation output
245
308
 
246
309
  ### 📦 Dependencies
310
+
247
311
  - No new dependencies added
248
312
 
249
313
  ### 🧪 Testing
314
+
250
315
  - **Broker Integration**: Enhanced testing for context propagation in message broker scenarios
251
316
  - **Context Management**: Improved test coverage for correlation ID handling
252
317
 
253
318
  ### 🎯 Key Features
319
+
254
320
  - **Smart Context Propagation**: Only propagates existing correlation IDs, preventing unwanted ID generation
255
321
  - **Enhanced Observability**: Better logging of correlation IDs throughout message processing pipeline
256
322
  - **Developer Experience**: Improved TypeScript support with better type exports
@@ -258,27 +324,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
258
324
  ## [0.7.1] - 2024-12-19
259
325
 
260
326
  ### 🚀 Enhanced
327
+
261
328
  - **MaskingEngine**: Implemented ultra-fast JSON flattening strategy using `flatted` library
262
329
  - **Performance**: Achieved O(n) performance regardless of object depth for masking operations
263
330
  - **Security**: Enhanced `preserveLength: true` as default for all masking rules
264
331
  - **Compatibility**: Maintained full backward compatibility with existing masking API
265
332
 
266
333
  ### 🔧 Fixed
334
+
267
335
  - **MaskingEngine**: Fixed individual masking methods for Credit Card, SSN, Phone, Email, and Token
268
336
  - **Tests**: Corrected test expectations to match actual masking behavior
269
337
  - **Token Masking**: Updated to preserve last 5 characters instead of 4 for better security
270
338
  - **Email Masking**: Fixed length preservation logic for various email formats
271
339
 
272
340
  ### 📦 Dependencies
341
+
273
342
  - Added `flatted` library for robust JSON flattening/unflattening operations
274
343
  - Added `regex-test` library for secure regex pattern testing
275
344
 
276
345
  ### 🧪 Testing
346
+
277
347
  - **Coverage**: All 20 MaskingEngine tests now pass (100% success rate)
278
348
  - **Performance**: Benchmark shows 1ms processing time for complex nested objects
279
349
  - **Edge Cases**: Added comprehensive testing for circular references and error handling
280
350
 
281
351
  ### 🎯 Key Features
352
+
282
353
  - **JSON Flattening Strategy**: Linear processing of nested objects for extreme performance
283
354
  - **Hybrid Masking**: Field name matching with fallback to content pattern analysis
284
355
  - **Silent Observer Pattern**: Never throws exceptions, always returns processed data
@@ -286,6 +357,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
286
357
  - **Structure Preservation**: Maintains original object structure after masking
287
358
 
288
359
  ### 🔒 Security Improvements
360
+
289
361
  - **Default Security**: `preserveLength: true` prevents length-based attacks
290
362
  - **Comprehensive Masking**: Covers Credit Cards, SSNs, Emails, Phones, Passwords, and Tokens
291
363
  - **Custom Rules**: Support for application-specific sensitive data patterns
@@ -293,7 +365,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
293
365
  ## [0.7.0] - 2024-12-18
294
366
 
295
367
  ### 🎉 Initial Release
368
+
296
369
  - Core framework architecture
297
370
  - Basic masking capabilities
298
371
  - Initial test suite
299
- - Documentation and examples
372
+ - Documentation and examples
package/README.md CHANGED
@@ -16,8 +16,8 @@
16
16
  <a href="https://www.npmjs.com/package/syntropylog"><img src="https://img.shields.io/npm/v/syntropylog.svg" alt="NPM Version"></a>
17
17
  <a href="https://github.com/Syntropysoft/SyntropyLog/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/syntropylog.svg" alt="License"></a>
18
18
  <a href="https://github.com/Syntropysoft/SyntropyLog/actions/workflows/ci.yaml"><img src="https://github.com/Syntropysoft/SyntropyLog/actions/workflows/ci.yaml/badge.svg" alt="CI Status"></a>
19
- <a href="#"><img src="https://img.shields.io/badge/coverage-84.64%25-brightgreen" alt="Test Coverage"></a>
20
- <a href="#"><img src="https://img.shields.io/badge/status-v0.9.3-brightgreen.svg" alt="Version 0.9.3"></a>
19
+ <a href="#"><img src="https://img.shields.io/badge/coverage-92.47%25-brightgreen" alt="Test Coverage"></a>
20
+ <a href="#"><img src="https://img.shields.io/badge/status-v0.9.8-brightgreen.svg" alt="Version 0.9.8"></a>
21
21
  <a href="https://socket.dev/npm/package/syntropylog"><img src="https://socket.dev/api/badge/npm/package/syntropylog" alt="Socket Badge"></a>
22
22
  </p>
23
23
 
@@ -310,7 +310,7 @@ The **Logging Matrix** lets you control exactly how much data appears per log le
310
310
  12:56:00 [ERROR] (ecommerce-app): User request processed { status: 'completed', duration: '150ms' }
311
311
  {
312
312
  "userId": 123, "email": "user@example.com", "password": "***MASKED***",
313
- "firstName": "John", "ipAddress": "192.168.1.1",
313
+ "firstName": "John", "ipAddress": "127.0.0.1",
314
314
  "sessionId": "sess-789", "requestId": "req-456"
315
315
  }
316
316
  ```
@@ -622,8 +622,6 @@ SyntropyLog goes deep. Explore our specialized guides:
622
622
  | ✅ **Safe to change** | Logging Matrix, Log Level, additive Masking Fields | — |
623
623
  | 🔒 **Fixed at init** | — | Transports, core masking config (`maskChar`, `maxDepth`), Redis/HTTP/broker infrastructure |
624
624
 
625
- **Compliance Guarantee**: Sensitive data stays masked regardless of dynamic changes. All security configurations are locked at init — zero risk of accidental PII exposure. **100% Open Source**, no hidden telemetry or tracking.
626
-
627
625
  ---
628
626
 
629
627
  ## 🤝 Contributing & License
@@ -4,31 +4,28 @@ import path from 'path';
4
4
  /**
5
5
  * Loads logger configuration from a YAML file.
6
6
  * The function determines the file path with the following priority:
7
- * 1. The path from the environment variable specified by `configPathEnvVar` (e.g., `LOGGER_CONFIG`).
8
- * 2. The environment-specific path (e.g., `{configDir}/{defaultBase}-production.yaml`).
7
+ * 1. The explicit path provided in `opts.configPath`.
8
+ * 2. The environment-specific path (e.g., `{configDir}/{defaultBase}-{environment}.yaml`).
9
9
  * 3. The default base path (e.g., `{configDir}/{defaultBase}.yaml`).
10
10
  *
11
+ * It does NOT read environment variables directly; all state must be passed via `opts`.
11
12
  * If no file is found, it returns an empty object, making the config file optional.
12
13
  * @param opts - Options to customize the loading behavior.
13
14
  * @returns A partial `LoggerOptions` object, or an empty object if no file is found.
14
15
  * @throws An error if a config file is found but fails to be read or parsed.
15
16
  */
16
17
  export function loadLoggerConfig(opts) {
17
- const { configPathEnvVar = 'LOGGER_CONFIG', fallbackEnvVar = 'NODE_ENV', configDir = './config', defaultBase = 'logger', } = opts || {};
18
- // 1. Check for the direct path from the primary environment variable.
18
+ const { configPath: explicitConfigPath, environment, configDir = './config', defaultBase = 'logger', } = opts || {};
19
+ // 1. Check for the direct explicit path.
19
20
  let configPath;
20
- const envPath = process.env[configPathEnvVar];
21
- if (envPath && fs.existsSync(envPath)) {
22
- configPath = envPath;
21
+ if (explicitConfigPath && fs.existsSync(explicitConfigPath)) {
22
+ configPath = explicitConfigPath;
23
23
  }
24
- // 2. If not found, construct and check for an environment-specific file.
25
- if (!configPath) {
26
- const env = process.env[fallbackEnvVar];
27
- if (env) {
28
- const envSpecificPath = path.join(configDir, `${defaultBase}-${env}.yaml`);
29
- if (fs.existsSync(envSpecificPath)) {
30
- configPath = envSpecificPath;
31
- }
24
+ // 2. If not found, check for an explicit environment-specific file.
25
+ if (!configPath && environment) {
26
+ const envSpecificPath = path.join(configDir, `${defaultBase}-${environment}.yaml`);
27
+ if (fs.existsSync(envSpecificPath)) {
28
+ configPath = envSpecificPath;
32
29
  }
33
30
  }
34
31
  // 3. If still not found, check for the default base file.
@@ -1 +1 @@
1
- {"version":3,"file":"loadLoggerConfig.js","sourceRoot":"","sources":["../../src/config/loadLoggerConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,MAAM,CAAC;AAgCxB;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAgC;IAEhC,MAAM,EACJ,gBAAgB,GAAG,eAAe,EAClC,cAAc,GAAG,UAAU,EAC3B,SAAS,GAAG,UAAU,EACtB,WAAW,GAAG,QAAQ,GACvB,GAAG,IAAI,IAAI,EAAE,CAAC;IAEf,sEAAsE;IACtE,IAAI,UAA8B,CAAC;IACnC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC9C,IAAI,OAAO,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACtC,UAAU,GAAG,OAAO,CAAC;IACvB,CAAC;IAED,yEAAyE;IACzE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QACxC,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAC/B,SAAS,EACT,GAAG,WAAW,IAAI,GAAG,OAAO,CAC7B,CAAC;YACF,IAAI,EAAE,C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b,sDAAsD,UAAU,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC9H,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -45,10 +45,10 @@ const loggerOptionsSchema = z
45
45
  .optional(),
46
46
  serviceName: z.string().optional(),
47
47
  /**
48
- * Name of the environment variable used to resolve conditional transports (e.g. 'NODE_ENV', 'APP_ENV').
49
- * @default 'NODE_ENV'
48
+ * The explicit environment name used to resolve conditional transports (e.g. 'development', 'production').
49
+ * @default 'development'
50
50
  */
51
- envKey: z.string().optional(),
51
+ environment: z.string().optional(),
52
52
  /**
53
53
  * Pool of transports by name. Use together with `env` to pick per-environment defaults.
54
54
  * When both transportList and env are set, this form is used instead of `transports`.
@@ -1 +1 @@
1
- {"version":3,"file":"config.schema.js","sourceRoot":"","sources":["../src/config.schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,4FAA4F;AAE5F;;;GAGG;AACH,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC;IAClC,oGAAoG;IACpG,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC3D,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC;IACnC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC;IACvB,yBAAyB;CAC1B,CAAC,CAAC;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AAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACpC,gHAAgH;IAChH,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACpC,iHAAiH;IACjH,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACrC,iHAAiH;IACjH,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACtC,CAAC;KACD,QAAQ,EAAE,CAAC;AAEd;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,qCAAqC;IACrC,MAAM,EAAE,mBAAmB;IAE3B,0DAA0D;IAC1D,aAAa,EAAE,mBAAmB;IAElC,kCAAkC;IAClC,KAAK,EAAE,iBAAiB;IAExB,8CAA8C;IAC9C,OAAO,EAAE,mBAAmB;IAE5B,yCAAyC;IACzC,OAAO,EAAE,CAAC;SACP,MAAM,CAAC;QACN,sFAAsF;QACtF,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC1C,+FAA+F;QAC/F,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC3C,CAAC;SACD,QAAQ,EAAE;IAEb;;;OAGG;IACH,eAAe,EAAE,CAAC;SACf,MAAM,EAAE;SACR,QAAQ,CAAC,yDAAyD,CAAC;SACnE,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,EAAE;CACd,CAAC,CAAC"}
package/dist/index.cjs CHANGED
@@ -501,10 +501,10 @@ const loggerOptionsSchema = zod.z
501
501
  .optional(),
502
502
  serviceName: zod.z.string().optional(),
503
503
  /**
504
- * Name of the environment variable used to resolve conditional transports (e.g. 'NODE_ENV', 'APP_ENV').
505
- * @default 'NODE_ENV'
504
+ * The explicit environment name used to resolve conditional transports (e.g. 'development', 'production').
505
+ * @default 'development'
506
506
  */
507
- envKey: zod.z.string().optional(),
507
+ environment: zod.z.string().optional(),
508
508
  /**
509
509
  * Pool of transports by name. Use together with `env` to pick per-environment defaults.
510
510
  * When both transportList and env are set, this form is used instead of `transports`.
@@ -1930,7 +1930,7 @@ class LoggerFactory {
1930
1930
  if (config.context) {
1931
1931
  this.contextManager.configure(config.context);
1932
1932
  }
1933
- const currentEnv = process.env[config.logger?.envKey ?? 'NODE_ENV'] ?? 'development';
1933
+ const currentEnv = config.logger?.environment ?? 'development';
1934
1934
  const hasTransportList = config.logger?.transportList &&
1935
1935
  Object.keys(config.logger.transportList).length > 0;
1936
1936
  const hasEnv = config.logger?.env && Object.keys(config.logger.env).length > 0;