@unchainedshop/logger 5.0.0-alpha.5 → 5.0.0-alpha.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/README.md +1 -1
- package/benchmarks/README.md +5 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ A high-performance, feature-rich logging package for Unchained Engine with suppo
|
|
|
9
9
|
- 🔍 **Debug Patterns**: Flexible DEBUG environment variable with wildcards and exclusions
|
|
10
10
|
- 📊 **Log Levels**: Five log levels (trace, debug, info, warn, error) with environment-based filtering
|
|
11
11
|
- 💪 **TypeScript**: Full TypeScript support with type definitions
|
|
12
|
-
- 🔧 **Zero Dependencies**:
|
|
12
|
+
- 🔧 **Zero Runtime Dependencies**: Uses Node.js built-ins
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
package/benchmarks/README.md
CHANGED
|
@@ -1,32 +1,11 @@
|
|
|
1
1
|
# Logger Performance Benchmarks
|
|
2
2
|
|
|
3
|
-
Run with
|
|
3
|
+
Run from this package with `npm run benchmark`, or from the repository root:
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
Test Name | Ops/sec | Avg Time | Total Time
|
|
9
|
-
---------------------------------|--------------|--------------|-------------
|
|
10
|
-
Logger creation (default format) | 935.97K | 0.001 ms | 1.07 ms
|
|
11
|
-
Logger creation (JSON format) | 1.27M | 0.79 µs | 0.79 ms
|
|
12
|
-
Log info (default format) | 8.15M | 0.12 µs | 12.28 ms
|
|
13
|
-
Log info (JSON format) | 1.25M | 0.80 µs | 79.87 ms
|
|
14
|
-
Log complex object (JSON) | 465.65K | 0.002 ms | 21.48 ms
|
|
15
|
-
Debug log (enabled) | 8.34M | 0.12 µs | 11.99 ms
|
|
16
|
-
Debug log (disabled) | 299.36M | 0.00 µs | 0.33 ms
|
|
17
|
-
Pattern matching (createLogger) | 1.21M | 0.82 µs | 4.12 ms
|
|
5
|
+
```bash
|
|
6
|
+
npm run benchmark --workspace @unchainedshop/logger
|
|
18
7
|
```
|
|
19
8
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- JSON format logging is **550.6% slower** than default format
|
|
23
|
-
- Debug logging when disabled is **35.9x faster** (skips log processing entirely)
|
|
24
|
-
- Fastest: Debug log (disabled) at 299.36M ops/s
|
|
25
|
-
- Slowest: Complex object logging at 465.65K ops/s
|
|
26
|
-
|
|
27
|
-
## Optimizations
|
|
9
|
+
The benchmark measures logger creation, human-readable and JSON logging, complex object formatting, enabled/disabled debug logging, and DEBUG pattern matching. It prints operations per second and elapsed times for the current runtime.
|
|
28
10
|
|
|
29
|
-
|
|
30
|
-
- **Regex pattern caching**: Compiled RegExp objects are cached to avoid recreation
|
|
31
|
-
- **Pattern result caching**: DEBUG pattern matching results are cached per module
|
|
32
|
-
- **No-op functions**: Disabled log levels return empty functions for zero-cost logging
|
|
11
|
+
Console output is suppressed during measurements, so results measure logger processing rather than terminal or log-collector throughput. Record the Node.js version and hardware when comparing runs.
|
package/package.json
CHANGED