@nimbus-cqrs/core 2.0.0-beta.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.
Files changed (79) hide show
  1. package/LICENSE +85 -0
  2. package/README.md +56 -0
  3. package/esm/_dnt.shims.d.ts +2 -0
  4. package/esm/_dnt.shims.d.ts.map +1 -0
  5. package/esm/_dnt.shims.js +57 -0
  6. package/esm/deps/jsr.io/@std/fmt/1.0.10/colors.d.ts +700 -0
  7. package/esm/deps/jsr.io/@std/fmt/1.0.10/colors.d.ts.map +1 -0
  8. package/esm/deps/jsr.io/@std/fmt/1.0.10/colors.js +903 -0
  9. package/esm/deps/jsr.io/@std/ulid/1.0.0/_util.d.ts +14 -0
  10. package/esm/deps/jsr.io/@std/ulid/1.0.0/_util.d.ts.map +1 -0
  11. package/esm/deps/jsr.io/@std/ulid/1.0.0/_util.js +65 -0
  12. package/esm/deps/jsr.io/@std/ulid/1.0.0/decode_time.d.ts +20 -0
  13. package/esm/deps/jsr.io/@std/ulid/1.0.0/decode_time.d.ts.map +1 -0
  14. package/esm/deps/jsr.io/@std/ulid/1.0.0/decode_time.js +43 -0
  15. package/esm/deps/jsr.io/@std/ulid/1.0.0/mod.d.ts +44 -0
  16. package/esm/deps/jsr.io/@std/ulid/1.0.0/mod.d.ts.map +1 -0
  17. package/esm/deps/jsr.io/@std/ulid/1.0.0/mod.js +47 -0
  18. package/esm/deps/jsr.io/@std/ulid/1.0.0/monotonic_ulid.d.ts +44 -0
  19. package/esm/deps/jsr.io/@std/ulid/1.0.0/monotonic_ulid.d.ts.map +1 -0
  20. package/esm/deps/jsr.io/@std/ulid/1.0.0/monotonic_ulid.js +51 -0
  21. package/esm/deps/jsr.io/@std/ulid/1.0.0/ulid.d.ts +31 -0
  22. package/esm/deps/jsr.io/@std/ulid/1.0.0/ulid.d.ts.map +1 -0
  23. package/esm/deps/jsr.io/@std/ulid/1.0.0/ulid.js +37 -0
  24. package/esm/index.d.ts +18 -0
  25. package/esm/index.d.ts.map +1 -0
  26. package/esm/index.js +17 -0
  27. package/esm/lib/eventBus/eventBus.d.ts +329 -0
  28. package/esm/lib/eventBus/eventBus.d.ts.map +1 -0
  29. package/esm/lib/eventBus/eventBus.js +473 -0
  30. package/esm/lib/exception/exception.d.ts +10 -0
  31. package/esm/lib/exception/exception.d.ts.map +1 -0
  32. package/esm/lib/exception/exception.js +26 -0
  33. package/esm/lib/exception/forbiddenException.d.ts +8 -0
  34. package/esm/lib/exception/forbiddenException.d.ts.map +1 -0
  35. package/esm/lib/exception/forbiddenException.js +9 -0
  36. package/esm/lib/exception/genericException.d.ts +8 -0
  37. package/esm/lib/exception/genericException.d.ts.map +1 -0
  38. package/esm/lib/exception/genericException.js +9 -0
  39. package/esm/lib/exception/invalidInputException.d.ts +18 -0
  40. package/esm/lib/exception/invalidInputException.d.ts.map +1 -0
  41. package/esm/lib/exception/invalidInputException.js +28 -0
  42. package/esm/lib/exception/notFoundException.d.ts +8 -0
  43. package/esm/lib/exception/notFoundException.d.ts.map +1 -0
  44. package/esm/lib/exception/notFoundException.js +9 -0
  45. package/esm/lib/exception/unauthorizedException.d.ts +8 -0
  46. package/esm/lib/exception/unauthorizedException.d.ts.map +1 -0
  47. package/esm/lib/exception/unauthorizedException.js +9 -0
  48. package/esm/lib/log/logFormatter.d.ts +26 -0
  49. package/esm/lib/log/logFormatter.d.ts.map +1 -0
  50. package/esm/lib/log/logFormatter.js +59 -0
  51. package/esm/lib/log/logLevel.d.ts +24 -0
  52. package/esm/lib/log/logLevel.d.ts.map +1 -0
  53. package/esm/lib/log/logLevel.js +27 -0
  54. package/esm/lib/log/logger.d.ts +377 -0
  55. package/esm/lib/log/logger.d.ts.map +1 -0
  56. package/esm/lib/log/logger.js +394 -0
  57. package/esm/lib/log/options.d.ts +34 -0
  58. package/esm/lib/log/options.d.ts.map +1 -0
  59. package/esm/lib/log/options.js +9 -0
  60. package/esm/lib/message/command.d.ts +100 -0
  61. package/esm/lib/message/command.d.ts.map +1 -0
  62. package/esm/lib/message/command.js +47 -0
  63. package/esm/lib/message/event.d.ts +103 -0
  64. package/esm/lib/message/event.d.ts.map +1 -0
  65. package/esm/lib/message/event.js +47 -0
  66. package/esm/lib/message/message.d.ts +18 -0
  67. package/esm/lib/message/message.d.ts.map +1 -0
  68. package/esm/lib/message/message.js +1 -0
  69. package/esm/lib/message/query.d.ts +95 -0
  70. package/esm/lib/message/query.d.ts.map +1 -0
  71. package/esm/lib/message/query.js +45 -0
  72. package/esm/lib/message/router.d.ts +233 -0
  73. package/esm/lib/message/router.d.ts.map +1 -0
  74. package/esm/lib/message/router.js +304 -0
  75. package/esm/lib/tracing/withSpan.d.ts +67 -0
  76. package/esm/lib/tracing/withSpan.d.ts.map +1 -0
  77. package/esm/lib/tracing/withSpan.js +87 -0
  78. package/esm/package.json +3 -0
  79. package/package.json +33 -0
