@wgtechlabs/log-engine 2.2.2 → 2.3.0-dev.8fdf09c

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.
Files changed (56) hide show
  1. package/README.md +234 -37
  2. package/dist/cjs/formatter/emoji-data.cjs +87 -0
  3. package/dist/cjs/formatter/emoji-data.d.ts +18 -0
  4. package/dist/cjs/formatter/emoji-data.d.ts.map +1 -0
  5. package/dist/cjs/formatter/emoji-data.js.map +1 -0
  6. package/dist/cjs/formatter/emoji-selector.cjs +209 -0
  7. package/dist/cjs/formatter/emoji-selector.d.ts +74 -0
  8. package/dist/cjs/formatter/emoji-selector.d.ts.map +1 -0
  9. package/dist/cjs/formatter/emoji-selector.js.map +1 -0
  10. package/dist/cjs/formatter/index.cjs +6 -1
  11. package/dist/cjs/formatter/index.d.ts +2 -0
  12. package/dist/cjs/formatter/index.d.ts.map +1 -1
  13. package/dist/cjs/formatter/index.js.map +1 -1
  14. package/dist/cjs/formatter/message-formatter.cjs +24 -3
  15. package/dist/cjs/formatter/message-formatter.d.ts +3 -2
  16. package/dist/cjs/formatter/message-formatter.d.ts.map +1 -1
  17. package/dist/cjs/formatter/message-formatter.js.map +1 -1
  18. package/dist/cjs/index.cjs +36 -16
  19. package/dist/cjs/index.d.ts +29 -12
  20. package/dist/cjs/index.d.ts.map +1 -1
  21. package/dist/cjs/index.js.map +1 -1
  22. package/dist/cjs/logger/core.cjs +43 -22
  23. package/dist/cjs/logger/core.d.ts +22 -11
  24. package/dist/cjs/logger/core.d.ts.map +1 -1
  25. package/dist/cjs/logger/core.js.map +1 -1
  26. package/dist/cjs/types/index.d.ts +59 -15
  27. package/dist/cjs/types/index.d.ts.map +1 -1
  28. package/dist/cjs/types/index.js.map +1 -1
  29. package/dist/esm/formatter/emoji-data.d.ts +18 -0
  30. package/dist/esm/formatter/emoji-data.d.ts.map +1 -0
  31. package/dist/esm/formatter/emoji-data.js +84 -0
  32. package/dist/esm/formatter/emoji-data.js.map +1 -0
  33. package/dist/esm/formatter/emoji-selector.d.ts +74 -0
  34. package/dist/esm/formatter/emoji-selector.d.ts.map +1 -0
  35. package/dist/esm/formatter/emoji-selector.js +205 -0
  36. package/dist/esm/formatter/emoji-selector.js.map +1 -0
  37. package/dist/esm/formatter/index.d.ts +2 -0
  38. package/dist/esm/formatter/index.d.ts.map +1 -1
  39. package/dist/esm/formatter/index.js +2 -0
  40. package/dist/esm/formatter/index.js.map +1 -1
  41. package/dist/esm/formatter/message-formatter.d.ts +3 -2
  42. package/dist/esm/formatter/message-formatter.d.ts.map +1 -1
  43. package/dist/esm/formatter/message-formatter.js +24 -3
  44. package/dist/esm/formatter/message-formatter.js.map +1 -1
  45. package/dist/esm/index.d.ts +29 -12
  46. package/dist/esm/index.d.ts.map +1 -1
  47. package/dist/esm/index.js +32 -15
  48. package/dist/esm/index.js.map +1 -1
  49. package/dist/esm/logger/core.d.ts +22 -11
  50. package/dist/esm/logger/core.d.ts.map +1 -1
  51. package/dist/esm/logger/core.js +44 -23
  52. package/dist/esm/logger/core.js.map +1 -1
  53. package/dist/esm/types/index.d.ts +59 -15
  54. package/dist/esm/types/index.d.ts.map +1 -1
  55. package/dist/esm/types/index.js.map +1 -1
  56. package/package.json +3 -2
@@ -19,7 +19,7 @@
19
19
  * // Output: [2025-06-18T...][3:45PM][INFO]: User login { username: 'john', password: '[REDACTED]' }
20
20
  * ```
21
21
  */
22
- import type { LoggerConfig, RedactionConfig, ILogEngineWithoutRedaction, LogData } from './types';
22
+ import type { LoggerConfig, RedactionConfig, ILogEngineWithoutRedaction, LogData, LogCallOptions } 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
@@ -39,91 +39,106 @@ export declare const LogEngine: {
39
39
  * Only shown in DEVELOPMENT mode
40
40
  * @param message - The debug message to log
41
41
  * @param data - Optional data object to log (sensitive data will be redacted)
42
+ * @param options - Optional per-call options (e.g., emoji override)
42
43
  * @example
43
44
  * ```typescript
