@wgtechlabs/log-engine 2.1.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.
Files changed (170) hide show
  1. package/dist/cjs/__tests__/async-test-utils.cjs +276 -0
  2. package/dist/cjs/__tests__/async-test-utils.d.ts +51 -0
  3. package/dist/cjs/__tests__/async-test-utils.d.ts.map +1 -0
  4. package/dist/cjs/__tests__/async-test-utils.js.map +1 -0
  5. package/dist/cjs/__tests__/redaction/test-utils.cjs +72 -0
  6. package/dist/cjs/__tests__/redaction/test-utils.d.ts +33 -0
  7. package/dist/cjs/__tests__/redaction/test-utils.d.ts.map +1 -0
  8. package/dist/cjs/__tests__/redaction/test-utils.js.map +1 -0
  9. package/dist/cjs/__tests__/test-utils.cjs +49 -0
  10. package/dist/cjs/__tests__/test-utils.d.ts +41 -0
  11. package/dist/cjs/__tests__/test-utils.d.ts.map +1 -0
  12. package/dist/cjs/__tests__/test-utils.js.map +1 -0
  13. package/dist/{formatter/colors.js → cjs/formatter/colors.cjs} +1 -0
  14. package/dist/cjs/formatter/colors.d.ts.map +1 -0
  15. package/dist/cjs/formatter/colors.js.map +1 -0
  16. package/dist/{formatter/data-formatter.js → cjs/formatter/data-formatter.cjs} +1 -0
  17. package/dist/cjs/formatter/data-formatter.d.ts.map +1 -0
  18. package/dist/cjs/formatter/data-formatter.js.map +1 -0
  19. package/dist/{formatter/index.js → cjs/formatter/index.cjs} +6 -5
  20. package/dist/cjs/formatter/index.d.ts.map +1 -0
  21. package/dist/cjs/formatter/index.js.map +1 -0
  22. package/dist/{formatter/message-formatter.js → cjs/formatter/message-formatter.cjs} +5 -4
  23. package/dist/cjs/formatter/message-formatter.d.ts.map +1 -0
  24. package/dist/cjs/formatter/message-formatter.js.map +1 -0
  25. package/dist/{formatter/timestamp.js → cjs/formatter/timestamp.cjs} +1 -0
  26. package/dist/cjs/formatter/timestamp.d.ts.map +1 -0
  27. package/dist/cjs/formatter/timestamp.js.map +1 -0
  28. package/dist/{index.js → cjs/index.cjs} +5 -4
  29. package/dist/cjs/index.d.ts.map +1 -0
  30. package/dist/cjs/index.js.map +1 -0
  31. package/dist/{logger/advanced-outputs.js → cjs/logger/advanced-outputs.cjs} +1 -0
  32. package/dist/cjs/logger/advanced-outputs.d.ts.map +1 -0
  33. package/dist/cjs/logger/advanced-outputs.js.map +1 -0
  34. package/dist/{logger/config.js → cjs/logger/config.cjs} +4 -3
  35. package/dist/cjs/logger/config.d.ts.map +1 -0
  36. package/dist/cjs/logger/config.js.map +1 -0
  37. package/dist/{logger/core.js → cjs/logger/core.cjs} +7 -6
  38. package/dist/cjs/logger/core.d.ts.map +1 -0
  39. package/dist/cjs/logger/core.js.map +1 -0
  40. package/dist/{logger/environment.js → cjs/logger/environment.cjs} +2 -1
  41. package/dist/cjs/logger/environment.d.ts.map +1 -0
  42. package/dist/cjs/logger/environment.js.map +1 -0
  43. package/dist/{logger/filtering.js → cjs/logger/filtering.cjs} +2 -1
  44. package/dist/cjs/logger/filtering.d.ts.map +1 -0
  45. package/dist/cjs/logger/filtering.js.map +1 -0
  46. package/dist/{logger/index.js → cjs/logger/index.cjs} +6 -5
  47. package/dist/cjs/logger/index.d.ts.map +1 -0
  48. package/dist/cjs/logger/index.js.map +1 -0
  49. package/dist/cjs/package.json +3 -0
  50. package/dist/{redaction/config.js → cjs/redaction/config.cjs} +1 -0
  51. package/dist/cjs/redaction/config.d.ts.map +1 -0
  52. package/dist/cjs/redaction/config.js.map +1 -0
  53. package/dist/{redaction/index.js → cjs/redaction/index.cjs} +3 -2
  54. package/dist/cjs/redaction/index.d.ts.map +1 -0
  55. package/dist/cjs/redaction/index.js.map +1 -0
  56. package/dist/{redaction/redactor.js → cjs/redaction/redactor.cjs} +2 -1
  57. package/dist/cjs/redaction/redactor.d.ts.map +1 -0
  58. package/dist/cjs/redaction/redactor.js.map +1 -0
  59. package/dist/{types/index.js → cjs/types/index.cjs} +1 -0
  60. package/dist/cjs/types/index.d.ts.map +1 -0
  61. package/dist/cjs/types/index.js.map +1 -0
  62. package/dist/esm/__tests__/async-test-utils.d.ts +51 -0
  63. package/dist/esm/__tests__/async-test-utils.d.ts.map +1 -0
  64. package/dist/esm/__tests__/async-test-utils.js +231 -0
  65. package/dist/esm/__tests__/async-test-utils.js.map +1 -0
  66. package/dist/esm/__tests__/redaction/test-utils.d.ts +33 -0
  67. package/dist/esm/__tests__/redaction/test-utils.d.ts.map +1 -0
  68. package/dist/esm/__tests__/redaction/test-utils.js +65 -0
  69. package/dist/esm/__tests__/redaction/test-utils.js.map +1 -0
  70. package/dist/esm/__tests__/test-utils.d.ts +41 -0
  71. package/dist/esm/__tests__/test-utils.d.ts.map +1 -0
  72. package/dist/esm/__tests__/test-utils.js +42 -0
  73. package/dist/esm/__tests__/test-utils.js.map +1 -0
  74. package/dist/esm/formatter/colors.d.ts +32 -0
  75. package/dist/esm/formatter/colors.d.ts.map +1 -0
  76. package/dist/esm/formatter/colors.js +32 -0
  77. package/dist/esm/formatter/colors.js.map +1 -0
  78. package/dist/esm/formatter/data-formatter.d.ts +26 -0
  79. package/dist/esm/formatter/data-formatter.d.ts.map +1 -0
  80. package/dist/esm/formatter/data-formatter.js +50 -0
  81. package/dist/esm/formatter/data-formatter.js.map +1 -0
  82. package/dist/esm/formatter/index.d.ts +10 -0
  83. package/dist/esm/formatter/index.d.ts.map +1 -0
  84. package/dist/esm/formatter/index.js +11 -0
  85. package/dist/esm/formatter/index.js.map +1 -0
  86. package/dist/esm/formatter/message-formatter.d.ts +41 -0
  87. package/dist/esm/formatter/message-formatter.d.ts.map +1 -0
  88. package/dist/esm/formatter/message-formatter.js +84 -0
  89. package/dist/esm/formatter/message-formatter.js.map +1 -0
  90. package/dist/esm/formatter/timestamp.d.ts +27 -0
  91. package/dist/esm/formatter/timestamp.d.ts.map +1 -0
  92. package/dist/esm/formatter/timestamp.js +36 -0
  93. package/dist/esm/formatter/timestamp.js.map +1 -0
  94. package/dist/esm/index.d.ts +180 -0
  95. package/dist/esm/index.d.ts.map +1 -0
  96. package/dist/esm/index.js +194 -0
  97. package/dist/esm/index.js.map +1 -0
  98. package/dist/esm/logger/advanced-outputs.d.ts +159 -0
  99. package/dist/esm/logger/advanced-outputs.d.ts.map +1 -0
  100. package/dist/esm/logger/advanced-outputs.js +542 -0
  101. package/dist/esm/logger/advanced-outputs.js.map +1 -0
  102. package/dist/esm/logger/config.d.ts +42 -0
  103. package/dist/esm/logger/config.d.ts.map +1 -0
  104. package/dist/esm/logger/config.js +101 -0
  105. package/dist/esm/logger/config.js.map +1 -0
  106. package/dist/esm/logger/core.d.ts +152 -0
  107. package/dist/esm/logger/core.d.ts.map +1 -0
  108. package/dist/esm/logger/core.js +367 -0
  109. package/dist/esm/logger/core.js.map +1 -0
  110. package/dist/esm/logger/environment.d.ts +36 -0
  111. package/dist/esm/logger/environment.d.ts.map +1 -0
  112. package/dist/esm/logger/environment.js +58 -0
  113. package/dist/esm/logger/environment.js.map +1 -0
  114. package/dist/esm/logger/filtering.d.ts +36 -0
  115. package/dist/esm/logger/filtering.d.ts.map +1 -0
  116. package/dist/esm/logger/filtering.js +77 -0
  117. package/dist/esm/logger/filtering.js.map +1 -0
  118. package/dist/esm/logger/index.d.ts +10 -0
  119. package/dist/esm/logger/index.d.ts.map +1 -0
  120. package/dist/esm/logger/index.js +11 -0
  121. package/dist/esm/logger/index.js.map +1 -0
  122. package/dist/esm/redaction/config.d.ts +29 -0
  123. package/dist/esm/redaction/config.d.ts.map +1 -0
  124. package/dist/esm/redaction/config.js +92 -0
  125. package/dist/esm/redaction/config.js.map +1 -0
  126. package/dist/esm/redaction/index.d.ts +8 -0
  127. package/dist/esm/redaction/index.d.ts.map +1 -0
  128. package/dist/esm/redaction/index.js +7 -0
  129. package/dist/esm/redaction/index.js.map +1 -0
  130. package/dist/esm/redaction/redactor.d.ts +99 -0
  131. package/dist/esm/redaction/redactor.d.ts.map +1 -0
  132. package/dist/esm/redaction/redactor.js +259 -0
  133. package/dist/esm/redaction/redactor.js.map +1 -0
  134. package/dist/esm/types/index.d.ts +310 -0
  135. package/dist/esm/types/index.d.ts.map +1 -0
  136. package/dist/esm/types/index.js +41 -0
  137. package/dist/esm/types/index.js.map +1 -0
  138. package/package.json +19 -5
  139. package/dist/formatter/colors.d.ts.map +0 -1
  140. package/dist/formatter/data-formatter.d.ts.map +0 -1
  141. package/dist/formatter/index.d.ts.map +0 -1
  142. package/dist/formatter/message-formatter.d.ts.map +0 -1
  143. package/dist/formatter/timestamp.d.ts.map +0 -1
  144. package/dist/index.d.ts.map +0 -1
  145. package/dist/logger/advanced-outputs.d.ts.map +0 -1
  146. package/dist/logger/config.d.ts.map +0 -1
  147. package/dist/logger/core.d.ts.map +0 -1
  148. package/dist/logger/environment.d.ts.map +0 -1
  149. package/dist/logger/filtering.d.ts.map +0 -1
  150. package/dist/logger/index.d.ts.map +0 -1
  151. package/dist/redaction/config.d.ts.map +0 -1
  152. package/dist/redaction/index.d.ts.map +0 -1
  153. package/dist/redaction/redactor.d.ts.map +0 -1
  154. package/dist/types/index.d.ts.map +0 -1
  155. /package/dist/{formatter → cjs/formatter}/colors.d.ts +0 -0
  156. /package/dist/{formatter → cjs/formatter}/data-formatter.d.ts +0 -0
  157. /package/dist/{formatter → cjs/formatter}/index.d.ts +0 -0
  158. /package/dist/{formatter → cjs/formatter}/message-formatter.d.ts +0 -0
  159. /package/dist/{formatter → cjs/formatter}/timestamp.d.ts +0 -0
  160. /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
  161. /package/dist/{logger → cjs/logger}/advanced-outputs.d.ts +0 -0
  162. /package/dist/{logger → cjs/logger}/config.d.ts +0 -0
  163. /package/dist/{logger → cjs/logger}/core.d.ts +0 -0
  164. /package/dist/{logger → cjs/logger}/environment.d.ts +0 -0
  165. /package/dist/{logger → cjs/logger}/filtering.d.ts +0 -0
  166. /package/dist/{logger → cjs/logger}/index.d.ts +0 -0
  167. /package/dist/{redaction → cjs/redaction}/config.d.ts +0 -0
  168. /package/dist/{redaction → cjs/redaction}/index.d.ts +0 -0
  169. /package/dist/{redaction → cjs/redaction}/redactor.d.ts +0 -0
  170. /package/dist/{types → cjs/types}/index.d.ts +0 -0
