Skip to content

Commit cd40869

Browse files
authored
🚀 release: v2.2.0 - Merge pull request #21 from wgtechlabs/dev
2 parents 1aa7523 + c3d8cab commit cd40869

File tree

7 files changed

+516
-24
lines changed

7 files changed

+516
-24
lines changed

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,72 @@ Log messages are beautifully formatted with colorized timestamps, levels, and sm
341341
- 🟢 **LOG**: Green - Critical messages that always display
342342
-**Timestamps**: Gray (ISO) and Cyan (local time) for easy scanning
343343

344+
### Customizing Log Elements
345+
346+
**LogEngine v2.1+ introduces the ability to customize which elements are included in your log output** while keeping log levels mandatory for clarity and consistency.
347+
348+
#### Available Customization Options
349+
350+
You can control the inclusion of timestamp elements:
351+
352+
- **ISO Timestamp**: `[2025-05-29T16:57:45.678Z]` - Precise UTC timestamp
353+
- **Local Time**: `[4:57PM]` - Human-readable local time
354+
- **Log Level**: `[INFO]` - Always included (non-customizable as per design)
355+
356+
#### Format Configuration Examples
357+
358+
```typescript
359+
import { LogEngine, LogMode } from '@wgtechlabs/log-engine';
360+
361+
// Default format (backward compatible)
362+
LogEngine.configure({ mode: LogMode.DEBUG });
363+
LogEngine.info('Server started');
364+
// Output: [2025-05-29T16:57:45.678Z][4:57PM][INFO]: Server started
365+
366+
// Only ISO timestamp
367+
LogEngine.configure({
368+
mode: LogMode.DEBUG,
369+
format: {
370+
includeIsoTimestamp: true,
371+
includeLocalTime: false
372+
}
373+
});
374+
LogEngine.info('Database connected');
375+
// Output: [2025-05-29T16:57:45.678Z][INFO]: Database connected
376+
377+
// Only local time
378+
LogEngine.configure({
379+
mode: LogMode.DEBUG,
380+
format: {
381+
includeIsoTimestamp: false,
382+
includeLocalTime: true
383+
}
384+
});
385+
LogEngine.warn('Rate limit approaching');
386+
// Output: [4:57PM][WARN]: Rate limit approaching
387+
388+
// Minimal format (no timestamps)
389+
LogEngine.configure({
390+
mode: LogMode.DEBUG,
391+
format: {
392+
includeIsoTimestamp: false,
393+
includeLocalTime: false
394+
}
395+
});
396+
LogEngine.error('Connection failed');
397+
// Output: [ERROR]: Connection failed
398+
```
399+
400+
#### Benefits of Log Element Customization
401+
402+
- **🎯 Reduced Verbosity**: Remove unnecessary timestamp information in containerized environments where external logging systems add timestamps
403+
- **📱 Space Efficiency**: Minimize log line length for mobile or constrained display environments
404+
- **🔧 Integration Ready**: Match existing log format requirements in your infrastructure
405+
- **⚡ Performance**: Slightly reduced formatting overhead when timestamps are disabled
406+
- **🔒 Backward Compatible**: Default behavior remains unchanged - existing code continues to work without modifications
407+
408+
**Note**: Log levels (`[DEBUG]`, `[INFO]`, `[WARN]`, `[ERROR]`, `[LOG]`) are always included regardless of configuration to maintain log clarity and filtering capabilities.
409+
344410
## 🔒 Advanced Data Redaction
345411

346412
**LogEngine features comprehensive built-in PII protection with advanced customization capabilities that automatically redacts sensitive information from your logs.** This security-first approach prevents accidental exposure of passwords, tokens, emails, and other sensitive data while maintaining full debugging capabilities with enterprise-grade flexibility.

package.json

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,54 @@
11
{
22
"name": "@wgtechlabs/log-engine",
3-
"version": "2.1.1",
3+
"version": "2.2.0",
44
"description": "A lightweight, security-first logging utility with automatic data redaction for Node.js applications - the first logging library with built-in PII protection.",
55
"type": "module",
66
"keywords": [
77
"logging",
8+
"logger",
9+
"log",
10+
"winston-alternative",
811
"security",
912
"redaction",
1013
"pii-protection",
1114
"data-redaction",
1215
"typescript",
16+
"javascript",
1317
"nodejs",
18+
"express",
19+
"fastify",
20+
"koa",
21+
"nestjs",
1422
"bot",
1523
"discord",
1624
"telegram",
1725
"privacy",
1826
"gdpr",
19-
"compliance"
27+
"compliance",
28+
"opensource",
29+
"mit-license",
30+
"esm",
31+
"cjs",
32+
"zero-dependencies",
33+
"structured-logging",
34+
"json-logging"
2035
],
2136
"packageManager": "yarn@4.9.2",
2237
"license": "MIT",
2338
"author": "WG Tech Labs <opensource@wgtechlabs.com> (https://wgtechlabs.com)",
2439
"contributors": [
2540
"Waren Gonzaga <opensource@warengonzaga.com> (https://warengonzaga.com)"
2641
],
42+
"funding": [
43+
{
44+
"type": "github",
45+
"url": "https://github.com/sponsors/wgtechlabs"
46+
},
47+
{
48+
"type": "github",
49+
"url": "https://github.com/sponsors/warengonzaga"
50+
}
51+
],
2752
"main": "./dist/cjs/index.cjs",
2853
"module": "./dist/esm/index.js",
2954
"types": "./dist/esm/index.d.ts",
@@ -40,13 +65,22 @@
4065
}
4166
},
4267
"files": [
43-
"dist/**/*",
68+
"dist/",
4469
"README.md",
4570
"LICENSE"
4671
],
4772
"repository": {
4873
"type": "git",
49-
"url": "https://github.com/wgtechlabs/log-engine.git"
74+
"url": "git+https://github.com/wgtechlabs/log-engine.git"
75+
},
76+
"homepage": "https://github.com/wgtechlabs/log-engine#readme",
77+
"bugs": {
78+
"url": "https://github.com/wgtechlabs/log-engine/issues"
79+
},
80+
"publishConfig": {
81+
"access": "public",
82+
"registry": "https://registry.npmjs.org/",
83+
"tag": "latest"
5084
},
5185
"scripts": {
5286
"build": "node scripts/forklift-runner.js --clean",
@@ -71,7 +105,7 @@
71105
"validate": "run-s lint test build",
72106
"clean": "rm -rf dist coverage",
73107
"coverage:open": "open coverage/lcov-report/index.html",
74-
"coverage:upload": "curl -Os https://uploader.codecov.io/latest/windows/codecov.exe && codecov.exe"
108+
"coverage:upload": "npx codecov"
75109
},
76110
"devDependencies": {
77111
"@types/eslint-plugin-security": "^3",
@@ -89,6 +123,7 @@
89123
"typescript": "^5.8.3"
90124
},
91125
"engines": {
92-
"node": ">=16.0.0"
126+
"node": ">=16.0.0",
127+
"npm": ">=7.0.0"
93128
}
94129
}

0 commit comments

Comments
 (0)