@@ -0,0 +1,26 @@
1
+ import type { LogRecord } from './logger.js';
2
+ /**
3
+ * Type for a function that formats a log record before outputting it.
4
+ *
5
+ * @param {LogRecord} logRecord - The log record
6
+ *
7
+ * @returns {string} The formatted log record
8
+ */
9
+ export type LogFormatter = (logRecord: LogRecord) => string | string[];
10
+ /**
11
+ * A formatter that outputs the log record in JSON format.
12
+ *
13
+ * @param {LogRecord} logRecord - The log record
14
+ *
15
+ * @returns {string} The formatted log record
16
+ */
17
+ export declare const jsonLogFormatter: LogFormatter;
18
+ /**
19
+ * A formatter that outputs the log record in a pretty format.
20
+ *
21
+ * @param {LogRecord} logRecord - The log record
22
+ *
23
+ * @returns {string} The formatted log record
24
+ */
25
+ export declare const prettyLogFormatter: LogFormatter;
26
+ //# sourceMappingURL=logFormatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logFormatter.d.ts","sourceRoot":"","sources":["../../../src/lib/log/logFormatter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,SAAS,KAAK,MAAM,GAAG,MAAM,EAAE,CAAC;AAEvE;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,YA6B9B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,YA6BhC,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { Exception } from '../exception/exception.js';
2
+ /**
3
+ * A formatter that outputs the log record in JSON format.
4
+ *
5
+ * @param {LogRecord} logRecord - The log record
6
+ *
7
+ * @returns {string} The formatted log record
8
+ */
9
+ export const jsonLogFormatter = (logRecord) => {
10
+ let processedLogRecord = logRecord;
11
+ if (logRecord.error) {
12
+ // Special handling for Error objects to preserve stack traces
13
+ const processedErrorObj = JSON.parse(JSON.stringify(logRecord, (_key, value) => {
14
+ if (value instanceof Error || value instanceof Exception) {
15
+ return {
16
+ // Include standard error properties
17
+ ...value,
18
+ message: value.message,
19
+ name: value.name,
20
+ stack: value.stack,
21
+ };
22
+ }
23
+ return value;
24
+ }, 2));
25
+ processedLogRecord = {
26
+ ...logRecord,
27
+ error: processedErrorObj,
28
+ };
29
+ }
30
+ return JSON.stringify(processedLogRecord);
31
+ };
32
+ /**
33
+ * A formatter that outputs the log record in a pretty format.
34
+ *
35
+ * @param {LogRecord} logRecord - The log record
36
+ *
37
+ * @returns {string} The formatted log record
38
+ */
39
+ export const prettyLogFormatter = (logRecord) => {
40
+ let dataString = '';
41
+ let errorString = '';
42
+ let correlationId = '';
43
+ if (logRecord.correlationId) {
44
+ correlationId = `(${logRecord.correlationId}) `;
45
+ }
46
+ if (logRecord.data) {
47
+ dataString = JSON.stringify(logRecord.data, null, 2);
48
+ }
49
+ if (logRecord.error) {
50
+ errorString = JSON.stringify(logRecord.error, null, 2);
51
+ return [
52
+ `[${logRecord.category}] ${logRecord.level.toUpperCase()} ${correlationId}:: ${logRecord.message}`,
53
+ errorString.length ? `\n${errorString}` : '',
54
+ logRecord.error.stack ? `\n${logRecord.error.stack}` : '',
55
+ dataString.length ? `\n${dataString}` : '',
56
+ ];
57
+ }
58
+ return `[${logRecord.category}] ${logRecord.level.toUpperCase()} ${correlationId}:: ${logRecord.message}${dataString.length ? `\n${dataString}` : ''}`;
59
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * There are different log levels or severity levels that can be used to categorize the log messages.
3
+ *
4
+ * Debug: Detailed information useful for diagnosing problems.
5
+ * Information: General information about the application's operation.
6
+ * Warning: An unexpected event that doesn't prevent the application from functioning.
7
+ * Error: A more severe problem that prevented a specific operation from being completed.
8
+ * Critical: A critical error that causes the application to crash.
9
+ * Silent: No log messages are emitted. This level does not provide a logging function, but it can be used to disable logging.
10
+ */
11
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'critical' | 'silent';
12
+ /**
13
+ * The numeric representation of the LogLeveL type.
14
+ */
15
+ export declare const numericLogLevel: Record<LogLevel, number>;
16
+ /**
17
+ * Parses a log level from a string.
18
+ *
19
+ * @param {string} levelString - The log level as a string
20
+ *
21
+ * @returns {LogLevel} The log level
22
+ */
23
+ export declare const parseLogLevel: (levelString?: string) => LogLevel;
24
+ //# sourceMappingURL=logLevel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logLevel.d.ts","sourceRoot":"","sources":["../../../src/lib/log/logLevel.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,GACd,OAAO,GACP,MAAM,GACN,MAAM,GACN,OAAO,GACP,UAAU,GACV,QAAQ,CAAC;AAEf;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAOpD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,cAAc,MAAM,KAAG,QAYpD,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { defaultLogOptions } from './options.js';
2
+ /**
3
+ * The numeric representation of the LogLeveL type.
4
+ */
5
+ export const numericLogLevel = {
6
+ debug: 10,
7
+ info: 20,
8
+ warn: 30,
9
+ error: 40,
10
+ critical: 50,
11
+ silent: 100,
12
+ };
13
+ /**
14
+ * Parses a log level from a string.
15
+ *
16
+ * @param {string} levelString - The log level as a string
17
+ *
18
+ * @returns {LogLevel} The log level
19
+ */
20
+ export const parseLogLevel = (levelString) => {
21
+ let logLevel = levelString?.toLowerCase();
22
+ if (!logLevel || !Object.keys(numericLogLevel).includes(logLevel)) {
23
+ console.warn(`Invalid log level: ${levelString}, using default log level: ${defaultLogOptions.logLevel}`);
24
+ logLevel = defaultLogOptions.logLevel;
25
+ }
26
+ return logLevel;
27
+ };
@@ -0,0 +1,377 @@
1
+ import type { Exception } from '../exception/exception.js';
2
+ import { type LogLevel } from './logLevel.js';
3
+ import { type LogOptions } from './options.js';
4
+ /**
5
+ * The input for a log message.
6
+ *
7
+ * Use this type when calling any of the Logger's log methods (debug, info, warn, error, critical).
8
+ */
9
+ export type LogInput = {
10
+ /**
11
+ * The log message to output. This should be a human-readable description of what occurred.
12
+ */
13
+ message: string;
14
+ /**
15
+ * An optional category to group related log messages.
16
+ * Useful for filtering logs by component or domain (e.g., 'Database', 'API', 'Auth').
17
+ * Defaults to 'Default' if not provided.
18
+ */
19
+ category?: string;
20
+ /**
21
+ * Optional structured data to include with the log message.
22
+ * This data will be serialized according to the configured formatter.
23
+ */
24
+ data?: Record<string, unknown>;
25
+ /**
26
+ * Optional error or exception to include with the log message.
27
+ * The error's message and stack trace will be captured in the log output.
28
+ */
29
+ error?: Error;
30
+ /**
31
+ * Optional correlation ID to trace related log messages across operations.
32
+ * Useful for tracking a request through multiple services or handlers.
33
+ */
34
+ correlationId?: string;
35
+ };
36
+ /**
37
+ * A full log record with the log input and additional metadata attached.
38
+ *
39
+ * This type is passed to the LogFormatter function to produce the final log output.
40
+ */
41
+ export type LogRecord = {
42
+ /**
43
+ * The timestamp when the log message was created.
44
+ */
45
+ timestamp: Date;
46
+ /**
47
+ * The severity level of the log message (debug, info, warn, error, critical).
48
+ */
49
+ level: LogLevel;
50
+ /**
51
+ * The category for grouping related log messages.
52
+ */
53
+ category: string;
54
+ /**
55
+ * The log message describing what occurred.
56
+ */
57
+ message: string;
58
+ /**
59
+ * Optional structured data included with the log message.
60
+ */
61
+ data?: Record<string, unknown>;
62
+ /**
63
+ * Optional error or exception included with the log message.
64
+ */
65
+ error?: Error | Exception;
66
+ /**
67
+ * Optional correlation ID for tracing related log messages.
68
+ */
69
+ correlationId?: string;
70
+ };
71
+ /**
72
+ * The Logger provides structured logging with configurable log levels, formatters, and console colors.
73
+ *
74
+ * The Logger is a singleton that should be configured once at application startup using
75
+ * {@link setupLogger}, then accessed throughout the application using {@link getLogger}.
76
+ *
77
+ * Log levels in order of severity: debug < info < warn < error < critical.
78
+ * Messages below the configured log level are silently ignored.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * import {
83
+ * getLogger,
84
+ * jsonLogFormatter,
85
+ * parseLogLevel,
86
+ * prettyLogFormatter,
87
+ * setupLogger,
88
+ * } from '@nimbus/core';
89
+ *
90
+ * // Configure the logger at application startup
91
+ * setupLogger({
92
+ * logLevel: parseLogLevel(process.env.LOG_LEVEL),
93
+ * formatter: process.env.NODE_ENV === 'production'
94
+ * ? jsonLogFormatter
95
+ * : prettyLogFormatter,
96
+ * useConsoleColors: process.env.NODE_ENV !== 'production',
97
+ * });
98
+ *
99
+ * // Use the logger throughout your application
100
+ * const logger = getLogger();
101
+ *
102
+ * logger.info({
103
+ * message: 'Application started',
104
+ * category: 'App',
105
+ * data: { port: 3000, environment: 'production' },
106
+ * });
107
+ *
108
+ * logger.error({
109
+ * message: 'Failed to connect to database',
110
+ * category: 'Database',
111
+ * error: new Error('Connection timeout'),
112
+ * correlationId: '550e8400-e29b-41d4-a716-446655440000',
113
+ * });
114
+ * ```
115
+ */
116
+ export declare class Logger {
117
+ private static _instance;
118
+ private readonly _logLevel;
119
+ private readonly _formatter;
120
+ private readonly _useConsoleColors;
121
+ constructor(options: LogOptions);
122
+ /**
123
+ * Configure the Logger.
124
+ *
125
+ * @param {LogOptions} options - The options for the Logger
126
+ * @param {LogLevel} options.logLevel - The log level to use for the Logger
127
+ * @param {LogFormatter} options.formatter - The formatter to use for the Logger
128
+ */
129
+ static configure(options: LogOptions): void;
130
+ /**
131
+ * Get the Logger instance.
132
+ *
133
+ * @returns {Logger} The Logger instance
134
+ */
135
+ static getInstance(): Logger;
136
+ /**
137
+ * Log a message at the debug level.
138
+ *
139
+ * @param {LogInput} logInput - The log input
140
+ * @param {string} logInput.message - The message
141
+ * @param {string} logInput.category - An optional category
142
+ * @param {string} logInput.correlationId - An optional correlation ID
143
+ * @param {Record<string, unknown>} logInput.data - An optional data object
144
+ * @param {Error | Exception} logInput.error - An optional error
145
+ *
146
+ * @example
147
+ * ```ts
148
+ * import { getLogger } from "@nimbus/core";
149
+ *
150
+ * getLogger().debug({
151
+ * message: 'Hello World!',
152
+ * category: 'MyCategory',
153
+ * correlationId: '1234567890',
154
+ * data: {
155
+ * foo: 'bar',
156
+ * },
157
+ * error: new Error('Something went wrong!'),
158
+ * });
159
+ * ```
160
+ */
161
+ debug(logInput: LogInput): void;
162
+ /**
163
+ * Log a message at the info level.
164
+ *
165
+ * @param {LogInput} logInput - The log input
166
+ * @param {string} logInput.message - The message
167
+ * @param {string} logInput.category - An optional category
168
+ * @param {string} logInput.correlationId - An optional correlation ID
169
+ * @param {Record<string, unknown>} logInput.data - An optional data object
170
+ * @param {Error | Exception} logInput.error - An optional error
171
+ *
172
+ * @example
173
+ * ```ts
174
+ * import { getLogger } from "@nimbus/core";
175
+ *
176
+ * getLogger().info({
177
+ * message: 'Hello World!',
178
+ * category: 'MyCategory',
179
+ * correlationId: '1234567890',
180
+ * data: {
181
+ * foo: 'bar',
182
+ * },
183
+ * error: new Error('Something went wrong!'),
184
+ * });
185
+ * ```
186
+ */
187
+ info(logInput: LogInput): void;
188
+ /**
189
+ * Log a message at the warn level.
190
+ *
191
+ * @param {LogInput} logInput - The log input
192
+ * @param {string} logInput.message - The message
193
+ * @param {string} logInput.category - An optional category
194
+ * @param {string} logInput.correlationId - An optional correlation ID
195
+ * @param {Record<string, unknown>} logInput.data - An optional data object
196
+ * @param {Error | Exception} logInput.error - An optional error
197
+ *
198
+ * @example
199
+ * ```ts
200
+ * import { getLogger } from "@nimbus/core";
201
+ *
202
+ * getLogger().warn({
203
+ * message: 'Hello World!',
204
+ * category: 'MyCategory',
205
+ * correlationId: '1234567890',
206
+ * data: {
207
+ * foo: 'bar',
208
+ * },
209
+ * error: new Error('Something went wrong!'),
210
+ * });
211
+ * ```
212
+ */
213
+ warn(logInput: LogInput): void;
214
+ /**
215
+ * Log a message at the error level.
216
+ *
217
+ * @param {LogInput} logInput - The log input
218
+ * @param {string} logInput.message - The message
219
+ * @param {string} logInput.category - An optional category
220
+ * @param {string} logInput.correlationId - An optional correlation ID
221
+ * @param {Record<string, unknown>} logInput.data - An optional data object
222
+ * @param {Error | Exception} logInput.error - An optional error
223
+ *
224
+ * @example
225
+ * ```ts
226
+ * import { getLogger } from "@nimbus/core";
227
+ *
228
+ * getLogger().error({
229
+ * message: 'Hello World!',
230
+ * category: 'MyCategory',
231
+ * correlationId: '1234567890',
232
+ * data: {
233
+ * foo: 'bar',
234
+ * },
235
+ * error: new Error('Something went wrong!'),
236
+ * });
237
+ * ```
238
+ */
239
+ error(logInput: LogInput): void;
240
+ /**
241
+ * Log a message at the critical level.
242
+ *
243
+ * @param {LogInput} logInput - The log input
244
+ * @param {string} logInput.message - The message
245
+ * @param {string} logInput.category - An optional category
246
+ * @param {string} logInput.correlationId - An optional correlation ID
247
+ * @param {Record<string, unknown>} logInput.data - An optional data object
248
+ * @param {Error | Exception} logInput.error - An optional error
249
+ *
250
+ * @example
251
+ * ```ts
252
+ * import { getLogger } from "@nimbus/core";
253
+ *
254
+ * getLogger().critical({
255
+ * message: 'Hello World!',
256
+ * category: 'MyCategory',
257
+ * correlationId: '1234567890',
258
+ * data: {
259
+ * foo: 'bar',
260
+ * },
261
+ * error: new Error('Something went wrong!'),
262
+ * });
263
+ * ```
264
+ */
265
+ critical(logInput: LogInput): void;
266
+ /**
267
+ * Produce a log record.
268
+ *
269
+ * @param {LogInput} logInput - The log input
270
+ * @param {LogLevel} level - The log level
271
+ *
272
+ * @returns {LogRecord} The log record
273
+ */
274
+ private _produceLogRecord;
275
+ /**
276
+ * Format a log record.
277
+ *
278
+ * @param {LogRecord} logRecord - The log record
279
+ *
280
+ * @returns {string} The formatted log record
281
+ */
282
+ private _formatLogRecord;
283
+ /**
284
+ * Colorize a string.
285
+ *
286
+ * @param {string} string - The string to colorize
287
+ * @param {LogLevel} logLevel - The log level to determine the color
288
+ *
289
+ * @returns {string} The colorized string
290
+ */
291
+ private _colorizeString;
292
+ /**
293
+ * Log a message.
294
+ *
295
+ * @param {LogInput} logInput - The log input
296
+ * @param {LogLevel} logLevel - The log level
297
+ * @param {Function} logFunction - The log function
298
+ */
299
+ private _log;
300
+ }
301
+ /**
302
+ * Configure the Logger.
303
+ *
304
+ * @param {LogOptions} options - The options for the Logger
305
+ *
306
+ * @example
307
+ * ```ts
308
+ * import {
309
+ * jsonLogFormatter,
310
+ * parseLogLevel,
311
+ * prettyLogFormatter,
312
+ * setupLogger,
313
+ * } from "@nimbus/core";
314
+ *
315
+ * setupLogger({
316
+ * logLevel: parseLogLevel(process.env.LOG_LEVEL),
317
+ * formatter:
318
+ * process.env.NODE_ENV === "development"
319
+ * ? prettyLogFormatter
320
+ * : jsonLogFormatter,
321
+ * useConsoleColors: process.env.NODE_ENV === "development",
322
+ * });
323
+ * ```
324
+ */
325
+ export declare const setupLogger: (options: LogOptions) => void;
326
+ /**
327
+ * Get the Logger instance.
328
+ *
329
+ * Returns the singleton Logger instance. If the logger has not been configured
330
+ * via {@link setupLogger}, a default logger with silent log level is returned.
331
+ *
332
+ * @returns The Logger instance.
333
+ *
334
+ * @example
335
+ * ```ts
336
+ * import { getLogger } from '@nimbus/core';
337
+ *
338
+ * const logger = getLogger();
339
+ *
340
+ * // Log at different levels with all available options
341
+ * logger.debug({
342
+ * message: 'Processing request',
343
+ * category: 'API',
344
+ * data: { method: 'POST', path: '/orders' },
345
+ * correlationId: '550e8400-e29b-41d4-a716-446655440000',
346
+ * });
347
+ *
348
+ * logger.info({
349
+ * message: 'Order created successfully',
350
+ * category: 'Orders',
351
+ * data: { orderId: '12345', customerId: '67890' },
352
+ * correlationId: '550e8400-e29b-41d4-a716-446655440000',
353
+ * });
354
+ *
355
+ * logger.warn({
356
+ * message: 'Rate limit approaching',
357
+ * category: 'API',
358
+ * data: { currentRate: 95, maxRate: 100 },
359
+ * });
360
+ *
361
+ * logger.error({
362
+ * message: 'Failed to process payment',
363
+ * category: 'Payments',
364
+ * data: { orderId: '12345' },
365
+ * error: new Error('Payment gateway timeout'),
366
+ * correlationId: '550e8400-e29b-41d4-a716-446655440000',
367
+ * });
368
+ *
369
+ * logger.critical({
370
+ * message: 'Database connection lost',
371
+ * category: 'Database',
372
+ * error: new Error('Connection refused'),
373
+ * });
374
+ * ```
375
+ */
376
+ export declare const getLogger: () => Logger;
377
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/lib/log/logger.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,KAAK,QAAQ,EAAmB,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAElE;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG;IACnB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;OAGG;I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