44
45
  * LogEngine.debug('Processing user data', { userId: 123, email: 'user@example.com' });
46
+ * LogEngine.debug('Starting process', undefined, { emoji: '🔍' });
45
47
  * ```
46
48
  */
47
- debug: (message: string, data?: LogData) => void;
49
+ debug: (message: string, data?: LogData, options?: LogCallOptions) => void;
48
50
  /**
49
51
  * Log an info message with automatic data redaction
50
52
  * Shown in DEVELOPMENT and PRODUCTION modes
51
53
  * @param message - The info message to log
52
54
  * @param data - Optional data object to log (sensitive data will be redacted)
55
+ * @param options - Optional per-call options (e.g., emoji override)
53
56
  * @example
54
57
  * ```typescript
55
58
  * LogEngine.info('User login successful', { username: 'john' });
59
+ * LogEngine.info('Database initialized', undefined, { emoji: '✅' });
56
60
  * ```
57
61
  */
58
- info: (message: string, data?: LogData) => void;
62
+ info: (message: string, data?: LogData, options?: LogCallOptions) => void;
59
63
  /**
60
64
  * Log a warning message with automatic data redaction
61
65
  * Shown in DEVELOPMENT and PRODUCTION modes
62
66
  * @param message - The warning message to log
63
67
  * @param data - Optional data object to log (sensitive data will be redacted)
68
+ * @param options - Optional per-call options (e.g., emoji override)
64
69
  * @example
65
70
  * ```typescript
66
71
  * LogEngine.warn('API rate limit approaching', { requestsRemaining: 10 });
72
+ * LogEngine.warn('Low disk space', undefined, { emoji: '💾' });
67
73
  * ```
68
74
  */
69
- warn: (message: string, data?: LogData) => void;
75
+ warn: (message: string, data?: LogData, options?: LogCallOptions) => void;
70
76
  /**
71
77
  * Log an error message with automatic data redaction
72
78
  * Shown in DEVELOPMENT and PRODUCTION modes
73
79
  * @param message - The error message to log
74
80
  * @param data - Optional data object to log (sensitive data will be redacted)
81
+ * @param options - Optional per-call options (e.g., emoji override)
75
82
  * @example
76
83
  * ```typescript
77
84
  * LogEngine.error('Database connection failed', { host: 'localhost', port: 5432 });
85
+ * LogEngine.error('Critical failure', undefined, { emoji: '💥' });
78
86
  * ```
79
87
  */
80
- error: (message: string, data?: LogData) => void;
88
+ error: (message: string, data?: LogData, options?: LogCallOptions) => void;
81
89
  /**
82
90
  * Log a critical message with automatic data redaction
83
91
  * Always shown regardless of mode (except OFF)
84
92
  * @param message - The critical log message to log
85
93
  * @param data - Optional data object to log (sensitive data will be redacted)
94
+ * @param options - Optional per-call options (e.g., emoji override)
86
95
  * @example
87
96
  * ```typescript
88
97
  * LogEngine.log('Application starting', { version: '1.0.0' });
