@wgtechlabs/log-engine 2.0.0 → 2.1.1
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/LICENSE +21 -21
- package/README.md +869 -608
- package/dist/cjs/__tests__/async-test-utils.cjs +276 -0
- package/dist/cjs/__tests__/async-test-utils.d.ts +51 -0
- package/dist/cjs/__tests__/async-test-utils.d.ts.map +1 -0
- package/dist/cjs/__tests__/async-test-utils.js.map +1 -0
- package/dist/cjs/__tests__/redaction/test-utils.cjs +72 -0
- package/dist/cjs/__tests__/redaction/test-utils.d.ts +33 -0
- package/dist/cjs/__tests__/redaction/test-utils.d.ts.map +1 -0
- package/dist/cjs/__tests__/redaction/test-utils.js.map +1 -0
- package/dist/cjs/__tests__/test-utils.cjs +49 -0
- package/dist/cjs/__tests__/test-utils.d.ts +41 -0
- package/dist/cjs/__tests__/test-utils.d.ts.map +1 -0
- package/dist/cjs/__tests__/test-utils.js.map +1 -0
- package/dist/{formatter/colors.js → cjs/formatter/colors.cjs} +1 -0
- package/dist/cjs/formatter/colors.d.ts.map +1 -0
- package/dist/cjs/formatter/colors.js.map +1 -0
- package/dist/{formatter/data-formatter.js → cjs/formatter/data-formatter.cjs} +2 -1
- package/dist/{formatter → cjs/formatter}/data-formatter.d.ts +2 -1
- package/dist/cjs/formatter/data-formatter.d.ts.map +1 -0
- package/dist/cjs/formatter/data-formatter.js.map +1 -0
- package/dist/{formatter/index.js → cjs/formatter/index.cjs} +6 -5
- package/dist/cjs/formatter/index.d.ts.map +1 -0
- package/dist/cjs/formatter/index.js.map +1 -0
- package/dist/{formatter/message-formatter.js → cjs/formatter/message-formatter.cjs} +28 -27
- package/dist/cjs/formatter/message-formatter.d.ts +41 -0
- package/dist/cjs/formatter/message-formatter.d.ts.map +1 -0
- package/dist/cjs/formatter/message-formatter.js.map +1 -0
- package/dist/{formatter/timestamp.js → cjs/formatter/timestamp.cjs} +1 -0
- package/dist/cjs/formatter/timestamp.d.ts.map +1 -0
- package/dist/cjs/formatter/timestamp.js.map +1 -0
- package/dist/cjs/index.cjs +202 -0
- package/dist/cjs/index.d.ts +180 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/logger/advanced-outputs.cjs +587 -0
- package/dist/cjs/logger/advanced-outputs.d.ts +159 -0
- package/dist/cjs/logger/advanced-outputs.d.ts.map +1 -0
- package/dist/cjs/logger/advanced-outputs.js.map +1 -0
- package/dist/{logger/config.js → cjs/logger/config.cjs} +36 -32
- package/dist/cjs/logger/config.d.ts +42 -0
- package/dist/cjs/logger/config.d.ts.map +1 -0
- package/dist/cjs/logger/config.js.map +1 -0
- package/dist/cjs/logger/core.cjs +371 -0
- package/dist/cjs/logger/core.d.ts +152 -0
- package/dist/cjs/logger/core.d.ts.map +1 -0
- package/dist/cjs/logger/core.js.map +1 -0
- package/dist/{logger/environment.js → cjs/logger/environment.cjs} +17 -16
- package/dist/cjs/logger/environment.d.ts +36 -0
- package/dist/cjs/logger/environment.d.ts.map +1 -0
- package/dist/cjs/logger/environment.js.map +1 -0
- package/dist/cjs/logger/filtering.cjs +81 -0
- package/dist/cjs/logger/filtering.d.ts +36 -0
- package/dist/cjs/logger/filtering.d.ts.map +1 -0
- package/dist/cjs/logger/filtering.js.map +1 -0
- package/dist/{logger/index.js → cjs/logger/index.cjs} +6 -5
- package/dist/cjs/logger/index.d.ts.map +1 -0
- package/dist/cjs/logger/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/{redaction/config.js → cjs/redaction/config.cjs} +9 -8
- package/dist/{redaction → cjs/redaction}/config.d.ts +8 -8
- package/dist/cjs/redaction/config.d.ts.map +1 -0
- package/dist/cjs/redaction/config.js.map +1 -0
- package/dist/{redaction/index.js → cjs/redaction/index.cjs} +3 -2
- package/dist/cjs/redaction/index.d.ts.map +1 -0
- package/dist/cjs/redaction/index.js.map +1 -0
- package/dist/cjs/redaction/redactor.cjs +263 -0
- package/dist/cjs/redaction/redactor.d.ts +99 -0
- package/dist/cjs/redaction/redactor.d.ts.map +1 -0
- package/dist/cjs/redaction/redactor.js.map +1 -0
- package/dist/{types/index.js → cjs/types/index.cjs} +1 -0
- package/dist/{types → cjs/types}/index.d.ts +98 -16
- package/dist/cjs/types/index.d.ts.map +1 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/esm/__tests__/async-test-utils.d.ts +51 -0
- package/dist/esm/__tests__/async-test-utils.d.ts.map +1 -0
- package/dist/esm/__tests__/async-test-utils.js +231 -0
- package/dist/esm/__tests__/async-test-utils.js.map +1 -0
- package/dist/esm/__tests__/redaction/test-utils.d.ts +33 -0
- package/dist/esm/__tests__/redaction/test-utils.d.ts.map +1 -0
- package/dist/esm/__tests__/redaction/test-utils.js +65 -0
- package/dist/esm/__tests__/redaction/test-utils.js.map +1 -0
- package/dist/esm/__tests__/test-utils.d.ts +41 -0
- package/dist/esm/__tests__/test-utils.d.ts.map +1 -0
- package/dist/esm/__tests__/test-utils.js +42 -0
- package/dist/esm/__tests__/test-utils.js.map +1 -0
- package/dist/esm/formatter/colors.d.ts +32 -0
- package/dist/esm/formatter/colors.d.ts.map +1 -0
- package/dist/esm/formatter/colors.js +32 -0
- package/dist/esm/formatter/colors.js.map +1 -0
- package/dist/esm/formatter/data-formatter.d.ts +26 -0
- package/dist/esm/formatter/data-formatter.d.ts.map +1 -0
- package/dist/esm/formatter/data-formatter.js +50 -0
- package/dist/esm/formatter/data-formatter.js.map +1 -0
- package/dist/esm/formatter/index.d.ts +10 -0
- package/dist/esm/formatter/index.d.ts.map +1 -0
- package/dist/esm/formatter/index.js +11 -0
- package/dist/esm/formatter/index.js.map +1 -0
- package/dist/esm/formatter/message-formatter.d.ts +41 -0
- package/dist/esm/formatter/message-formatter.d.ts.map +1 -0
- package/dist/esm/formatter/message-formatter.js +84 -0
- package/dist/esm/formatter/message-formatter.js.map +1 -0
- package/dist/esm/formatter/timestamp.d.ts +27 -0
- package/dist/esm/formatter/timestamp.d.ts.map +1 -0
- package/dist/esm/formatter/timestamp.js +36 -0
- package/dist/esm/formatter/timestamp.js.map +1 -0
- package/dist/esm/index.d.ts +180 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +194 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/logger/advanced-outputs.d.ts +159 -0
- package/dist/esm/logger/advanced-outputs.d.ts.map +1 -0
- package/dist/esm/logger/advanced-outputs.js +542 -0
- package/dist/esm/logger/advanced-outputs.js.map +1 -0
- package/dist/esm/logger/config.d.ts +42 -0
- package/dist/esm/logger/config.d.ts.map +1 -0
- package/dist/esm/logger/config.js +101 -0
- package/dist/esm/logger/config.js.map +1 -0
- package/dist/esm/logger/core.d.ts +152 -0
- package/dist/esm/logger/core.d.ts.map +1 -0
- package/dist/esm/logger/core.js +367 -0
- package/dist/esm/logger/core.js.map +1 -0
- package/dist/esm/logger/environment.d.ts +36 -0
- package/dist/esm/logger/environment.d.ts.map +1 -0
- package/dist/esm/logger/environment.js +58 -0
- package/dist/esm/logger/environment.js.map +1 -0
- package/dist/esm/logger/filtering.d.ts +36 -0
- package/dist/esm/logger/filtering.d.ts.map +1 -0
- package/dist/esm/logger/filtering.js +77 -0
- package/dist/esm/logger/filtering.js.map +1 -0
- package/dist/esm/logger/index.d.ts +10 -0
- package/dist/esm/logger/index.d.ts.map +1 -0
- package/dist/esm/logger/index.js +11 -0
- package/dist/esm/logger/index.js.map +1 -0
- package/dist/esm/redaction/config.d.ts +29 -0
- package/dist/esm/redaction/config.d.ts.map +1 -0
- package/dist/esm/redaction/config.js +92 -0
- package/dist/esm/redaction/config.js.map +1 -0
- package/dist/esm/redaction/index.d.ts +8 -0
- package/dist/esm/redaction/index.d.ts.map +1 -0
- package/dist/esm/redaction/index.js +7 -0
- package/dist/esm/redaction/index.js.map +1 -0
- package/dist/esm/redaction/redactor.d.ts +99 -0
- package/dist/esm/redaction/redactor.d.ts.map +1 -0
- package/dist/esm/redaction/redactor.js +259 -0
- package/dist/esm/redaction/redactor.js.map +1 -0
- package/dist/esm/types/index.d.ts +310 -0
- package/dist/esm/types/index.d.ts.map +1 -0
- package/dist/esm/types/index.js +41 -0
- package/dist/esm/types/index.js.map +1 -0
- package/package.json +94 -68
- package/dist/formatter/colors.d.ts.map +0 -1
- package/dist/formatter/data-formatter.d.ts.map +0 -1
- package/dist/formatter/index.d.ts.map +0 -1
- package/dist/formatter/message-formatter.d.ts +0 -41
- package/dist/formatter/message-formatter.d.ts.map +0 -1
- package/dist/formatter/timestamp.d.ts.map +0 -1
- package/dist/index.d.ts +0 -186
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -201
- package/dist/logger/config.d.ts +0 -42
- package/dist/logger/config.d.ts.map +0 -1
- package/dist/logger/core.d.ts +0 -108
- package/dist/logger/core.d.ts.map +0 -1
- package/dist/logger/core.js +0 -185
- package/dist/logger/environment.d.ts +0 -36
- package/dist/logger/environment.d.ts.map +0 -1
- package/dist/logger/filtering.d.ts +0 -36
- package/dist/logger/filtering.d.ts.map +0 -1
- package/dist/logger/filtering.js +0 -65
- package/dist/logger/index.d.ts.map +0 -1
- package/dist/redaction/config.d.ts.map +0 -1
- package/dist/redaction/index.d.ts.map +0 -1
- package/dist/redaction/redactor.d.ts +0 -99
- package/dist/redaction/redactor.d.ts.map +0 -1
- package/dist/redaction/redactor.js +0 -257
- package/dist/types/index.d.ts.map +0 -1
- /package/dist/{formatter → cjs/formatter}/colors.d.ts +0 -0
- /package/dist/{formatter → cjs/formatter}/index.d.ts +0 -0
- /package/dist/{formatter → cjs/formatter}/timestamp.d.ts +0 -0
- /package/dist/{logger → cjs/logger}/index.d.ts +0 -0
- /package/dist/{redaction → cjs/redaction}/index.d.ts +0 -0
|
@@ -5,28 +5,28 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.MessageFormatter = void 0;
|
|
8
|
-
const types_1 = require("../types");
|
|
9
|
-
const colors_1 = require("./colors");
|
|
10
|
-
const timestamp_1 = require("./timestamp");
|
|
11
|
-
const data_formatter_1 = require("./data-formatter");
|
|
8
|
+
const types_1 = require("../types/index.cjs");
|
|
9
|
+
const colors_1 = require("./colors.cjs");
|
|
10
|
+
const timestamp_1 = require("./timestamp.cjs");
|
|
11
|
+
const data_formatter_1 = require("./data-formatter.cjs");
|
|
12
12
|
/**
|
|
13
13
|
* Core message formatter class
|
|
14
14
|
* Provides the main formatting functionality for log messages
|
|
15
15
|
*/
|
|
16
16
|
class MessageFormatter {
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
* Formats a log message with timestamp, level indicator, and appropriate coloring
|
|
19
|
+
* Creates a structured log entry: [ISO_TIMESTAMP][LOCAL_TIME][LEVEL]: message [data]
|
|
20
|
+
* @param level - The log level to format for
|
|
21
|
+
* @param message - The message content to format
|
|
22
|
+
* @param data - Optional data object to include in the log output
|
|
23
|
+
* @returns Formatted string with ANSI colors and timestamps
|
|
24
|
+
*/
|
|
25
25
|
static format(level, message, data) {
|
|
26
26
|
const { isoTimestamp, timeString } = (0, timestamp_1.getTimestampComponents)();
|
|
27
27
|
const timestamp = (0, timestamp_1.formatTimestamp)(isoTimestamp, timeString, colors_1.colorScheme);
|
|
28
|
-
const levelName =
|
|
29
|
-
const levelColor =
|
|
28
|
+
const levelName = MessageFormatter.getLevelName(level);
|
|
29
|
+
const levelColor = MessageFormatter.getLevelColor(level);
|
|
30
30
|
const coloredLevel = `${levelColor}[${levelName}]${colors_1.colors.reset}`;
|
|
31
31
|
// Format the base message
|
|
32
32
|
let formattedMessage = `${timestamp}${coloredLevel}: ${message}`;
|
|
@@ -40,11 +40,11 @@ class MessageFormatter {
|
|
|
40
40
|
return formattedMessage + colors_1.colors.reset;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
* Formats a Log Engine system message with [LOG ENGINE] prefix instead of log levels
|
|
44
|
+
* Used for internal messages like deprecation warnings that should be distinguished from user logs
|
|
45
|
+
* @param message - The system message content to format
|
|
46
|
+
* @returns Formatted string with ANSI colors, timestamps, and LOG ENGINE prefix
|
|
47
|
+
*/
|
|
48
48
|
static formatSystemMessage(message) {
|
|
49
49
|
const { isoTimestamp, timeString } = (0, timestamp_1.getTimestampComponents)();
|
|
50
50
|
const timestamp = (0, timestamp_1.formatTimestamp)(isoTimestamp, timeString, colors_1.colorScheme);
|
|
@@ -53,10 +53,10 @@ class MessageFormatter {
|
|
|
53
53
|
return `${timestamp}${coloredLogEngine}: ${coloredMessage}`;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
* Converts LogLevel enum to human-readable string
|
|
57
|
+
* @param level - The LogLevel to convert
|
|
58
|
+
* @returns String representation of the log level
|
|
59
|
+
*/
|
|
60
60
|
static getLevelName(level) {
|
|
61
61
|
switch (level) {
|
|
62
62
|
case types_1.LogLevel.DEBUG: return 'DEBUG';
|
|
@@ -68,11 +68,11 @@ class MessageFormatter {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
* Maps LogLevel to appropriate ANSI color code
|
|
72
|
+
* Colors help quickly identify message severity in console output
|
|
73
|
+
* @param level - The LogLevel to get color for
|
|
74
|
+
* @returns ANSI color escape sequence
|
|
75
|
+
*/
|
|
76
76
|
static getLevelColor(level) {
|
|
77
77
|
switch (level) {
|
|
78
78
|
case types_1.LogLevel.DEBUG: return colors_1.colors.magenta; // Purple for debug info
|
|
@@ -85,3 +85,4 @@ class MessageFormatter {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
exports.MessageFormatter = MessageFormatter;
|
|
88
|
+
//# sourceMappingURL=message-formatter.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core message formatting functionality
|
|
3
|
+
* Handles the main log message formatting with colors, timestamps, and levels
|
|
4
|
+
*/
|
|
5
|
+
import { LogLevel, LogData } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* Core message formatter class
|
|
8
|
+
* Provides the main formatting functionality for log messages
|
|
9
|
+
*/
|
|
10
|
+
export declare class MessageFormatter {
|
|
11
|
+
/**
|
|
12
|
+
* Formats a log message with timestamp, level indicator, and appropriate coloring
|
|
13
|
+
* Creates a structured log entry: [ISO_TIMESTAMP][LOCAL_TIME][LEVEL]: message [data]
|
|
14
|
+
* @param level - The log level to format for
|
|
15
|
+
* @param message - The message content to format
|
|
16
|
+
* @param data - Optional data object to include in the log output
|
|
17
|
+
* @returns Formatted string with ANSI colors and timestamps
|
|
18
|
+
*/
|
|
19
|
+
static format(level: LogLevel, message: string, data?: LogData): string;
|
|
20
|
+
/**
|
|
21
|
+
* Formats a Log Engine system message with [LOG ENGINE] prefix instead of log levels
|
|
22
|
+
* Used for internal messages like deprecation warnings that should be distinguished from user logs
|
|
23
|
+
* @param message - The system message content to format
|
|
24
|
+
* @returns Formatted string with ANSI colors, timestamps, and LOG ENGINE prefix
|
|
25
|
+
*/
|
|
26
|
+
static formatSystemMessage(message: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Converts LogLevel enum to human-readable string
|
|
29
|
+
* @param level - The LogLevel to convert
|
|
30
|
+
* @returns String representation of the log level
|
|
31
|
+
*/
|
|
32
|
+
private static getLevelName;
|
|
33
|
+
/**
|
|
34
|
+
* Maps LogLevel to appropriate ANSI color code
|
|
35
|
+
* Colors help quickly identify message severity in console output
|
|
36
|
+
* @param level - The LogLevel to get color for
|
|
37
|
+
* @returns ANSI color escape sequence
|
|
38
|
+
*/
|
|
39
|
+
private static getLevelColor;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=message-formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-formatter.d.ts","sourceRoot":"","sources":["../../../src/formatter/message-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAK7C;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B;;;;;;;SAOK;IACL,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM;IAsBvE;;;;;SAKK;IACL,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAUnD;;;;SAIK;IACL,OAAO,CAAC,MAAM,CAAC,YAAY;IAW3B;;;;;SAKK;IACL,OAAO,CAAC,MAAM,CAAC,aAAa;CAU7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-formatter.js","sourceRoot":"","sources":["../../../src/formatter/message-formatter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,oCAA6C;AAC7C,qCAA+C;AAC/C,2CAAsE;AACtE,qDAAyD;AAEzD;;;GAGG;AACH,MAAa,gBAAgB;IAC3B;;;;;;;SAOK;IACL,MAAM,CAAC,MAAM,CAAC,KAAe,EAAE,OAAe,EAAE,IAAc;QAC5D,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,IAAA,kCAAsB,GAAE,CAAC;QAC9D,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC,YAAY,EAAE,UAAU,EAAE,oBAAW,CAAC,CAAC;QAEzE,MAAM,SAAS,GAAG,gBAAgB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACvD,MAAM,UAAU,GAAG,gBAAgB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACzD,MAAM,YAAY,GAAG,GAAG,UAAU,IAAI,SAAS,IAAI,eAAM,CAAC,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AKR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timestamp.js","sourceRoot":"","sources":["../../../src/formatter/timestamp.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAOH,wDAgBC;AAUD,0CASC;AAxCD;;;;GAIG;AACH,SAAgB,sBAAsB;IAIpC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,YAAY,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IACvC,MAAM,UAAU,GAAG,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE;QACjD,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,IAAI;KACb,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAEvB,OAAO;QACL,YAAY;QACZ,UAAU;KACX,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,eAAe,CAC7B,YAAoB,EACpB,UAAkB,EAClB,MAAgE;IAEhE,MAAM,gBAAgB,GAAG,GAAG,MAAM,CAAC,SAAS,IAAI,YAAY,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;IAC/E,MAAM,iBAAiB,GAAG,GAAG,MAAM,CAAC,UAAU,IAAI,UAAU,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;IAE/E,OAAO,GAAG,gBAAgB,GAAG,iBAAiB,EAAE,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Main LogEngine module - provides a comprehensive logging solution
|
|
4
|
+
* with mode-based filtering, colorized output, and automatic data redaction
|
|
5
|
+
*
|
|
6
|
+
* Features a modular architecture with separate modules for:
|
|
7
|
+
* - Logger: Core logging functionality with environment-based configuration
|
|
8
|
+
* - Formatter: Message formatting with ANSI colors and timestamps
|
|
9
|
+
* - Redaction: Automatic sensitive data protection with customizable patterns
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { LogEngine, LogMode } from '@wgtechlabs/log-engine';
|
|
14
|
+
*
|
|
15
|
+
* // Configure logging mode
|
|
16
|
+
* LogEngine.configure({ mode: LogMode.DEBUG });
|
|
17
|
+
*
|
|
18
|
+
* // Log with automatic redaction
|
|
19
|
+
* LogEngine.info('User login', { username: 'john', password: 'secret123' });
|
|
20
|
+
* // Output: [2025-06-18T...][3:45PM][INFO]: User login { username: 'john', password: '[REDACTED]' }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.RedactionController = exports.defaultRedactionConfig = exports.DataRedactor = exports.LogLevel = exports.LogMode = exports.LogEngine = void 0;
|
|
25
|
+
const logger_1 = require("./logger/index.cjs");
|
|
26
|
+
const redaction_1 = require("./redaction/index.cjs");
|
|
27
|
+
// Create a singleton logger instance
|
|
28
|
+
const logger = new logger_1.Logger();
|
|
29
|
+
/**
|
|
30
|
+
* LogEngine - The main interface for logging operations
|
|
31
|
+
* Provides a simple, intuitive API for all logging needs with security-first design
|
|
32
|
+
*/
|
|
33
|
+
exports.LogEngine = {
|
|
34
|
+
/**
|
|
35
|
+
* Configure the logger with new settings
|
|
36
|
+
* @param config - Configuration object containing logger settings
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* LogEngine.configure({ mode: LogMode.PRODUCTION });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
configure: (config) => logger.configure(config),
|
|
43
|
+
// Standard logging methods with automatic redaction
|
|
44
|
+
/**
|
|
45
|
+
* Log a debug message with automatic data redaction
|
|
46
|
+
* Only shown in DEVELOPMENT mode
|
|
47
|
+
* @param message - The debug message to log
|
|
48
|
+
* @param data - Optional data object to log (sensitive data will be redacted)
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* LogEngine.debug('Processing user data', { userId: 123, email: 'user@example.com' });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
debug: (message, data) => logger.debug(message, data),
|
|
55
|
+
/**
|
|
56
|
+
* Log an info message with automatic data redaction
|
|
57
|
+
* Shown in DEVELOPMENT and PRODUCTION modes
|
|
58
|
+
* @param message - The info message to log
|
|
59
|
+
* @param data - Optional data object to log (sensitive data will be redacted)
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* LogEngine.info('User login successful', { username: 'john' });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
info: (message, data) => logger.info(message, data),
|
|
66
|
+
/**
|
|
67
|
+
* Log a warning message with automatic data redaction
|
|
68
|
+
* Shown in DEVELOPMENT and PRODUCTION modes
|
|
69
|
+
* @param message - The warning message to log
|
|
70
|
+
* @param data - Optional data object to log (sensitive data will be redacted)
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* LogEngine.warn('API rate limit approaching', { requestsRemaining: 10 });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
warn: (message, data) => logger.warn(message, data),
|
|
77
|
+
/**
|
|
78
|
+
* Log an error message with automatic data redaction
|
|
79
|
+
* Shown in DEVELOPMENT and PRODUCTION modes
|
|
80
|
+
* @param message - The error message to log
|
|
81
|
+
* @param data - Optional data object to log (sensitive data will be redacted)
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* LogEngine.error('Database connection failed', { host: 'localhost', port: 5432 });
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
error: (message, data) => logger.error(message, data),
|
|
88
|
+
/**
|
|
89
|
+
* Log a critical message with automatic data redaction
|
|
90
|
+
* Always shown regardless of mode (except OFF)
|
|
91
|
+
* @param message - The critical log message to log
|
|
92
|
+
* @param data - Optional data object to log (sensitive data will be redacted)
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* LogEngine.log('Application starting', { version: '1.0.0' });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
log: (message, data) => logger.log(message, data),
|
|
99
|
+
// Raw methods that bypass redaction (use with caution)
|
|
100
|
+
/**
|
|
101
|
+
* Log a debug message without redaction (use with caution)
|
|
102
|
+
* Bypasses automatic data redaction for debugging purposes
|
|
103
|
+
* @param message - The debug message to log
|
|
104
|
+
* @param data - Optional data object to log (no redaction applied)
|
|
105
|
+
*/
|
|
106
|
+
debugRaw: (message, data) => logger.debugRaw(message, data),
|
|
107
|
+
/**
|
|
108
|
+
* Log an info message without redaction (use with caution)
|
|
109
|
+
* Bypasses automatic data redaction for debugging purposes
|
|
110
|
+
* @param message - The info message to log
|
|
111
|
+
* @param data - Optional data object to log (no redaction applied)
|
|
112
|
+
*/
|
|
113
|
+
infoRaw: (message, data) => logger.infoRaw(message, data),
|
|
114
|
+
/**
|
|
115
|
+
* Log a warning message without redaction (use with caution)
|
|
116
|
+
* Bypasses automatic data redaction for debugging purposes
|
|
117
|
+
* @param message - The warning message to log
|
|
118
|
+
* @param data - Optional data object to log (no redaction applied)
|
|
119
|
+
*/
|
|
120
|
+
warnRaw: (message, data) => logger.warnRaw(message, data),
|
|
121
|
+
/**
|
|
122
|
+
* Log an error message without redaction (use with caution)
|
|
123
|
+
* Bypasses automatic data redaction for debugging purposes
|
|
124
|
+
* @param message - The error message to log
|
|
125
|
+
* @param data - Optional data object to log (no redaction applied)
|
|
126
|
+
*/
|
|
127
|
+
errorRaw: (message, data) => logger.errorRaw(message, data),
|
|
128
|
+
/**
|
|
129
|
+
* Log a critical message without redaction (use with caution)
|
|
130
|
+
* Bypasses automatic data redaction for debugging purposes
|
|
131
|
+
* @param message - The critical log message to log
|
|
132
|
+
* @param data - Optional data object to log (no redaction applied)
|
|
133
|
+
*/
|
|
134
|
+
logRaw: (message, data) => logger.logRaw(message, data),
|
|
135
|
+
// Redaction configuration methods
|
|
136
|
+
/**
|
|
137
|
+
* Configure data redaction settings
|
|
138
|
+
* @param config - Partial redaction configuration to apply
|
|
139
|
+
*/
|
|
140
|
+
configureRedaction: (config) => redaction_1.DataRedactor.updateConfig(config),
|
|
141
|
+
/**
|
|
142
|
+
* Refresh redaction configuration from environment variables
|
|
143
|
+
* Useful for picking up runtime environment changes
|
|
144
|
+
*/
|
|
145
|
+
refreshRedactionConfig: () => redaction_1.DataRedactor.refreshConfig(),
|
|
146
|
+
/**
|
|
147
|
+
* Reset redaction configuration to defaults
|
|
148
|
+
*/
|
|
149
|
+
resetRedactionConfig: () => redaction_1.DataRedactor.updateConfig(redaction_1.defaultRedactionConfig),
|
|
150
|
+
/**
|
|
151
|
+
* Get current redaction configuration
|
|
152
|
+
* @returns Current redaction configuration
|
|
153
|
+
*/
|
|
154
|
+
getRedactionConfig: () => redaction_1.DataRedactor.getConfig(),
|
|
155
|
+
// Advanced redaction methods
|
|
156
|
+
/**
|
|
157
|
+
* Add custom regex patterns for advanced field detection
|
|
158
|
+
* @param patterns - Array of regex patterns to add
|
|
159
|
+
*/
|
|
160
|
+
addCustomRedactionPatterns: (patterns) => redaction_1.DataRedactor.addCustomPatterns(patterns),
|
|
161
|
+
/**
|
|
162
|
+
* Clear all custom redaction patterns
|
|
163
|
+
*/
|
|
164
|
+
clearCustomRedactionPatterns: () => redaction_1.DataRedactor.clearCustomPatterns(),
|
|
165
|
+
/**
|
|
166
|
+
* Add custom sensitive field names to the existing list
|
|
167
|
+
* @param fields - Array of field names to add
|
|
168
|
+
*/
|
|
169
|
+
addSensitiveFields: (fields) => redaction_1.DataRedactor.addSensitiveFields(fields),
|
|
170
|
+
/**
|
|
171
|
+
* Test if a field name would be redacted with current configuration
|
|
172
|
+
* @param fieldName - Field name to test
|
|
173
|
+
* @returns true if field would be redacted, false otherwise
|
|
174
|
+
*/
|
|
175
|
+
testFieldRedaction: (fieldName) => redaction_1.DataRedactor.testFieldRedaction(fieldName),
|
|
176
|
+
/**
|
|
177
|
+
* Temporarily disable redaction for a specific logging call
|
|
178
|
+
* @returns LogEngine instance with redaction bypassed
|
|
179
|
+
* @example
|
|
180
|
+
* ```typescript
|
|
181
|
+
* LogEngine.withoutRedaction().info('Debug data', sensitiveObject);
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
withoutRedaction: () => ({
|
|
185
|
+
debug: (message, data) => logger.debugRaw(message, data),
|
|
186
|
+
info: (message, data) => logger.infoRaw(message, data),
|
|
187
|
+
warn: (message, data) => logger.warnRaw(message, data),
|
|
188
|
+
error: (message, data) => logger.errorRaw(message, data),
|
|
189
|
+
log: (message, data) => logger.logRaw(message, data)
|
|
190
|
+
})
|
|
191
|
+
};
|
|
192
|
+
// Re-export types and utilities for external use
|
|
193
|
+
var types_1 = require("./types/index.cjs");
|
|
194
|
+
Object.defineProperty(exports, "LogMode", { enumerable: true, get: function () { return types_1.LogMode; } });
|
|
195
|
+
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return types_1.LogLevel; } });
|
|
196
|
+
var redaction_2 = require("./redaction/index.cjs");
|
|
197
|
+
Object.defineProperty(exports, "DataRedactor", { enumerable: true, get: function () { return redaction_2.DataRedactor; } });
|
|
198
|
+
Object.defineProperty(exports, "defaultRedactionConfig", { enumerable: true, get: function () { return redaction_2.defaultRedactionConfig; } });
|
|
199
|
+
Object.defineProperty(exports, "RedactionController", { enumerable: true, get: function () { return redaction_2.RedactionController; } });
|
|
200
|
+
// Default export for convenience
|
|
201
|
+
exports.default = exports.LogEngine;
|
|
202
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main LogEngine module - provides a comprehensive logging solution
|
|
3
|
+
* with mode-based filtering, colorized output, and automatic data redaction
|
|
4
|
+
*
|
|
5
|
+
* Features a modular architecture with separate modules for:
|
|
6
|
+
* - Logger: Core logging functionality with environment-based configuration
|
|
7
|
+
* - Formatter: Message formatting with ANSI colors and timestamps
|
|
8
|
+
* - Redaction: Automatic sensitive data protection with customizable patterns
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { LogEngine, LogMode } from '@wgtechlabs/log-engine';
|
|
13
|
+
*
|
|
14
|
+
* // Configure logging mode
|
|
15
|
+
* LogEngine.configure({ mode: LogMode.DEBUG });
|
|
16
|
+
*
|
|
17
|
+
* // Log with automatic redaction
|
|
18
|
+
* LogEngine.info('User login', { username: 'john', password: 'secret123' });
|
|
19
|
+
* // Output: [2025-06-18T...][3:45PM][INFO]: User login { username: 'john', password: '[REDACTED]' }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
import type { LoggerConfig, RedactionConfig, ILogEngineWithoutRedaction, LogData } from './types';
|
|
23
|
+
/**
|
|
24
|
+
* LogEngine - The main interface for logging operations
|
|
25
|
+
* Provides a simple, intuitive API for all logging needs with security-first design
|
|
26
|
+
*/
|
|
27
|
+
export declare const LogEngine: {
|
|
28
|
+
/**
|
|
29
|
+
* Configure the logger with new settings
|
|
30
|
+
* @param config - Configuration object containing logger settings
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* LogEngine.configure({ mode: LogMode.PRODUCTION });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
configure: (config: Partial<LoggerConfig>) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Log a debug message with automatic data redaction
|
|
39
|
+
* Only shown in DEVELOPMENT mode
|
|
40
|
+
* @param message - The debug message to log
|
|
41
|
+
* @param data - Optional data object to log (sensitive data will be redacted)
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* LogEngine.debug('Processing user data', { userId: 123, email: 'user@example.com' });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
debug: (message: string, data?: LogData) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Log an info message with automatic data redaction
|
|
50
|
+
* Shown in DEVELOPMENT and PRODUCTION modes
|
|
51
|
+
* @param message - The info message to log
|
|
52
|
+
* @param data - Optional data object to log (sensitive data will be redacted)
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* LogEngine.info('User login successful', { username: 'john' });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
info: (message: string, data?: LogData) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Log a warning message with automatic data redaction
|
|
61
|
+
* Shown in DEVELOPMENT and PRODUCTION modes
|
|
62
|
+
* @param message - The warning message to log
|
|
63
|
+
* @param data - Optional data object to log (sensitive data will be redacted)
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* LogEngine.warn('API rate limit approaching', { requestsRemaining: 10 });
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
warn: (message: string, data?: LogData) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Log an error message with automatic data redaction
|
|
72
|
+
* Shown in DEVELOPMENT and PRODUCTION modes
|
|
73
|
+
* @param message - The error message to log
|
|
74
|
+
* @param data - Optional data object to log (sensitive data will be redacted)
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* LogEngine.error('Database connection failed', { host: 'localhost', port: 5432 });
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
error: (message: string, data?: LogData) => void;
|
|
81
|
+
/**
|
|
82
|
+
* Log a critical message with automatic data redaction
|
|
83
|
+
* Always shown regardless of mode (except OFF)
|
|
84
|
+
* @param message - The critical log message to log
|
|
85
|
+
* @param data - Optional data object to log (sensitive data will be redacted)
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* LogEngine.log('Application starting', { version: '1.0.0' });
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
log: (message: string, data?: LogData) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Log a debug message without redaction (use with caution)
|
|
94
|
+
* Bypasses automatic data redaction for debugging purposes
|
|
95
|
+
* @param message - The debug message to log
|
|
96
|
+
* @param data - Optional data object to log (no redaction applied)
|
|
97
|
+
*/
|
|
98
|
+
debugRaw: (message: string, data?: LogData) => void;
|
|
99
|
+
/**
|
|
100
|
+
* Log an info message without redaction (use with caution)
|
|
101
|
+
* Bypasses automatic data redaction for debugging purposes
|
|
102
|
+
* @param message - The info message to log
|
|
103
|
+
* @param data - Optional data object to log (no redaction applied)
|
|
104
|
+
*/
|
|
105
|
+
infoRaw: (message: string, data?: LogData) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Log a warning message without redaction (use with caution)
|
|
108
|
+
* Bypasses automatic data redaction for debugging purposes
|
|
109
|
+
* @param message - The warning message to log
|
|
110
|
+
* @param data - Optional data object to log (no redaction applied)
|
|
111
|
+
*/
|
|
112
|
+
warnRaw: (message: string, data?: LogData) => void;
|
|
113
|
+
/**
|
|
114
|
+
* Log an error message without redaction (use with caution)
|
|
115
|
+
* Bypasses automatic data redaction for debugging purposes
|
|
116
|
+
* @param message - The error message to log
|
|
117
|
+
* @param data - Optional data object to log (no redaction applied)
|
|
118
|
+
*/
|
|
119
|
+
errorRaw: (message: string, data?: LogData) => void;
|
|
120
|
+
/**
|
|
121
|
+
* Log a critical message without redaction (use with caution)
|
|
122
|
+
* Bypasses automatic data redaction for debugging purposes
|
|
123
|
+
* @param message - The critical log message to log
|
|
124
|
+
* @param data - Optional data object to log (no redaction applied)
|
|
125
|
+
*/
|
|
126
|
+
logRaw: (message: string, data?: LogData) => void;
|
|
127
|
+
/**
|
|
128
|
+
* Configure data redaction settings
|
|
129
|
+
* @param config - Partial redaction configuration to apply
|
|
130
|
+
*/
|
|
131
|
+
configureRedaction: (config: Partial<RedactionConfig>) => void;
|
|
132
|
+
/**
|
|
133
|
+
* Refresh redaction configuration from environment variables
|
|
134
|
+
* Useful for picking up runtime environment changes
|
|
135
|
+
*/
|
|
136
|
+
refreshRedactionConfig: () => void;
|
|
137
|
+
/**
|
|
138
|
+
* Reset redaction configuration to defaults
|
|
139
|
+
*/
|
|
140
|
+
resetRedactionConfig: () => void;
|
|
141
|
+
/**
|
|
142
|
+
* Get current redaction configuration
|
|
143
|
+
* @returns Current redaction configuration
|
|
144
|
+
*/
|
|
145
|
+
getRedactionConfig: () => RedactionConfig;
|
|
146
|
+
/**
|
|
147
|
+
* Add custom regex patterns for advanced field detection
|
|
148
|
+
* @param patterns - Array of regex patterns to add
|
|
149
|
+
*/
|
|
150
|
+
addCustomRedactionPatterns: (patterns: RegExp[]) => void;
|
|
151
|
+
/**
|
|
152
|
+
* Clear all custom redaction patterns
|
|
153
|
+
*/
|
|
154
|
+
clearCustomRedactionPatterns: () => void;
|
|
155
|
+
/**
|
|
156
|
+
* Add custom sensitive field names to the existing list
|
|
157
|
+
* @param fields - Array of field names to add
|
|
158
|
+
*/
|
|
159
|
+
addSensitiveFields: (fields: string[]) => void;
|
|
160
|
+
/**
|
|
161
|
+
* Test if a field name would be redacted with current configuration
|
|
162
|
+
* @param fieldName - Field name to test
|
|
163
|
+
* @returns true if field would be redacted, false otherwise
|
|
164
|
+
*/
|
|
165
|
+
testFieldRedaction: (fieldName: string) => boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Temporarily disable redaction for a specific logging call
|
|
168
|
+
* @returns LogEngine instance with redaction bypassed
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* LogEngine.withoutRedaction().info('Debug data', sensitiveObject);
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
withoutRedaction: () => ILogEngineWithoutRedaction;
|
|
175
|
+
};
|
|
176
|
+
export { LogMode, LogLevel } from './types';
|
|
177
|
+
export type { LoggerConfig, RedactionConfig, LogOutputHandler, BuiltInOutputHandler, OutputTarget, FileOutputConfig, HttpOutputConfig, AdvancedOutputConfig, EnhancedOutputTarget } from './types';
|
|
178
|
+
export { DataRedactor, defaultRedactionConfig, RedactionController } from './redaction';
|
|
179
|
+
export default LogEngine;
|
|
180
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot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