@@ -0,0 +1,231 @@
1
+ /**
2
+ * Test utilities for handling async file operations properly
3
+ * Replaces arbitrary timeouts with proper Promise-based waiting
4
+ * Optimized for CI environments with faster polling and shorter timeouts
5
+ */
6
+ import * as fs from 'fs';
7
+ import * as path from 'path';
8
+ // Optimized defaults for CI environments
9
+ const DEFAULT_TIMEOUT = 3000; // Reduced from 5000ms
10
+ const POLL_INTERVAL = 5; // Reduced from 10ms for faster detection
11
+ /**
12
+ * Wait for a file to exist with optimized polling
13
+ */
14
+ export async function waitForFile(filePath, timeoutMs = DEFAULT_TIMEOUT) {
15
+ const startTime = Date.now();
16
+ while (Date.now() - startTime < timeoutMs) {
17
+ try {
18
+ await fs.promises.access(filePath, fs.constants.F_OK);
19
+ return; // File exists
20
+ }
21
+ catch (error) {
22
+ // File doesn't exist yet, wait a bit
23
+ await new Promise(resolve => setTimeout(resolve, POLL_INTERVAL));
24
+ }
25
+ }
26
+ throw new Error(`File ${filePath} did not appear within ${timeoutMs}ms`);
27
+ }
28
+ /**
29
+ * Wait for multiple files to exist with parallel checking
30
+ */
31
+ export async function waitForFiles(filePaths, timeoutMs = DEFAULT_TIMEOUT) {
32
+ await Promise.all(filePaths.map(filePath => waitForFile(filePath, timeoutMs)));
33
+ }
34
+ /**
35
+ * Wait for a file to have specific content with optimized polling
36
+ */
37
+ export async function waitForFileContent(filePath, expectedContent, timeoutMs = DEFAULT_TIMEOUT) {
38
+ const startTime = Date.now();
39
+ while (Date.now() - startTime < timeoutMs) {
40
+ try {
41
+ const content = await fs.promises.readFile(filePath, 'utf8');
42
+ if (typeof expectedContent === 'string') {
43
+ if (content.includes(expectedContent)) {
44
+ return;
45
+ }
46
+ }
47
+ else {
48
+ if (expectedContent.test(content)) {
49
+ return;
50
+ }
51
+ }
52
+ }
53
+ catch (error) {
54
+ // File might not exist yet or be readable
55
+ }
56
+ await new Promise(resolve => setTimeout(resolve, POLL_INTERVAL));
57
+ }
58
+ throw new Error(`File ${filePath} did not contain expected content within ${timeoutMs}ms`);
59
+ }
60
+ /**
61
+ * Wait for a directory to be empty with faster polling
62
+ */
63
+ export async function waitForDirectoryEmpty(dirPath, timeoutMs = DEFAULT_TIMEOUT) {
64
+ const startTime = Date.now();
65
+ while (Date.now() - startTime < timeoutMs) {
66
+ try {
67
+ const files = await fs.promises.readdir(dirPath);
68
+ if (files.length === 0) {
69
+ return;
70
+ }
71
+ }
72
+ catch (error) {
73
+ // Directory might not exist, which is also "empty"
74
+ return;
75
+ }
76
+ await new Promise(resolve => setTimeout(resolve, POLL_INTERVAL));
77
+ }
78
+ throw new Error(`Directory ${dirPath} was not empty within ${timeoutMs}ms`);
79
+ }
80
+ /**
81
+ * Safely remove a file with optimized retry logic
82
+ */
83
+ export async function safeRemoveFile(filePath, maxRetries = 3) {
84
+ for (let i = 0; i < maxRetries; i++) {
85
+ try {
86
+ await fs.promises.unlink(filePath);
87
+ return;
88
+ }
89
+ catch (error) {
90
+ if (i === maxRetries - 1) {
91
+ // Only throw on last retry if it's not a "file not found" error
92
+ if (error.code !== 'ENOENT') {
93
+ throw error;
94
+ }
95
+ }
96
+ else {
97
+ // Wait a bit before retrying (reduced wait time)
98
+ await new Promise(resolve => setTimeout(resolve, 10));
99
+ }
100
+ }
101
+ }
102
+ }
103
+ /**
104
+ * Safely clean up a directory with retry logic
105
+ */
106
+ export async function safeCleanupDirectory(dirPath) {
107
+ try {
108
+ const files = await fs.promises.readdir(dirPath);
109
+ // Remove all files with retry logic
110
+ await Promise.all(files.map(file => safeRemoveFile(path.join(dirPath, file))));
111
+ // Remove the directory itself
112
+ await fs.promises.rmdir(dirPath);
113
+ }
114
+ catch (error) {
115
+ // Directory might not exist, which is fine
116
+ if (error.code !== 'ENOENT') {
117
+ // Try force removal as fallback
118
+ try {
119
+ await fs.promises.rm(dirPath, { recursive: true, force: true });
120
+ }
121
+ catch (fallbackError) {
122
+ // Ignore cleanup errors in tests
123
+ }
124
+ }
125
+ }
126
+ }
127
+ /**
128
+ * Enhanced mock HTTP handler with faster timeouts and better error handling
129
+ */
130
+ export class MockHttpHandler {
131
+ constructor() {
132
+ this.requests = [];
133
+ this.pendingPromises = [];
134
+ this.timeoutIds = new Set();
135
+ }
136
+ addRequest(url, options) {
137
+ let resolveRequest;
138
+ const promise = new Promise(resolve => {
139
+ resolveRequest = resolve;
140
+ });
141
+ this.requests.push({
142
+ url,
143
+ options,
144
+ resolve: resolveRequest
145
+ });
146
+ this.pendingPromises.push(promise);
147
+ }
148
+ getRequests() {
149
+ return this.requests.map(({ url, options }) => ({ url, options }));
150
+ }
151
+ async waitForRequests(count = 1, timeoutMs = DEFAULT_TIMEOUT) {
152
+ const startTime = Date.now();
153
+ // Set up a timeout that will be cleaned up
154
+ let timeoutId;
155
+ const timeoutPromise = new Promise((_, reject) => {
156
+ timeoutId = setTimeout(() => {
157
+ reject(new Error(`Expected ${count} requests but got ${this.requests.length} within ${timeoutMs}ms`));
158
+ }, timeoutMs);
159
+ this.timeoutIds.add(timeoutId);
160
+ });
161
+ try {
162
+ while (this.requests.length < count && Date.now() - startTime < timeoutMs) {
163
+ await new Promise(resolve => {
164
+ const id = setTimeout(resolve, POLL_INTERVAL);
165
+ this.timeoutIds.add(id);
166
+ });
167
+ }
168
+ if (this.requests.length < count) {
169
+ throw new Error(`Expected ${count} requests but got ${this.requests.length} within ${timeoutMs}ms`);
170
+ }
171
+ // Mark all requests as processed
172
+ this.requests.forEach(req => req.resolve());
173
+ // Wait for all pending promises to resolve
174
+ await Promise.all(this.pendingPromises);
175
+ }
176
+ finally {
177
+ // Clean up the timeout
178
+ if (timeoutId) {
179
+ clearTimeout(timeoutId);
180
+ this.timeoutIds.delete(timeoutId);
181
+ }
182
+ }
183
+ }
184
+ clear() {
185
+ // Clean up any remaining timeouts
186
+ for (const timeoutId of this.timeoutIds) {
187
+ clearTimeout(timeoutId);
188
+ }
189
+ this.timeoutIds.clear();
190
+ this.requests = [];
191
+ this.pendingPromises = [];
192
+ }
193
+ }
194
+ /**
195
+ * Create a test timeout that fails fast instead of hanging
196
+ */
197
+ export function createTestTimeout(timeoutMs = DEFAULT_TIMEOUT) {
198
+ let timeoutId;
199
+ const promise = new Promise((_, reject) => {
200
+ timeoutId = setTimeout(() => {
201
+ reject(new Error(`Test timed out after ${timeoutMs}ms`));
202
+ }, timeoutMs);
203
+ });
204
+ const cancel = () => {
205
+ if (timeoutId) {
206
+ clearTimeout(timeoutId);
207
+ }
208
+ };
209
+ return { promise, cancel };
210
+ }
211
+ /**
212
+ * Race a promise against a timeout for fail-fast behavior
213
+ */
214
+ export async function withTimeout(promise, timeoutMs = DEFAULT_TIMEOUT) {
215
+ const timeout = createTestTimeout(timeoutMs);
216
+ try {
217
+ const result = await Promise.race([
218
+ promise,
219
+ timeout.promise
220
+ ]);
221
+ // Cancel the timeout since we got a result
222
+ timeout.cancel();
223
+ return result;
224
+ }
225
+ catch (error) {
226
+ // Cancel the timeout in case of error
227
+ timeout.cancel();
228
+ throw error;
229
+ }
230
+ }
231
+ //# sourceMappingURL=async-test-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-test-utils.js","sourceRoot":"","sources":["../../../src/__tests__/async-test-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,yCAAyC;AACzC,MAAM,eAAe,GAAG,IAAI,CAAC,CAAC,sBAAsB;AACpD,MAAM,aAAa,GAAG,CAAC,CAAC,CAAC,yCAAyC;AAElE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,QAAgB,EAAE,YAAoB,eAAe;IACrF,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,OAAO,IAAI,CAAC,GAAG,E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;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,YAAoB,eAAe;IACnE,IAAI,SAAyB,CAAC;IAC9B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;QAC/C,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;YAC1B,MAAM,CAAC,IAAI,KAAK,CAAC,wBAAwB,SAAS,IAAI,CAAC,CAAC,CAAC;QAC3D,CAAC,EAAE,SAAS,CAAC,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,IAAI,SAAS,EAAE,CAAC;YACd,YAAY,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAI,OAAmB,EAAE,YAAoB,eAAe;IAC3F,MAAM,OAAO,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAE7C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;YAChC,OAAO;YACP,OAAO,CAAC,OAAO;SAChB,CAAC,CAAC;QAEH,2CAA2C;QAC3C,OAAO,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,sCAAsC;QACtC,OAAO,CAAC,MAAM,EAAE,CAAC;QACjB,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Shared test utilities for redaction tests
3
+ * Common setup, mocks, and helper functions
4
+ */
5
+ export declare const mockConsole: {
6
+ log: jest.Mock<any, any, any>;
7
+ warn: jest.Mock<any, any, any>;
8
+ error: jest.Mock<any, any, any>;
9
+ };
10
+ export declare const originalConsole: {
11
+ log: (message?: any, ...optionalParams: any[]) => void;
12
+ warn: (message?: any, ...optionalParams: any[]) => void;
13
+ error: (message?: any, ...optionalParams: any[]) => void;
14
+ };
15
+ /**
16
+ * Setup console mocks for testing
17
+ */
18
+ export declare function setupConsoleMocks(): void;
19
+ /**
20
+ * Restore original console methods
21
+ */
22
+ export declare function restoreConsole(): void;
23
+ /**
24
+ * Setup environment for testing
25
+ */
26
+ export declare function setupTestEnvironment(): {
27
+ originalEnv: NodeJS.ProcessEnv;
28
+ };
29
+ /**
30
+ * Restore environment after testing
31
+ */
32
+ export declare function restoreEnvironment(originalEnv: NodeJS.ProcessEnv): void;
33
+ //# sourceMappingURL=test-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/redaction/test-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,eAAO,MAAM,WAAW;;;;CAIvB,CAAC;AAGF,eAAO,MAAM,eAAe;;;;CAI3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAKxC;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAIrC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI;IAAE,WAAW,EAAE,MAAM,CAAC,UAAU,CAAA;CAAE,CAGzE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,CAAC,UAAU,GAAG,IAAI,CAqBvE"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Shared test utilities for redaction tests
3
+ * Common setup, mocks, and helper functions
4
+ */
5
+ // Mock console methods to capture output for integration tests
6
+ export const mockConsole = {
7
+ log: jest.fn(),
8
+ warn: jest.fn(),
9
+ error: jest.fn()
10
+ };
11
+ // Store original console methods
12
+ export const originalConsole = {
13
+ log: console.log,
14
+ warn: console.warn,
15
+ error: console.error
16
+ };
17
+ /**
18
+ * Setup console mocks for testing
19
+ */
20
+ export function setupConsoleMocks() {
21
+ jest.clearAllMocks();
22
+ console.log = mockConsole.log;
23
+ console.warn = mockConsole.warn;
24
+ console.error = mockConsole.error;
25
+ }
26
+ /**
27
+ * Restore original console methods
28
+ */
29
+ export function restoreConsole() {
30
+ console.log = originalConsole.log;
31
+ console.warn = originalConsole.warn;
32
+ console.error = originalConsole.error;
33
+ }
34
+ /**
35
+ * Setup environment for testing
36
+ */
37
+ export function setupTestEnvironment() {
38
+ const originalEnv = { ...process.env };
39
+ return { originalEnv };
40
+ }
41
+ /**
42
+ * Restore environment after testing
43
+ */
44
+ export function restoreEnvironment(originalEnv) {
45
+ // Only remove environment variables that were added during the test
46
+ // (i.e., those not present in the originalEnv)
47
+ // Create a copy of the keys to avoid mutation during iteration
48
+ const currentEnvKeys = Object.keys(process.env);
49
+ for (const key of currentEnvKeys) {
50
+ if (!Object.prototype.hasOwnProperty.call(originalEnv, key)) {
51
+ // Safe deletion using explicit type assertion
52
+ delete process.env[key];
53
+ }
54
+ }
55
+ // Restore or update variables that existed originally
56
+ // Iterate over originalEnv keys safely
57
+ const originalEnvKeys = Object.keys(originalEnv);
58
+ for (const key of originalEnvKeys) {
59
+ if (Object.prototype.hasOwnProperty.call(originalEnv, key)) {
60
+ // Safe assignment using explicit access
61
+ process.env[key] = originalEnv[key];
62
+ }
63
+ }
64
+ }
65
+ //# sourceMappingURL=test-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../../../../src/__tests__/redaction/test-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;IACd,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;IACf,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE;CACjB,CAAC;AAEF,iCAAiC;AACjC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,GAAG,EAAE,OAAO,CAAC,GAAG;IAChB,I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AAI,eAAe,EAAE,CAAC;QAClC,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC;YAC3D,wCAAwC;YACvC,OAAO,CAAC,GAA0C,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAC9E,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Shared test utilities for log-engine tests
3
+ * Provides consistent console mocking and cleanup functionality across all test suites
4
+ */
5
+ /**
6
+ * Interface for managing console method mocks during testing
7
+ * Groups all console spy instances for easy setup and cleanup
8
+ */
9
+ export interface ConsoleMocks {
10
+ /** Mock for console.log (used by debug and info methods) */
11
+ mockConsoleLog: jest.SpyInstance;
12
+ /** Mock for console.warn (used by warn method) */
13
+ mockConsoleWarn: jest.SpyInstance;
14
+ /** Mock for console.error (used by error method) */
15
+ mockConsoleError: jest.SpyInstance;
16
+ }
17
+ /**
18
+ * Sets up console mocks for testing log output
19
+ * Replaces console methods with Jest spies to capture and verify log calls
20
+ * @returns ConsoleMocks object containing all spy instances
21
+ */
22
+ export declare const setupConsoleMocks: () => ConsoleMocks;
23
+ /**
24
+ * Restores console mocks after testing
25
+ * Cleans up Jest spies and restores original console functionality
26
+ * @param mocks - The ConsoleMocks object from setupConsoleMocks
27
+ */
28
+ export declare const restoreConsoleMocks: (mocks: ConsoleMocks) => void;
29
+ /**
30
+ * Convenience function for setting up console mocks in beforeEach hooks
31
+ * Identical to setupConsoleMocks but with a more descriptive name for test setup
32
+ * @returns ConsoleMocks object containing all spy instances
33
+ */
34
+ export declare const setupConsoleBeforeEach: () => ConsoleMocks;
35
+ /**
36
+ * Convenience function for restoring console mocks in afterEach hooks
37
+ * Identical to restoreConsoleMocks but with a more descriptive name for test cleanup
38
+ * @param mocks - The ConsoleMocks object to restore
39
+ */
40
+ export declare const restoreConsoleAfterEach: (mocks: ConsoleMocks) => void;
41
+ //# sourceMappingURL=test-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../../src/__tests__/test-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,4DAA4D;IAC5D,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC;IACjC,kDAAkD;IAClD,eAAe,EAAE,IAAI,CAAC,WAAW,CAAC;IAClC,oDAAoD;IACpD,gBAAgB,EAAE,IAAI,CAAC,WAAW,CAAC;CACpC;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAO,YAMpC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,YAAY,KAAG,IAIzD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAAO,YAEzC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAAI,OAAO,YAAY,KAAG,IAE7D,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Shared test utilities for log-engine tests
3
+ * Provides consistent console mocking and cleanup functionality across all test suites
4
+ */
5
+ /**
6
+ * Sets up console mocks for testing log output
7
+ * Replaces console methods with Jest spies to capture and verify log calls
8
+ * @returns ConsoleMocks object containing all spy instances
9
+ */
10
+ export const setupConsoleMocks = () => {
11
+ const mockConsoleLog = jest.spyOn(console, 'log').mockImplementation();
12
+ const mockConsoleWarn = jest.spyOn(console, 'warn').mockImplementation();
13
+ const mockConsoleError = jest.spyOn(console, 'error').mockImplementation();
14
+ return { mockConsoleLog, mockConsoleWarn, mockConsoleError };
15
+ };
16
+ /**
17
+ * Restores console mocks after testing
18
+ * Cleans up Jest spies and restores original console functionality
19
+ * @param mocks - The ConsoleMocks object from setupConsoleMocks
20
+ */
21
+ export const restoreConsoleMocks = (mocks) => {
22
+ mocks.mockConsoleLog.mockRestore();
23
+ mocks.mockConsoleWarn.mockRestore();
24
+ mocks.mockConsoleError.mockRestore();
25
+ };
26
+ /**
27
+ * Convenience function for setting up console mocks in beforeEach hooks
28
+ * Identical to setupConsoleMocks but with a more descriptive name for test setup
29
+ * @returns ConsoleMocks object containing all spy instances
30
+ */
31
+ export const setupConsoleBeforeEach = () => {
32
+ return setupConsoleMocks();
33
+ };
34
+ /**
35
+ * Convenience function for restoring console mocks in afterEach hooks
36
+ * Identical to restoreConsoleMocks but with a more descriptive name for test cleanup
37
+ * @param mocks - The ConsoleMocks object to restore
38
+ */
39
+ export const restoreConsoleAfterEach = (mocks) => {
40
+ restoreConsoleMocks(mocks);
41
+ };
42
+ //# sourceMappingURL=test-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../../../src/__tests__/test-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAiB,EAAE;IAClD,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACvE,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACzE,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,kBAAkB,EAAE,CAAC;IAE3E,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC;AAC/D,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAmB,EAAQ,EAAE;IAC/D,KAAK,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC;IACnC,KAAK,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC;IACpC,KAAK,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC;AACvC,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAiB,EAAE;IACvD,OAAO,iBAAiB,EAAE,CAAC;AAC7B,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAmB,EAAQ,EAAE;IACnE,mBAAmB,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * ANSI color codes and color management for terminal output
3
+ * Provides consistent color definitions used throughout the formatting system
4
+ */
5
+ /**
6
+ * ANSI color codes for terminal output styling
7
+ * Used to create colorized console output with consistent theming
8
+ */
9
+ export declare const colors: {
10
+ readonly reset: "\u001B[0m";
11
+ readonly dim: "\u001B[2m";
12
+ readonly red: "\u001B[31m";
13
+ readonly yellow: "\u001B[33m";
14
+ readonly blue: "\u001B[34m";
15
+ readonly magenta: "\u001B[35m";
16
+ readonly cyan: "\u001B[36m";
17
+ readonly white: "\u001B[37m";
18
+ readonly gray: "\u001B[90m";
19
+ readonly green: "\u001B[32m";
20
+ };
21
+ /**
22
+ * Color scheme configuration
23
+ * Maps semantic meanings to specific colors for consistent theming
24
+ */
25
+ export declare const colorScheme: {
26
+ readonly timestamp: "\u001B[90m";
27
+ readonly timeString: "\u001B[36m";
28
+ readonly system: "\u001B[33m";
29
+ readonly data: "\u001B[2m";
30
+ readonly reset: "\u001B[0m";
31
+ };
32
+ //# sourceMappingURL=colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../../src/formatter/colors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;CAWT,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;CAMd,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * ANSI color codes and color management for terminal output
3
+ * Provides consistent color definitions used throughout the formatting system
4
+ */
5
+ /**
6
+ * ANSI color codes for terminal output styling
7
+ * Used to create colorized console output with consistent theming
8
+ */
9
+ export const colors = {
10
+ reset: '\x1b[0m', // Reset all formatting
11
+ dim: '\x1b[2m', // Dim/faded text
12
+ red: '\x1b[31m', // Red text (errors)
13
+ yellow: '\x1b[33m', // Yellow text (warnings)
14
+ blue: '\x1b[34m', // Blue text (info)
15
+ magenta: '\x1b[35m', // Magenta text (debug)
16
+ cyan: '\x1b[36m', // Cyan text (timestamps)
17
+ white: '\x1b[37m', // White text (default)
18
+ gray: '\x1b[90m', // Gray text (timestamps)
19
+ green: '\x1b[32m' // Green text (log level)
20
+ };
21
+ /**
22
+ * Color scheme configuration
23
+ * Maps semantic meanings to specific colors for consistent theming
24
+ */
25
+ export const colorScheme = {
26
+ timestamp: colors.gray,
27
+ timeString: colors.cyan,
28
+ system: colors.yellow,
29
+ data: colors.dim,
30
+ reset: colors.reset
31
+ };
32
+ //# sourceMappingURL=colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.js","sourceRoot":"","sources":["../../../src/formatter/colors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,EAAE,SAAS,EAAO,uBAAuB;IAC9C,GAAG,EAAE,SAAS,EAAS,iBAAiB;IACxC,GAAG,EAAE,UAAU,EAAQ,oBAAoB;IAC3C,MAAM,EAAE,UAAU,EAAK,yBAAyB;IAChD,IAAI,EAAE,UAAU,EAAO,mBAAmB;IAC1C,OAAO,EAAE,UAAU,EAAI,uBAAuB;IAC9C,IAAI,EAAE,UAAU,EAAO,yBAAyB;IAChD,KAAK,EAAE,UAAU,EAAM,uBAAuB;IAC9C,IAAI,EAAE,UAAU,EAAO,yBAAyB;IAChD,KAAK,EAAE,UAAU,CAAM,yBAAyB;CACxC,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC,IAAI;IACtB,UAAU,EAAE,MAAM,CAAC,IAAI;IACvB,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC,GAAG;IAChB,KAAK,EAAE,MAAM,CAAC,KAAK;CACX,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Data formatting utilities for log output
3
+ * Handles serialization and formatting of data objects in log messages
4
+ */
5
+ import { LogData } from '../types';
6
+ /**
7
+ * Converts input data to a readable string suitable for log output.
8
+ *
9
+ * Returns 'null' for `null`, an empty string for `undefined`, the value itself for strings, and string representations for numbers and booleans. For other types, attempts JSON serialization; if serialization fails, returns '[Object]'.
10
+ *
11
+ * @param data - The value to format for logging
12
+ * @returns The formatted string representation of the input data
13
+ */
14
+ export declare function formatData(data: LogData): string;
15
+ /**
16
+ * Applies color styling to a formatted data string using the provided color codes.
17
+ *
18
+ * @param dataString - The string to be styled; if falsy, an empty string is returned.
19
+ * @param colors - An object containing `data` (the color code prefix) and `reset` (the color code suffix).
20
+ * @returns The styled data string with color codes applied, or an empty string if `dataString` is falsy.
21
+ */
22
+ export declare function styleData(dataString: string, colors: {
23
+ data: string;
24
+ reset: string;
25
+ }): string;
26
+ //# sourceMappingURL=data-formatter.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Data formatting utilities for log output
3
+ * Handles serialization and formatting of data objects in log messages
4
+ */
5
+ /**
6
+ * Converts input data to a readable string suitable for log output.
7
+ *
8
+ * Returns 'null' for `null`, an empty string for `undefined`, the value itself for strings, and string representations for numbers and booleans. For other types, attempts JSON serialization; if serialization fails, returns '[Object]'.
9
+ *
10
+ * @param data - The value to format for logging
11
+ * @returns The formatted string representation of the input data
12
+ */
13
+ export function formatData(data) {
14
+ if (data === null) {
15
+ return 'null';
16
+ }
17
+ if (data === undefined) {
18
+ return '';
19
+ }
20
+ if (typeof data === 'string') {
21
+ return data;
22
+ }
23
+ if (typeof data === 'number' || typeof data === 'boolean') {
24
+ return String(data);
25
+ }
26
+ if (typeof data === 'symbol') {
27
+ return data.toString();
28
+ }
29
+ try {
30
+ return JSON.stringify(data, null, 0);
31
+ }
32
+ catch {
33
+ // Fallback for objects that can't be stringified (e.g., circular references)
34
+ return '[Object]';
35
+ }
36
+ }
37
+ /**
38
+ * Applies color styling to a formatted data string using the provided color codes.
39
+ *
40
+ * @param dataString - The string to be styled; if falsy, an empty string is returned.
41
+ * @param colors - An object containing `data` (the color code prefix) and `reset` (the color code suffix).
42
+ * @returns The styled data string with color codes applied, or an empty string if `dataString` is falsy.
43
+ */
44
+ export function styleData(dataString, colors) {
45
+ if (!dataString) {
46
+ return '';
47
+ }
48
+ return ` ${colors.data}${dataString}${colors.reset}`;
49
+ }
50
+ //# sourceMappingURL=data-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-formatter.js","sourceRoot":"","sources":["../../../src/formatter/data-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,IAAa;IACtC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,SAAS,EAAE,CAAC;QAC1D,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,6EAA6E;QAC7E,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,UAAkB,EAAE,MAAuC;IACnF,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,IAAI,MAAM,CAAC,IAAI,GAAG,UAAU,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;AACvD,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Formatter module exports
3
+ * Provides centralized access to all formatting functionality
4
+ */
5
+ export { MessageFormatter } from './message-formatter';
6
+ export { colors, colorScheme } from './colors';
7
+ export { getTimestampComponents, formatTimestamp } from './timestamp';
8
+ export { formatData, styleData } from './data-formatter';
9
+ export { MessageFormatter as LogFormatter } from './message-formatter';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/formatter/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,gBAAgB,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Formatter module exports
3
+ * Provides centralized access to all formatting functionality
4
+ */
5
+ export { MessageFormatter } from './message-formatter.js';
6
+ export { colors, colorScheme } from './colors.js';
7
+ export { getTimestampComponents, formatTimestamp } from './timestamp.js';
8
+ export { formatData, styleData } from './data-formatter.js';
9
+ // Backward compatibility - maintain the original LogFormatter class interface
10
+ export { MessageFormatter as LogFormatter } from './message-formatter.js';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formatter/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEzD,8EAA8E;AAC9E,OAAO,EAAE,gBAAgB,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC"}