98
+ * LogEngine.log('System ready', undefined, { emoji: '🚀' });
89
99
  * ```
90
100
  */
91
- log: (message: string, data?: LogData) => void;
101
+ log: (message: string, data?: LogData, options?: LogCallOptions) => void;
92
102
  /**
93
103
  * Log a debug message without redaction (use with caution)
94
104
  * Bypasses automatic data redaction for debugging purposes
95
105
  * @param message - The debug message to log
96
106
  * @param data - Optional data object to log (no redaction applied)
107
+ * @param options - Optional per-call options (e.g., emoji override)
97
108
  */
98
- debugRaw: (message: string, data?: LogData) => void;
109
+ debugRaw: (message: string, data?: LogData, options?: LogCallOptions) => void;
99
110
  /**
100
111
  * Log an info message without redaction (use with caution)
101
112
  * Bypasses automatic data redaction for debugging purposes
102
113
  * @param message - The info message to log
103
114
  * @param data - Optional data object to log (no redaction applied)
115
+ * @param options - Optional per-call options (e.g., emoji override)
104
116
  */
105
- infoRaw: (message: string, data?: LogData) => void;
117
+ infoRaw: (message: string, data?: LogData, options?: LogCallOptions) => void;
106
118
  /**
107
119
  * Log a warning message without redaction (use with caution)
108
120
  * Bypasses automatic data redaction for debugging purposes
109
121
  * @param message - The warning message to log
110
122
  * @param data - Optional data object to log (no redaction applied)
123
+ * @param options - Optional per-call options (e.g., emoji override)
111
124
  */
112
- warnRaw: (message: string, data?: LogData) => void;
125
+ warnRaw: (message: string, data?: LogData, options?: LogCallOptions) => void;
113
126
  /**
114
127
  * Log an error message without redaction (use with caution)
115
128
  * Bypasses automatic data redaction for debugging purposes
116
129
  * @param message - The error message to log
117
130
  * @param data - Optional data object to log (no redaction applied)
131
+ * @param options - Optional per-call options (e.g., emoji override)
118
132
  */
119
- errorRaw: (message: string, data?: LogData) => void;
133
+ errorRaw: (message: string, data?: LogData, options?: LogCallOptions) => void;
120
134
  /**
121
135
  * Log a critical message without redaction (use with caution)
122
136
  * Bypasses automatic data redaction for debugging purposes
123
137
  * @param message - The critical log message to log
124
138
  * @param data - Optional data object to log (no redaction applied)
139
+ * @param options - Optional per-call options (e.g., emoji override)
125
140
  */
126
- logRaw: (message: string, data?: LogData) => void;
141
+ logRaw: (message: string, data?: LogData, options?: LogCallOptions) => void;
127
142
  /**
128
143
  * Configure data redaction settings
129
144
  * @param config - Partial redaction configuration to apply
@@ -169,12 +184,14 @@ export declare const LogEngine: {
169
184
  * @example
170
185
  * ```typescript
171
186
  * LogEngine.withoutRedaction().info('Debug data', sensitiveObject);
187
+ * LogEngine.withoutRedaction().info('Custom emoji', undefined, { emoji: '🔍' });
172
188
  * ```
173
189
  */
174
190
  withoutRedaction: () => ILogEngineWithoutRedaction;
175
191
  };
176
192
  export { LogMode, LogLevel } from './types';
177
- export type { LoggerConfig, LogFormatConfig, RedactionConfig, LogOutputHandler, BuiltInOutputHandler, OutputTarget, FileOutputConfig, HttpOutputConfig, AdvancedOutputConfig, EnhancedOutputTarget } from './types';
193
+ export type { LoggerConfig, LogFormatConfig, RedactionConfig, LogOutputHandler, BuiltInOutputHandler, OutputTarget, LogCallOptions, FileOutputConfig, HttpOutputConfig, AdvancedOutputConfig, EnhancedOutputTarget, EmojiConfig, EmojiMapping } from './types';
178
194
  export { DataRedactor, defaultRedactionConfig, RedactionController } from './redaction';
195
+ export { EmojiSelector, EMOJI_MAPPINGS, FALLBACK_EMOJI } from './formatter';
179
196
  export default LogEngine;
180
197
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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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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;;;;;;;;SAQK;4BACiB,0BAA0B;CAOjD,CAAC;AAGF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,YAAY,EACV,YAAY,EACZ,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EACZ,cAAc,EAEd,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EAEpB,WAAW,EACX,YAAY,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG5E,eAAe,SAAS,CAAC"}
package/dist/esm/index.js CHANGED
@@ -43,92 +43,107 @@ export const LogEngine = {
43
43
  * Only shown in DEVELOPMENT mode
44
44
  * @param message - The debug message to log
45
45
  * @param data - Optional data object to log (sensitive data will be redacted)
46
+ * @param options - Optional per-call options (e.g., emoji override)
46
47
  * @example
47
48
  * ```typescript
48
49
  * LogEngine.debug('Processing user data', { userId: 123, email: 'user@example.com' });
50
+ * LogEngine.debug('Starting process', undefined, { emoji: '🔍' });
49
51
  * ```
50
52
  */
51
- debug: (message, data) => logger.debug(message, data),
53
+ debug: (message, data, options) => logger.debug(message, data, options),
52
54
  /**
53
55
  * Log an info message with automatic data redaction
54
56
  * Shown in DEVELOPMENT and PRODUCTION modes
55
57
  * @param message - The info message to log
56
58
  * @param data - Optional data object to log (sensitive data will be redacted)
59
+ * @param options - Optional per-call options (e.g., emoji override)
57
60
  * @example
58
61
  * ```typescript
59
62
  * LogEngine.info('User login successful', { username: 'john' });
