@wgtechlabs/log-engine 2.0.0 → 2.1.0
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/formatter/data-formatter.d.ts +2 -1
- package/dist/formatter/data-formatter.d.ts.map +1 -1
- package/dist/formatter/data-formatter.js +1 -1
- package/dist/formatter/message-formatter.d.ts +23 -23
- package/dist/formatter/message-formatter.d.ts.map +1 -1
- package/dist/formatter/message-formatter.js +23 -23
- package/dist/formatter/timestamp.d.ts.map +1 -1
- package/dist/index.d.ts +130 -136
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +108 -108
- package/dist/logger/advanced-outputs.d.ts +159 -0
- package/dist/logger/advanced-outputs.d.ts.map +1 -0
- package/dist/logger/advanced-outputs.js +586 -0
- package/dist/logger/config.d.ts +18 -18
- package/dist/logger/config.d.ts.map +1 -1
- package/dist/logger/config.js +32 -29
- package/dist/logger/core.d.ts +128 -84
- package/dist/logger/core.d.ts.map +1 -1
- package/dist/logger/core.js +259 -74
- package/dist/logger/environment.d.ts +15 -15
- package/dist/logger/environment.d.ts.map +1 -1
- package/dist/logger/environment.js +15 -15
- package/dist/logger/filtering.d.ts +16 -16
- package/dist/logger/filtering.d.ts.map +1 -1
- package/dist/logger/filtering.js +37 -22
- package/dist/redaction/config.d.ts +8 -8
- package/dist/redaction/config.d.ts.map +1 -1
- package/dist/redaction/config.js +8 -8
- package/dist/redaction/redactor.d.ts +60 -60
- package/dist/redaction/redactor.d.ts.map +1 -1
- package/dist/redaction/redactor.js +101 -96
- package/dist/types/index.d.ts +98 -16
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +80 -68
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Data formatting utilities for log output
|
|
3
3
|
* Handles serialization and formatting of data objects in log messages
|
|
4
4
|
*/
|
|
5
|
+
import { LogData } from '../types';
|
|
5
6
|
/**
|
|
6
7
|
* Converts input data to a readable string suitable for log output.
|
|
7
8
|
*
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
* @param data - The value to format for logging
|
|
11
12
|
* @returns The formatted string representation of the input data
|
|
12
13
|
*/
|
|
13
|
-
export declare function formatData(data:
|
|
14
|
+
export declare function formatData(data: LogData): string;
|
|
14
15
|
/**
|
|
15
16
|
* Applies color styling to a formatted data string using the provided color codes.
|
|
16
17
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-formatter.d.ts","sourceRoot":"","sources":["../../src/formatter/data-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"data-formatter.d.ts","sourceRoot":"","sources":["../../src/formatter/data-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CA2BhD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAM7F"}
|
|
@@ -2,40 +2,40 @@
|
|
|
2
2
|
* Core message formatting functionality
|
|
3
3
|
* Handles the main log message formatting with colors, timestamps, and levels
|
|
4
4
|
*/
|
|
5
|
-
import { LogLevel } from '../types';
|
|
5
|
+
import { LogLevel, LogData } from '../types';
|
|
6
6
|
/**
|
|
7
7
|
* Core message formatter class
|
|
8
8
|
* Provides the main formatting functionality for log messages
|
|
9
9
|
*/
|
|
10
10
|
export declare class MessageFormatter {
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
static format(level: LogLevel, message: string, data?:
|
|
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
20
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
26
|
static formatSystemMessage(message: string): string;
|
|
27
27
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
32
|
private static getLevelName;
|
|
33
33
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
39
|
private static getLevelColor;
|
|
40
40
|
}
|
|
41
41
|
//# sourceMappingURL=message-formatter.d.ts.map
|
|
@@ -1 +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,MAAM,UAAU,CAAC;
|
|
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"}
|
|
@@ -15,18 +15,18 @@ const data_formatter_1 = require("./data-formatter");
|
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timestamp.d.ts","sourceRoot":"","sources":["../../src/formatter/timestamp.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"timestamp.d.ts","sourceRoot":"","sources":["../../src/formatter/timestamp.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CAClB,CAaJ;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/D,MAAM,CAKR"}
|
package/dist/index.d.ts
CHANGED
|
@@ -19,168 +19,162 @@
|
|
|
19
19
|
* // Output: [2025-06-18T...][3:45PM][INFO]: User login { username: 'john', password: '[REDACTED]' }
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
import type { LoggerConfig, RedactionConfig } from './types';
|
|
22
|
+
import type { LoggerConfig, RedactionConfig, ILogEngineWithoutRedaction, LogData } from './types';
|
|
23
23
|
/**
|
|
24
24
|
* LogEngine - The main interface for logging operations
|
|
25
25
|
* Provides a simple, intuitive API for all logging needs with security-first design
|
|
26
26
|
*/
|
|
27
27
|
export declare const LogEngine: {
|
|
28
28
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
36
|
configure: (config: Partial<LoggerConfig>) => void;
|
|
37
37
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
debug: (message: string, data?:
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
info: (message: string, data?:
|
|
59
|
-
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
warn: (message: string, data?:
|
|
70
|
-
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
error: (message: string, data?:
|
|
81
|
-
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
log: (message: string, data?:
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
debugRaw: (message: string, data?:
|
|
99
|
-
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
infoRaw: (message: string, data?:
|
|
106
|
-
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
warnRaw: (message: string, data?:
|
|
113
|
-
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
errorRaw: (message: string, data?:
|
|
120
|
-
/**
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
logRaw: (message: string, data?:
|
|
127
|
-
/**
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
131
|
configureRedaction: (config: Partial<RedactionConfig>) => void;
|
|
132
132
|
/**
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
* Refresh redaction configuration from environment variables
|
|
134
|
+
* Useful for picking up runtime environment changes
|
|
135
|
+
*/
|
|
136
136
|
refreshRedactionConfig: () => void;
|
|
137
137
|
/**
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
* Reset redaction configuration to defaults
|
|
139
|
+
*/
|
|
140
140
|
resetRedactionConfig: () => void;
|
|
141
141
|
/**
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
* Get current redaction configuration
|
|
143
|
+
* @returns Current redaction configuration
|
|
144
|
+
*/
|
|
145
145
|
getRedactionConfig: () => RedactionConfig;
|
|
146
146
|
/**
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
* Add custom regex patterns for advanced field detection
|
|
148
|
+
* @param patterns - Array of regex patterns to add
|
|
149
|
+
*/
|
|
150
150
|
addCustomRedactionPatterns: (patterns: RegExp[]) => void;
|
|
151
151
|
/**
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
* Clear all custom redaction patterns
|
|
153
|
+
*/
|
|
154
154
|
clearCustomRedactionPatterns: () => void;
|
|
155
155
|
/**
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
* Add custom sensitive field names to the existing list
|
|
157
|
+
* @param fields - Array of field names to add
|
|
158
|
+
*/
|
|
159
159
|
addSensitiveFields: (fields: string[]) => void;
|
|
160
160
|
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
165
|
testFieldRedaction: (fieldName: string) => boolean;
|
|
166
166
|
/**
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
withoutRedaction: () =>
|
|
175
|
-
debug: (message: string, data?: any) => void;
|
|
176
|
-
info: (message: string, data?: any) => void;
|
|
177
|
-
warn: (message: string, data?: any) => void;
|
|
178
|
-
error: (message: string, data?: any) => void;
|
|
179
|
-
log: (message: string, data?: any) => void;
|
|
180
|
-
};
|
|
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;
|
|
181
175
|
};
|
|
182
176
|
export { LogMode, LogLevel } from './types';
|
|
183
|
-
export type { LoggerConfig, RedactionConfig } from './types';
|
|
177
|
+
export type { LoggerConfig, RedactionConfig, LogOutputHandler, BuiltInOutputHandler, OutputTarget, FileOutputConfig, HttpOutputConfig, AdvancedOutputConfig, EnhancedOutputTarget } from './types';
|
|
184
178
|
export { DataRedactor, defaultRedactionConfig, RedactionController } from './redaction';
|
|
185
179
|
export default LogEngine;
|
|
186
180
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,0BAA0B,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAMlG;;;GAGG;AACH,eAAO,MAAM,SAAS;IACpB;;;;;;;SAOK;wBACe,OAAO,CAAC,YAAY,CAAC,KAAG,IAAI;IAGhD;;;;;;;;;SASK;qBACY,MAAM,SAAS,OAAO,KAAG,IAAI;IAE9C;;;;;;;;;SASK;oBACW,MAAM,SAAS,OAAO,KAAG,IAAI;IAE7C;;;;;;;;;SASK;oBACW,MAAM,SAAS,OAAO,KAAG,IAAI;IAE7C;;;;;;;;;SASK;qBACY,MAAM,SAAS,OAAO,KAAG,IAAI;IAE9C;;;;;;;;;SASK;mBACU,MAAM,SAAS,OAAO,KAAG,IAAI;IAG5C;;;;;SAKK;wBACe,MAAM,SAAS,OAAO,KAAG,IAAI;IAEjD;;;;;SAKK;uBACc,MAAM,SAAS,OAAO,KAAG,IAAI;IAEhD;;;;;SAKK;uBACc,MAAM,SAAS,OAAO,KAAG,IAAI;IAEhD;;;;;SAKK;wBACe,MAAM,SAAS,OAAO,KAAG,IAAI;IAEjD;;;;;SAKK;sBACa,MAAM,SAAS,OAAO,KAAG,IAAI;IAG/C;;;SAGK;iCACwB,OAAO,CAAC,eAAe,CAAC,KAAG,IAAI;IAE5D;;;SAGK;kCACuB,IAAI;IAEhC;;SAEK;gCACqB,IAAI;IAE9B;;;SAGK;8BACmB,eAAe;IAGvC;;;SAGK;2CACkC,MAAM,EAAE,KAAG,IAAI;IAEtD;;SAEK;wCAC6B,IAAI;IAEtC;;;SAGK;iCACwB,MAAM,EAAE,KAAG,IAAI;IAE5C;;;;SAIK;oCAC2B,MAAM,KAAG,OAAO;IAEhD;;;;;;;SAOK;4BACiB,0BAA0B;CAOjD,CAAC;AAGF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,YAAY,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EAEZ,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGxF,eAAe,SAAS,CAAC"}
|