63
+ * LogEngine.info('Database initialized', undefined, { emoji: '✅' });
60
64
  * ```
61
65
  */
62
- info: (message, data) => logger.info(message, data),
66
+ info: (message, data, options) => logger.info(message, data, options),
63
67
  /**
64
68
  * Log a warning message with automatic data redaction
65
69
  * Shown in DEVELOPMENT and PRODUCTION modes
66
70
  * @param message - The warning message to log
67
71
  * @param data - Optional data object to log (sensitive data will be redacted)
72
+ * @param options - Optional per-call options (e.g., emoji override)
68
73
  * @example
69
74
  * ```typescript
70
75
  * LogEngine.warn('API rate limit approaching', { requestsRemaining: 10 });
76
+ * LogEngine.warn('Low disk space', undefined, { emoji: '💾' });
71
77
  * ```
72
78
  */
73
- warn: (message, data) => logger.warn(message, data),
79
+ warn: (message, data, options) => logger.warn(message, data, options),
74
80
  /**
75
81
  * Log an error message with automatic data redaction
76
82
  * Shown in DEVELOPMENT and PRODUCTION modes
77
83
  * @param message - The error message to log
78
84
  * @param data - Optional data object to log (sensitive data will be redacted)
85
+ * @param options - Optional per-call options (e.g., emoji override)
79
86
  * @example
80
87
  * ```typescript
81
88
  * LogEngine.error('Database connection failed', { host: 'localhost', port: 5432 });
89
+ * LogEngine.error('Critical failure', undefined, { emoji: '💥' });
82
90
  * ```
83
91
  */
84
- error: (message, data) => logger.error(message, data),
92
+ error: (message, data, options) => logger.error(message, data, options),
85
93
  /**
86
94
  * Log a critical message with automatic data redaction
87
95
  * Always shown regardless of mode (except OFF)
88
96
  * @param message - The critical log message to log
89
97
  * @param data - Optional data object to log (sensitive data will be redacted)
98
+ * @param options - Optional per-call options (e.g., emoji override)
90
99
  * @example
91
100
  * ```typescript
92
101
  * LogEngine.log('Application starting', { version: '1.0.0' });
102
+ * LogEngine.log('System ready', undefined, { emoji: '🚀' });
93
103
  * ```
94
104
  */
95
- log: (message, data) => logger.log(message, data),
105
+ log: (message, data, options) => logger.log(message, data, options),
96
106
  // Raw methods that bypass redaction (use with caution)
97
107
  /**
98
108
  * Log a debug message without redaction (use with caution)
99
109
  * Bypasses automatic data redaction for debugging purposes
100
110
  * @param message - The debug message to log
101
111
  * @param data - Optional data object to log (no redaction applied)
112
+ * @param options - Optional per-call options (e.g., emoji override)
102
113
  */
103
- debugRaw: (message, data) => logger.debugRaw(message, data),
114
+ debugRaw: (message, data, options) => logger.debugRaw(message, data, options),
104
115
  /**
105
116
  * Log an info message without redaction (use with caution)
106
117
  * Bypasses automatic data redaction for debugging purposes
107
118
  * @param message - The info message to log
108
119
  * @param data - Optional data object to log (no redaction applied)
120
+ * @param options - Optional per-call options (e.g., emoji override)
109
121
  */
110
- infoRaw: (message, data) => logger.infoRaw(message, data),
122
+ infoRaw: (message, data, options) => logger.infoRaw(message, data, options),
111
123
  /**
112
124
  * Log a warning message without redaction (use with caution)
113
125
  * Bypasses automatic data redaction for debugging purposes
114
126
  * @param message - The warning message to log
115
127
  * @param data - Optional data object to log (no redaction applied)
128
+ * @param options - Optional per-call options (e.g., emoji override)
116
129
  */
117
- warnRaw: (message, data) => logger.warnRaw(message, data),
130
+ warnRaw: (message, data, options) => logger.warnRaw(message, data, options),
118
131
  /**
119
132
  * Log an error message without redaction (use with caution)
120
133
  * Bypasses automatic data redaction for debugging purposes
121
134
  * @param message - The error message to log
122
135
  * @param data - Optional data object to log (no redaction applied)
136
+ * @param options - Optional per-call options (e.g., emoji override)
123
137
  */
124
- errorRaw: (message, data) => logger.errorRaw(message, data),
138
+ errorRaw: (message, data, options) => logger.errorRaw(message, data, options),
125
139
  /**
126
140
  * Log a critical message without redaction (use with caution)
127
141
  * Bypasses automatic data redaction for debugging purposes
128
142
  * @param message - The critical log message to log
129
143
  * @param data - Optional data object to log (no redaction applied)
144
+ * @param options - Optional per-call options (e.g., emoji override)
130
145
  */
131
- logRaw: (message, data) => logger.logRaw(message, data),
146
+ logRaw: (message, data, options) => logger.logRaw(message, data, options),
132
147
  // Redaction configuration methods
133
148
  /**
134
149
  * Configure data redaction settings
@@ -176,19 +191,21 @@ export const LogEngine = {
176
191
  * @example
177
192
  * ```typescript
178
193
  * LogEngine.withoutRedaction().info('Debug data', sensitiveObject);
194
+ * LogEngine.withoutRedaction().info('Custom emoji', undefined, { emoji: '🔍' });
179
195
  * ```
180
196
  */
181
197
  withoutRedaction: () => ({
182
- debug: (message, data) => logger.debugRaw(message, data),
183
- info: (message, data) => logger.infoRaw(message, data),
184
- warn: (message, data) => logger.warnRaw(message, data),
185
- error: (message, data) => logger.errorRaw(message, data),
186
- log: (message, data) => logger.logRaw(message, data)
198
+ debug: (message, data, options) => logger.debugRaw(message, data, options),
199
+ info: (message, data, options) => logger.infoRaw(message, data, options),
200
+ warn: (message, data, options) => logger.warnRaw(message, data, options),
201
+ error: (message, data, options) => logger.errorRaw(message, data, options),
202
+ log: (message, data, options) => logger.logRaw(message, data, options)
187
203
  })
188
204
  };
189
205
  // Re-export types and utilities for external use
190
206
  export { LogMode, LogLevel } from './types/index.js';
191
207
  export { DataRedactor, defaultRedactionConfig, RedactionController } from './redaction/index.js';
208
+ export { EmojiSelector, EMOJI_MAPPINGS, FALLBACK_EMOJI } from './formatter/index.js';
192
209
  // Default export for convenience
193
210
  export default LogEngine;
194
211
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEnE,qCAAqC;AACrC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;AAE5B;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;;;;;;SAOK;IACL,SAAS,EAAE,CAAC,MAA6B,EAAQ,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;IAE5E,oDA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I,EAAE,OAAO,CAAC;QACjH,KAAK,EAAE,CAAC,OAAe,EAAE,IAAc,EAAE,OAAwB,EAAQ,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC;QACnH,GAAG,EAAE,CAAC,OAAe,EAAE,IAAc,EAAE,OAAwB,EAAQ,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC;KAChH,CAAC;CACH,CAAC;AAEF,iDAAiD;AACjD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAkB5C,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE5E,iCAAiC;AACjC,eAAe,SAAS,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * Uses colorized console output with timestamps for better readability
6
6
  * Includes automatic data redaction for sensitive information
7
7
  */
8
- import { LoggerConfig, LogData } from '../types';
8
+ import { LoggerConfig, LogData, LogCallOptions } from '../types';
9
9
  /**
10
10
  * Logger class responsible for managing log output and configuration
11
11
  * Provides mode-based filtering and formatted console output
@@ -32,6 +32,7 @@ export declare class Logger {
32
32
  * @param level - The log level to format for
33
33
  * @param message - The message content to format
34
34
  * @param data - Optional data object to include in the log output
35
+ * @param options - Optional per-call options (e.g., emoji override)
35
36
  * @returns Formatted string with appropriate configuration applied
36
37
  */
37
38
  private formatMessage;
@@ -102,32 +103,36 @@ export declare class Logger {
102
103
  * Automatically redacts sensitive data when provided
103
104
  * @param message - The debug message to log
104
105
  * @param data - Optional data object to log (will be redacted)
106
+ * @param options - Optional per-call options (e.g., emoji override)
105
107
  */
106
- debug(message: string, data?: LogData): void;
108
+ debug(message: string, data?: LogData, options?: LogCallOptions): void;
107
109
  /**
108
110
  * Log an informational message with INFO level formatting
109
111
  * Uses console.log for output with blue coloring
110
112
  * Automatically redacts sensitive data when provided
111
113
  * @param message - The info message to log
112
114
  * @param data - Optional data object to log (will be redacted)
115
+ * @param options - Optional per-call options (e.g., emoji override)
113
116
  */
114
- info(message: string, data?: LogData): void;
117
+ info(message: string, data?: LogData, options?: LogCallOptions): void;
115
118
  /**
116
119
  * Log a warning message with WARN level formatting
117
120
  * Uses console.warn for output with yellow coloring
118
121
  * Automatically redacts sensitive data when provided
119
122
  * @param message - The warning message to log
120
123
  * @param data - Optional data object to log (will be redacted)
124
+ * @param options - Optional per-call options (e.g., emoji override)
121
125
  */
122
- warn(message: string, data?: LogData): void;
126
+ warn(message: string, data?: LogData, options?: LogCallOptions): void;
123
127
  /**
124
128
  * Log an error message with ERROR level formatting
125
129
  * Uses console.error for output with red coloring
126
130
  * Automatically redacts sensitive data when provided
127
131
  * @param message - The error message to log
128
132
  * @param data - Optional data object to log (will be redacted)
133
+ * @param options - Optional per-call options (e.g., emoji override)
129
134
  */
130
- error(message: string, data?: LogData): void;
135
+ error(message: string, data?: LogData, options?: LogCallOptions): void;
131
136
  /**
132
137
  * Log a message with LOG level formatting (always outputs unless mode is OFF)
133
138
  * Uses console.log for output with green coloring
@@ -135,37 +140,43 @@ export declare class Logger {
135
140
  * Automatically redacts sensitive data when provided
136
141
  * @param message - The log message to output
137
142
  * @param data - Optional data object to log (will be redacted)
143
+ * @param options - Optional per-call options (e.g., emoji override)
138
144
  */
139
- log(message: string, data?: LogData): void;
145
+ log(message: string, data?: LogData, options?: LogCallOptions): void;
140
146
  /**
141
147
  * Log a debug message without data redaction
142
148
  * @param message - The debug message to log
143
149
  * @param data - Optional data object to log (no redaction applied)
150
+ * @param options - Optional per-call options (e.g., emoji override)
144
151
  */
145
- debugRaw(message: string, data?: LogData): void;
152
+ debugRaw(message: string, data?: LogData, options?: LogCallOptions): void;
146
153
  /**
147
154
  * Log an info message without data redaction
148
155
  * @param message - The info message to log
149
156
  * @param data - Optional data object to log (no redaction applied)
157
+ * @param options - Optional per-call options (e.g., emoji override)
150
158
  */
151
- infoRaw(message: string, data?: LogData): void;
159
+ infoRaw(message: string, data?: LogData, options?: LogCallOptions): void;
152
160
  /**
153
161
  * Log a warning message without data redaction
154
162
  * @param message - The warning message to log
155
163
  * @param data - Optional data object to log (no redaction applied)
164
+ * @param options - Optional per-call options (e.g., emoji override)
156
165
  */
157
- warnRaw(message: string, data?: LogData): void;
166
+ warnRaw(message: string, data?: LogData, options?: LogCallOptions): void;
158
167
  /**
159
168
  * Log an error message without data redaction
160
169
  * @param message - The error message to log
161
170
  * @param data - Optional data object to log (no redaction applied)
171
+ * @param options - Optional per-call options (e.g., emoji override)
162
172
  */
163
- errorRaw(message: string, data?: LogData): void;
173
+ errorRaw(message: string, data?: LogData, options?: LogCallOptions): void;
164
174
  /**
165
175
  * Log a message without data redaction (always outputs unless mode is OFF)
166
176
  * @param message - The log message to output
167
177
  * @param data - Optional data object to log (no redaction applied)
178
+ * @param options - Optional per-call options (e.g., emoji override)
168
179
  */
169
- logRaw(message: string, data?: LogData): void;
180
+ logRaw(message: string, data?: LogData, options?: LogCallOptions): void;
170
181
  }
171
182
  //# sourceMappingURL=core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/logger/core.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAqB,YAAY,EAAwD,OAAO,EAAE,MAAM,UAAU,CAAC;AAO1H;;;GAGG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,YAAY,CAA6B;IAEjD;;SAEK;;IAKL;;;OAGG;IACH,OAAO,CAAC,eAAe;IAOvB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAI7B;;;;;;;OAOG;IACH,OAAO,CAAC,aAAa;IAKrB;;SAEK;IAEL,OAAO,CAAC,iBAAiB;IAsCzB;;;;;;;;SAQK;IACL,OAAO,CAAC,mBAAmB;IA6C3B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C,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;IAQtE;;;;;;;;SAQK;IACL,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;IASpE;;;;;SAKK;IACL,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;IAOzE;;;;;SAKK;IACL,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;IAOxE;;;;;SAKK;IACL,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;IAOxE;;;;;SAKK;IACL,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;IAOzE;;;;;SAKK;IACL,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;CAMxE"}
@@ -6,7 +6,7 @@
6
6
  * Includes automatic data redaction for sensitive information
7
7
  */
8
8
  import { LogLevel, LogMode } from '../types/index.js';
9
- import { LogFormatter } from '../formatter/index.js';
9
+ import { LogFormatter, EmojiSelector } from '../formatter/index.js';
10
10
  import { DataRedactor, RedactionController, defaultRedactionConfig } from '../redaction/index.js';
11
11
  import { LoggerConfigManager } from './config.js';
12
12
  import { LogFilter } from './filtering.js';
@@ -45,11 +45,12 @@ export class Logger {
45
45
  * @param level - The log level to format for
46
46
  * @param message - The message content to format
47
47
  * @param data - Optional data object to include in the log output
48
+ * @param options - Optional per-call options (e.g., emoji override)
48
49
  * @returns Formatted string with appropriate configuration applied
49
50
  */
50
- formatMessage(level, message, data) {
51
+ formatMessage(level, message, data, options) {
51
52
  const cachedConfig = this.getCachedConfig();
52
- return LogFormatter.format(level, message, data, cachedConfig.format);
53
+ return LogFormatter.format(level, message, data, cachedConfig.format, options);
53
54
  }
54
55
  /**
55
56
  * Built-in output handlers for common use cases
@@ -188,6 +189,16 @@ export class Logger {
188
189
  ...defaultRedactionConfig,
189
190
  ...RedactionController.getEnvironmentConfig()
190
191
  });
192
+ // Configure emoji selector once when logger config changes
193
+ // This allows the compiled regex cache to persist across log calls
194
+ const currentConfig = this.configManager.getConfig();
195
+ if (currentConfig.format?.emoji) {
196
+ EmojiSelector.configure(currentConfig.format.emoji);
197
+ }
198
+ else {
199
+ // Reset to defaults when no emoji config is provided
200
+ EmojiSelector.reset();
201
+ }
191
202
  }
192
203
  /**
193
204
  * Get current logger configuration
@@ -273,11 +284,12 @@ export class Logger {
273
284
  * Automatically redacts sensitive data when provided
274
285
  * @param message - The debug message to log
275
286
  * @param data - Optional data object to log (will be redacted)
287
+ * @param options - Optional per-call options (e.g., emoji override)
276
288
  */
277
- debug(message, data) {
289
+ debug(message, data, options) {
278
290
  if (this.shouldLog(LogLevel.DEBUG)) {
279
291
  const processedData = DataRedactor.redactData(data);
280
- const formatted = this.formatMessage(LogLevel.DEBUG, message, processedData);
292
+ const formatted = this.formatMessage(LogLevel.DEBUG, message, processedData, options);
281
293
  this.writeToOutput('debug', message, formatted, processedData);
282
294
  }
283
295
  }
@@ -287,11 +299,12 @@ export class Logger {
287
299
  * Automatically redacts sensitive data when provided
288
300
  * @param message - The info message to log
289
301
  * @param data - Optional data object to log (will be redacted)
302
+ * @param options - Optional per-call options (e.g., emoji override)
290
303
  */
291
- info(message, data) {
304
+ info(message, data, options) {
292
305
  if (this.shouldLog(LogLevel.INFO)) {
293
306
  const processedData = DataRedactor.redactData(data);
294
- const formatted = this.formatMessage(LogLevel.INFO, message, processedData);
307
+ const formatted = this.formatMessage(LogLevel.INFO, message, processedData, options);
295
308
  this.writeToOutput('info', message, formatted, processedData);
296
309
  }
297
310
  }
@@ -301,11 +314,12 @@ export class Logger {
301
314
  * Automatically redacts sensitive data when provided
302
315
  * @param message - The warning message to log
303
316
  * @param data - Optional data object to log (will be redacted)
317
+ * @param options - Optional per-call options (e.g., emoji override)
304
318
  */
305
- warn(message, data) {
319
+ warn(message, data, options) {
306
320
  if (this.shouldLog(LogLevel.WARN)) {
307
321
  const processedData = DataRedactor.redactData(data);
308
- const formatted = this.formatMessage(LogLevel.WARN, message, processedData);
322
+ const formatted = this.formatMessage(LogLevel.WARN, message, processedData, options);
309
323
  this.writeToOutput('warn', message, formatted, processedData, false, true);
310
324
  }
311
325
  }
@@ -315,11 +329,12 @@ export class Logger {
315
329
  * Automatically redacts sensitive data when provided
316
330
  * @param message - The error message to log
317
331
  * @param data - Optional data object to log (will be redacted)
332
+ * @param options - Optional per-call options (e.g., emoji override)
318
333
  */
319
- error(message, data) {
334
+ error(message, data, options) {
320
335
  if (this.shouldLog(LogLevel.ERROR)) {
321
336
  const processedData = DataRedactor.redactData(data);
322
- const formatted = this.formatMessage(LogLevel.ERROR, message, processedData);
337
+ const formatted = this.formatMessage(LogLevel.ERROR, message, processedData, options);
323
338
  this.writeToOutput('error', message, formatted, processedData, true, false);
324
339
  }
325
340
  }
@@ -330,11 +345,12 @@ export class Logger {
330
345
  * Automatically redacts sensitive data when provided
331
346
  * @param message - The log message to output
332
347
  * @param data - Optional data object to log (will be redacted)
348
+ * @param options - Optional per-call options (e.g., emoji override)
333
349
  */
334
- log(message, data) {
350
+ log(message, data, options) {
335
351
  if (this.shouldLog(LogLevel.LOG)) {
336
352
  const processedData = DataRedactor.redactData(data);
337
- const formatted = this.formatMessage(LogLevel.LOG, message, processedData);
353
+ const formatted = this.formatMessage(LogLevel.LOG, message, processedData, options);
338
354
  this.writeToOutput('log', message, formatted, processedData);
339
355
  }
340
356
  }
@@ -343,10 +359,11 @@ export class Logger {
343
359
  * Log a debug message without data redaction
344
360
  * @param message - The debug message to log
345
361
  * @param data - Optional data object to log (no redaction applied)
362
+ * @param options - Optional per-call options (e.g., emoji override)
346
363
  */
347
- debugRaw(message, data) {
364
+ debugRaw(message, data, options) {
348
365
  if (this.shouldLog(LogLevel.DEBUG)) {
349
- const formatted = this.formatMessage(LogLevel.DEBUG, message, data);
366
+ const formatted = this.formatMessage(LogLevel.DEBUG, message, data, options);
350
367
  this.writeToOutput('debug', message, formatted, data);
351
368
  }
352
369
  }
@@ -354,10 +371,11 @@ export class Logger {
354
371
  * Log an info message without data redaction
355
372
  * @param message - The info message to log
356
373
  * @param data - Optional data object to log (no redaction applied)
374
+ * @param options - Optional per-call options (e.g., emoji override)
357
375
  */
358
- infoRaw(message, data) {
376
+ infoRaw(message, data, options) {
359
377
  if (this.shouldLog(LogLevel.INFO)) {
360
- const formatted = this.formatMessage(LogLevel.INFO, message, data);
378
+ const formatted = this.formatMessage(LogLevel.INFO, message, data, options);
361
379
  this.writeToOutput('info', message, formatted, data);
362
380
  }
363
381
  }
@@ -365,10 +383,11 @@ export class Logger {
365
383
  * Log a warning message without data redaction
366
384
  * @param message - The warning message to log
367
385
  * @param data - Optional data object to log (no redaction applied)
386
+ * @param options - Optional per-call options (e.g., emoji override)
368
387
  */
369
- warnRaw(message, data) {
388
+ warnRaw(message, data, options) {
370
389
  if (this.shouldLog(LogLevel.WARN)) {
371
- const formatted = this.formatMessage(LogLevel.WARN, message, data);
390
+ const formatted = this.formatMessage(LogLevel.WARN, message, data, options);
372
391
  this.writeToOutput('warn', message, formatted, data, false, true);
373
392
  }
374
393
  }
@@ -376,10 +395,11 @@ export class Logger {
376
395
  * Log an error message without data redaction
377
396
  * @param message - The error message to log
378
397
  * @param data - Optional data object to log (no redaction applied)
398
+ * @param options - Optional per-call options (e.g., emoji override)
379
399
  */
380
- errorRaw(message, data) {
400
+ errorRaw(message, data, options) {
381
401
  if (this.shouldLog(LogLevel.ERROR)) {
382
- const formatted = this.formatMessage(LogLevel.ERROR, message, data);
402
+ const formatted = this.formatMessage(LogLevel.ERROR, message, data, options);
383
403
  this.writeToOutput('error', message, formatted, data, true, false);
384
404
  }
385
405
  }
@@ -387,10 +407,11 @@ export class Logger {
387
407
  * Log a message without data redaction (always outputs unless mode is OFF)
388
408
  * @param message - The log message to output
389
409
  * @param data - Optional data object to log (no redaction applied)
410
+ * @param options - Optional per-call options (e.g., emoji override)
390
411
  */
391
- logRaw(message, data) {
412
+ logRaw(message, data, options) {
392
413
  if (this.shouldLog(LogLevel.LOG)) {
393
- const formatted = this.formatMessage(LogLevel.LOG, message, data);
414
+ const formatted = this.formatMessage(LogLevel.LOG, message, data, options);
394
415
  this.writeToOutput('log', message, formatted, data);
395
416
  }
396
417
  }