@nizza/core 0.6.8 → 0.7.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.
- package/dist/environments/environment.d.ts +2 -22
- package/dist/environments/environment.d.ts.map +1 -1
- package/dist/environments/environment.prod.d.ts +2 -22
- package/dist/environments/environment.prod.d.ts.map +1 -1
- package/dist/environments/types.d.ts +23 -0
- package/dist/environments/types.d.ts.map +1 -0
- package/dist/index.cjs +82 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +13364 -6234
- package/dist/index.mjs.map +1 -1
- package/dist/lib/accounts/core/domain/shared/errors.d.ts +6 -0
- package/dist/lib/accounts/core/domain/shared/errors.d.ts.map +1 -1
- package/dist/lib/accounts/core/index.d.ts.map +1 -1
- package/dist/lib/accounts/core/infrastructure/repositories/rest-account-plan.repository.d.ts.map +1 -1
- package/dist/lib/accounts/core/infrastructure/repositories/rest-private-account.repository.d.ts +2 -2
- package/dist/lib/accounts/core/infrastructure/repositories/rest-private-account.repository.d.ts.map +1 -1
- package/dist/lib/accounts/core/infrastructure/repositories/rest-public-account.repository.d.ts +2 -2
- package/dist/lib/accounts/core/infrastructure/repositories/rest-public-account.repository.d.ts.map +1 -1
- package/dist/lib/accounts/core/services/account.service.d.ts.map +1 -1
- package/dist/lib/accounts/hooks/account.hook.d.ts +9 -6
- package/dist/lib/accounts/hooks/account.hook.d.ts.map +1 -1
- package/dist/lib/accounts/states/account.d.ts +2 -3
- package/dist/lib/accounts/states/account.d.ts.map +1 -1
- package/dist/lib/accounts/utils/getAccount.d.ts +2 -1
- package/dist/lib/accounts/utils/getAccount.d.ts.map +1 -1
- package/dist/lib/add-to-cart/hooks.d.ts +4 -4
- package/dist/lib/add-to-cart/hooks.d.ts.map +1 -1
- package/dist/lib/clean-architecture/domain/AggregateRoot.d.ts.map +1 -1
- package/dist/lib/clean-architecture/domain/ValueObject.d.ts.map +1 -1
- package/dist/lib/clean-architecture/infrastructure/clients/http-axios.client.d.ts +1 -1
- package/dist/lib/clean-architecture/infrastructure/clients/http-axios.client.d.ts.map +1 -1
- package/dist/lib/constants/index.d.ts +2 -1
- package/dist/lib/constants/index.d.ts.map +1 -1
- package/dist/lib/constants/log.constant.d.ts +11 -0
- package/dist/lib/constants/log.constant.d.ts.map +1 -0
- package/dist/lib/dexie/base.db.d.ts +7 -0
- package/dist/lib/dexie/base.db.d.ts.map +1 -0
- package/dist/lib/dexie/entities/index.d.ts +2 -0
- package/dist/lib/dexie/entities/index.d.ts.map +1 -0
- package/dist/lib/dexie/entities/log.entity.d.ts +14 -0
- package/dist/lib/dexie/entities/log.entity.d.ts.map +1 -0
- package/dist/lib/dexie/index.d.ts +3 -0
- package/dist/lib/dexie/index.d.ts.map +1 -0
- package/dist/lib/dexie/nizza.db.d.ts +7 -0
- package/dist/lib/dexie/nizza.db.d.ts.map +1 -0
- package/dist/lib/errors/DomainError.d.ts +2 -2
- package/dist/lib/errors/DomainError.d.ts.map +1 -1
- package/dist/lib/event-buses/BroadcastChannelEventBus.d.ts +2 -2
- package/dist/lib/event-buses/BroadcastChannelEventBus.d.ts.map +1 -1
- package/dist/lib/i18n/buildTranslations.d.ts.map +1 -1
- package/dist/lib/i18n/init.d.ts.map +1 -1
- package/dist/lib/i18n/nizza.d.ts.map +1 -1
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ivs/socket/core/domain/entities/chat-client-socket.entity.d.ts +2 -2
- package/dist/lib/ivs/socket/core/domain/entities/chat-client-socket.entity.d.ts.map +1 -1
- package/dist/lib/ivs/socket/core/index.d.ts.map +1 -1
- package/dist/lib/ivs/socket/hooks/use-chat-socket-actions.hook.d.ts +4 -3
- package/dist/lib/ivs/socket/hooks/use-chat-socket-actions.hook.d.ts.map +1 -1
- package/dist/lib/ivs/socket/hooks/use-chat-socket-handlers.hook.d.ts +5 -4
- package/dist/lib/ivs/socket/hooks/use-chat-socket-handlers.hook.d.ts.map +1 -1
- package/dist/lib/ivs/socket/hooks/use-connect-chat-socket.hook.d.ts +7 -6
- package/dist/lib/ivs/socket/hooks/use-connect-chat-socket.hook.d.ts.map +1 -1
- package/dist/lib/ivs/socket/hooks/use-event-chat-room.hook.d.ts +3 -2
- package/dist/lib/ivs/socket/hooks/use-event-chat-room.hook.d.ts.map +1 -1
- package/dist/lib/ivs/socket/state.d.ts +4 -9
- package/dist/lib/ivs/socket/state.d.ts.map +1 -1
- package/dist/lib/ivs/socket/utils/connect-to-socket.util.d.ts.map +1 -1
- package/dist/lib/ivs/socket/utils/get-random-color.util.d.ts.map +1 -1
- package/dist/lib/lit/react-host-element.d.ts +3 -3
- package/dist/lib/lit/react-host-element.d.ts.map +1 -1
- package/dist/lib/logger/__tests__/utils.d.ts +6 -0
- package/dist/lib/logger/__tests__/utils.d.ts.map +1 -0
- package/dist/lib/logger/constants.d.ts +3 -0
- package/dist/lib/logger/constants.d.ts.map +1 -0
- package/dist/lib/logger/core/adapters/pino.adapter.d.ts +89 -0
- package/dist/lib/logger/core/adapters/pino.adapter.d.ts.map +1 -0
- package/dist/lib/logger/core/logger-chain.d.ts +24 -0
- package/dist/lib/logger/core/logger-chain.d.ts.map +1 -0
- package/dist/lib/logger/core/loggers/console/config.d.ts +3 -0
- package/dist/lib/logger/core/loggers/console/config.d.ts.map +1 -0
- package/dist/lib/logger/core/loggers/console/console.logger.d.ts +50 -0
- package/dist/lib/logger/core/loggers/console/console.logger.d.ts.map +1 -0
- package/dist/lib/logger/core/loggers/console/index.d.ts +2 -0
- package/dist/lib/logger/core/loggers/console/index.d.ts.map +1 -0
- package/dist/lib/logger/core/loggers/http.logger.d.ts +24 -0
- package/dist/lib/logger/core/loggers/http.logger.d.ts.map +1 -0
- package/dist/lib/logger/core/services/local-storage-level.service.d.ts +59 -0
- package/dist/lib/logger/core/services/local-storage-level.service.d.ts.map +1 -0
- package/dist/lib/logger/core/utils.d.ts +16 -0
- package/dist/lib/logger/core/utils.d.ts.map +1 -0
- package/dist/lib/logger/index.d.ts +6 -0
- package/dist/lib/logger/index.d.ts.map +1 -0
- package/dist/lib/logger/logger.d.ts +199 -0
- package/dist/lib/logger/logger.d.ts.map +1 -0
- package/dist/lib/logger/types.d.ts +108 -0
- package/dist/lib/logger/types.d.ts.map +1 -0
- package/dist/lib/mobx/hooks.d.ts.map +1 -1
- package/dist/lib/nizza-store/NizzaStore.d.ts +5 -4
- package/dist/lib/nizza-store/NizzaStore.d.ts.map +1 -1
- package/dist/lib/nizza-store/helpers.d.ts.map +1 -1
- package/dist/lib/runtime/component-manager.d.ts +1 -1
- package/dist/lib/runtime/component-manager.d.ts.map +1 -1
- package/dist/lib/runtime/implementations/external-runtime.d.ts.map +1 -1
- package/dist/lib/runtime/implementations/index.d.ts +2 -7
- package/dist/lib/runtime/implementations/index.d.ts.map +1 -1
- package/dist/lib/runtime/implementations/local-runtime.d.ts.map +1 -1
- package/dist/lib/runtime/implementations/platform.d.ts.map +1 -1
- package/dist/lib/runtime/implementations/vtex-faststore-runtime.d.ts.map +1 -1
- package/dist/lib/runtime/implementations/vtex-io-runtime.d.ts.map +1 -1
- package/dist/lib/runtime/implementations/vtex-legacy-runtime.d.ts.map +1 -1
- package/dist/lib/runtime/runtime.d.ts +3 -3
- package/dist/lib/runtime/runtime.d.ts.map +1 -1
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/index.d.ts.map +1 -1
- package/dist/lib/types/log.type.d.ts +82 -0
- package/dist/lib/types/log.type.d.ts.map +1 -0
- package/dist/lib/types/nizza/globalStore.d.ts +2 -2
- package/dist/lib/types/nizza/globalStore.d.ts.map +1 -1
- package/dist/lib/types/nizza/nizzaEvent.d.ts +3 -3
- package/dist/lib/types/nizza/nizzaEvent.d.ts.map +1 -1
- package/dist/lib/types/runtime/base.d.ts +1 -1
- package/dist/lib/types/runtime/base.d.ts.map +1 -1
- package/dist/lib/utils/customFetch.d.ts.map +1 -1
- package/dist/lib/utils/downloadFile.d.ts.map +1 -1
- package/dist/lib/utils/getClientMetadata.d.ts +8 -0
- package/dist/lib/utils/getClientMetadata.d.ts.map +1 -0
- package/dist/lib/utils/getClientTimeZone.d.ts +3 -2
- package/dist/lib/utils/getClientTimeZone.d.ts.map +1 -1
- package/dist/lib/utils/helpers.d.ts.map +1 -1
- package/dist/lib/utils/index.d.ts +1 -2
- package/dist/lib/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/lib/utils/createLazyLogger.d.ts +0 -12
- package/dist/lib/utils/createLazyLogger.d.ts.map +0 -1
- package/dist/lib/utils/logger.d.ts +0 -12
- package/dist/lib/utils/logger.d.ts.map +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { LogLevel } from '../../../constants';
|
|
2
|
+
import { LevelService, LogEntry, LoggerAdapter, LoggerMetadata } from '../../types';
|
|
3
|
+
import { ConsoleLogger } from '../loggers/console';
|
|
4
|
+
import { HttpLogger } from '../loggers/http.logger';
|
|
5
|
+
interface PinoAdapterConfig {
|
|
6
|
+
source: string;
|
|
7
|
+
levelService: LevelService;
|
|
8
|
+
consoleLogger: ConsoleLogger;
|
|
9
|
+
httpLogger: HttpLogger;
|
|
10
|
+
metadata?: LoggerMetadata;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* PinoAdapter is a LoggerAdapter implementation using the pino logging library.
|
|
14
|
+
*
|
|
15
|
+
* Global metadata is stored in a static variable, so any updates via setMetadata
|
|
16
|
+
* affect all log entries across all adapter instances.
|
|
17
|
+
*/
|
|
18
|
+
export declare class PinoAdapter implements LoggerAdapter {
|
|
19
|
+
private static globalMetadata;
|
|
20
|
+
private static root;
|
|
21
|
+
private instance;
|
|
22
|
+
private httpLogger;
|
|
23
|
+
private consoleLogger;
|
|
24
|
+
private config;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new instance of PinoAdapter.
|
|
27
|
+
* @param config - The adapter configuration.
|
|
28
|
+
*/
|
|
29
|
+
constructor(config: PinoAdapterConfig);
|
|
30
|
+
/**
|
|
31
|
+
* Creates the root pino logger with custom options.
|
|
32
|
+
* @param source - The source context.
|
|
33
|
+
* @param httpLogger - The HTTP logger for production logs.
|
|
34
|
+
* @returns A root pino logger instance.
|
|
35
|
+
*/
|
|
36
|
+
private static createRootLogger;
|
|
37
|
+
/**
|
|
38
|
+
* Merges new metadata into the global metadata.
|
|
39
|
+
* @param metadata - The metadata to merge.
|
|
40
|
+
*/
|
|
41
|
+
private static mergeGlobalMetadata;
|
|
42
|
+
/**
|
|
43
|
+
* Creates a child logger with an extended source context.
|
|
44
|
+
* Any additional metadata provided is merged into the global metadata.
|
|
45
|
+
* @param source - The additional source context.
|
|
46
|
+
* @param metadata - Optional metadata to merge globally.
|
|
47
|
+
* @returns A new PinoAdapter instance representing the child logger.
|
|
48
|
+
*/
|
|
49
|
+
child(source: string, metadata?: LoggerMetadata): LoggerAdapter;
|
|
50
|
+
/**
|
|
51
|
+
* Sets the logging level for this adapter.
|
|
52
|
+
* @param level - The desired log level.
|
|
53
|
+
*/
|
|
54
|
+
setLevel(level: LogLevel): void;
|
|
55
|
+
/**
|
|
56
|
+
* Updates the global metadata. All subsequent log entries will include the updated metadata.
|
|
57
|
+
* @param metadata - The metadata to merge into the global metadata.
|
|
58
|
+
*/
|
|
59
|
+
setMetadata(metadata: LoggerMetadata): void;
|
|
60
|
+
/**
|
|
61
|
+
* Formats a log entry into a structured log payload.
|
|
62
|
+
* @param entry - The log entry to format.
|
|
63
|
+
* @returns A formatted log entry.
|
|
64
|
+
*/
|
|
65
|
+
private formatLogEntry;
|
|
66
|
+
/**
|
|
67
|
+
* Formats an individual argument and merges it into the data object.
|
|
68
|
+
* @param arg - The argument to format.
|
|
69
|
+
* @param idx - The index of the argument.
|
|
70
|
+
* @param data - The accumulator for formatted data.
|
|
71
|
+
*/
|
|
72
|
+
private formatArg;
|
|
73
|
+
/**
|
|
74
|
+
* Logs an entry at the specified level.
|
|
75
|
+
* @param level - The log level method to call.
|
|
76
|
+
* @param entry - The log entry.
|
|
77
|
+
* @throws Will throw an error if the log level method is not supported.
|
|
78
|
+
*/
|
|
79
|
+
private log;
|
|
80
|
+
trace(entry: LogEntry): void;
|
|
81
|
+
debug(entry: LogEntry): void;
|
|
82
|
+
info(entry: LogEntry): void;
|
|
83
|
+
warn(entry: LogEntry): void;
|
|
84
|
+
error(entry: LogEntry): void;
|
|
85
|
+
fatal(entry: LogEntry): void;
|
|
86
|
+
get source(): string;
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
89
|
+
//# sourceMappingURL=pino.adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pino.adapter.d.ts","sourceRoot":"","sources":["../../../../../src/lib/logger/core/adapters/pino.adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAoB,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAEL,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,cAAc,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAKpD,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED;;;;;GAKG;AACH,qBAAa,WAAY,YAAW,aAAa;IAE/C,OAAO,CAAC,MAAM,CAAC,cAAc,CAAsB;IACnD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAqC;IAExD,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,MAAM,CAAoB;IAElC;;;OAGG;gBACS,MAAM,EAAE,iBAAiB;IAyBrC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAsB/B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAIlC;;;;;;OAMG;IACI,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAE,cAAmB,GAAG,aAAa;IAU1E;;;OAGG;IACI,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAItC;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAIlD;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAyBtB;;;;;OAKG;IACH,OAAO,CAAC,SAAS;IAWjB;;;;;OAKG;IACH,OAAO,CAAC,GAAG;IAQJ,KAAK,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAI5B,KAAK,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAI5B,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAI3B,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAI3B,KAAK,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAI5B,KAAK,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAInC,IAAI,MAAM,IAAI,MAAM,CAEnB;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LogOptions, LoggerAdapter } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Implements a chainable logger that allows applying options before
|
|
4
|
+
* executing the log. The log is committed at the end of the microtask queue.
|
|
5
|
+
*/
|
|
6
|
+
export declare class LoggerChain {
|
|
7
|
+
private adapter;
|
|
8
|
+
private committed;
|
|
9
|
+
private chainOptions;
|
|
10
|
+
private method;
|
|
11
|
+
private stack;
|
|
12
|
+
private args;
|
|
13
|
+
constructor(adapter: LoggerAdapter, initialOptions?: LogOptions);
|
|
14
|
+
options(opts: LogOptions): this;
|
|
15
|
+
trace(...args: any[]): this;
|
|
16
|
+
debug(...args: any[]): this;
|
|
17
|
+
info(...args: any[]): this;
|
|
18
|
+
warn(...args: any[]): this;
|
|
19
|
+
error(...args: any[]): this;
|
|
20
|
+
fatal(...args: any[]): this;
|
|
21
|
+
private log;
|
|
22
|
+
private commit;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=logger-chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger-chain.d.ts","sourceRoot":"","sources":["../../../../src/lib/logger/core/logger-chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAY,MAAM,UAAU,CAAC;AAE/D;;;GAGG;AACH,qBAAa,WAAW;IAOV,OAAO,CAAC,OAAO;IAN3B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,YAAY,CAAkB;IACtC,OAAO,CAAC,MAAM,CAAoC;IAClD,OAAO,CAAC,KAAK,CAAM;IACnB,OAAO,CAAC,IAAI,CAAa;gBAEL,OAAO,EAAE,aAAa,EAAE,cAAc,CAAC,EAAE,UAAU;IAQhE,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAK/B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAI3B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAI3B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAI1B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAI1B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAI3B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAIlC,OAAO,CAAC,GAAG;IAOX,OAAO,CAAC,MAAM;CAgBf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/logger/core/loggers/console/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,eAAO,MAAM,MAAM,EAAE,mBA6DpB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Log } from '../../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Utility for formatted logging with support for dark and light themes.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ConsoleLogger {
|
|
6
|
+
private theme;
|
|
7
|
+
constructor();
|
|
8
|
+
/**
|
|
9
|
+
* Initializes the theme based on localStorage or browser settings.
|
|
10
|
+
* @returns 'light' or 'dark'
|
|
11
|
+
*/
|
|
12
|
+
private initializeTheme;
|
|
13
|
+
/**
|
|
14
|
+
* Detects the current console theme based on browser settings.
|
|
15
|
+
* @returns 'light' or 'dark'
|
|
16
|
+
*/
|
|
17
|
+
private detectTheme;
|
|
18
|
+
/**
|
|
19
|
+
* Sets up a listener to detect changes in the browser's theme settings.
|
|
20
|
+
*/
|
|
21
|
+
private setupThemeChangeListener;
|
|
22
|
+
/**
|
|
23
|
+
* Manually sets the theme and stores it in localStorage.
|
|
24
|
+
* @param theme - 'light' or 'dark'
|
|
25
|
+
*/
|
|
26
|
+
static setTheme(theme: 'light' | 'dark'): void;
|
|
27
|
+
/**
|
|
28
|
+
* Formats and filters the stack trace.
|
|
29
|
+
* @param stack - Raw stack trace.
|
|
30
|
+
* @returns Filtered and formatted stack trace.
|
|
31
|
+
*/
|
|
32
|
+
private formatStack;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves the appropriate style for a log level based on the theme.
|
|
35
|
+
* @param level - Log level.
|
|
36
|
+
* @returns Console style string.
|
|
37
|
+
*/
|
|
38
|
+
private getStyles;
|
|
39
|
+
/**
|
|
40
|
+
* Gets the current time formatted as HH:mm:ss.SSS.
|
|
41
|
+
* @returns Formatted time string.
|
|
42
|
+
*/
|
|
43
|
+
private getTime;
|
|
44
|
+
/**
|
|
45
|
+
* Prints a formatted log entry to the console.
|
|
46
|
+
* @param log - Log object containing level, source, message, and data.
|
|
47
|
+
*/
|
|
48
|
+
print({ level, source, msg, data }: Log, stack?: string): void;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=console.logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console.logger.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/logger/core/loggers/console/console.logger.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGxC;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAAmB;;IAOhC;;;OAGG;IACH,OAAO,CAAC,eAAe;IAQvB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAMnB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAQhC;;;OAGG;WACW,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI;IAIrD;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAOnB;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAUjB;;;OAGG;IACH,OAAO,CAAC,OAAO;IAOf;;;OAGG;IACI,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;CA4BtE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/logger/core/loggers/console/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Log } from '../../../types';
|
|
2
|
+
import { HttpLoggerConfig } from '../../types';
|
|
3
|
+
export declare class HttpLogger {
|
|
4
|
+
private config;
|
|
5
|
+
private isFlushing;
|
|
6
|
+
private retryCount;
|
|
7
|
+
private isFlushScheduled;
|
|
8
|
+
private constructor();
|
|
9
|
+
static create(config: HttpLoggerConfig): HttpLogger;
|
|
10
|
+
save(log: Log): Promise<void>;
|
|
11
|
+
private scheduleFlush;
|
|
12
|
+
private flush;
|
|
13
|
+
private processLogsBatch;
|
|
14
|
+
private getLogsBatch;
|
|
15
|
+
private splitLogsByPayloadSize;
|
|
16
|
+
private sendLogs;
|
|
17
|
+
private buildPayload;
|
|
18
|
+
private deleteLogs;
|
|
19
|
+
private logError;
|
|
20
|
+
private handleRetry;
|
|
21
|
+
private hasPendingLogs;
|
|
22
|
+
private setupUnloadListener;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=http.logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.logger.d.ts","sourceRoot":"","sources":["../../../../../src/lib/logger/core/loggers/http.logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAGrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,gBAAgB,CAAS;IAEjC,OAAO;IAKP,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU;IAiB7C,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAMnC,OAAO,CAAC,aAAa;YAWP,KAAK;YA2BL,gBAAgB;YAWhB,YAAY;IAM1B,OAAO,CAAC,sBAAsB;YAwBhB,QAAQ;IAStB,OAAO,CAAC,YAAY;YAIN,UAAU;IAKxB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,WAAW;YAYL,cAAc;IAK5B,OAAO,CAAC,mBAAmB;CAiB5B"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { LogLevel } from '../../../constants';
|
|
2
|
+
import { LevelService } from '../../types';
|
|
3
|
+
export declare const LOGLEVEL_PATTERNS_KEY: "loglevel-patterns";
|
|
4
|
+
export declare const LOGLEVEL_PREFIX: "loglevel:";
|
|
5
|
+
export declare const OVERRIDE_SUFFIX: "!";
|
|
6
|
+
export declare class LocalStorageLevelService implements LevelService {
|
|
7
|
+
private readonly projectPrefix;
|
|
8
|
+
private patternsCache;
|
|
9
|
+
/**
|
|
10
|
+
* Initializes the service with a specific project name.
|
|
11
|
+
* @param project - The project for which log levels are managed.
|
|
12
|
+
*/
|
|
13
|
+
constructor(project: string);
|
|
14
|
+
/**
|
|
15
|
+
* Retrieves the log level for a given context.
|
|
16
|
+
* Resolves the most specific match, considering override rules.
|
|
17
|
+
* @param context - The specific context to retrieve the log level for.
|
|
18
|
+
* @returns The resolved log level.
|
|
19
|
+
*/
|
|
20
|
+
getLevel(context: string): LogLevel;
|
|
21
|
+
/**
|
|
22
|
+
* Sets the log level for a specific context as an individual key.
|
|
23
|
+
* @param context - The specific context for which to set the log level.
|
|
24
|
+
* @param level - The log level to set, optionally with "!".
|
|
25
|
+
*/
|
|
26
|
+
setLevel(context: string, level: LogLevel | `${LogLevel}${typeof OVERRIDE_SUFFIX}`): void;
|
|
27
|
+
/**
|
|
28
|
+
* Loads and unifies patterns from both loglevel-patterns and individual keys.
|
|
29
|
+
* Ensures the process is done only once per app lifecycle.
|
|
30
|
+
* @returns A unified map of patterns.
|
|
31
|
+
*/
|
|
32
|
+
private loadAndUnifyPatterns;
|
|
33
|
+
/**
|
|
34
|
+
* Resolves the log level for a context using the unified patterns.
|
|
35
|
+
* Handles override logic and prioritizes more specific matches.
|
|
36
|
+
* @param context - The context to resolve the log level for.
|
|
37
|
+
* @param patterns - The unified patterns map.
|
|
38
|
+
* @returns The resolved log level, or undefined if no match is found.
|
|
39
|
+
*/
|
|
40
|
+
private resolveLogLevelFromPatterns;
|
|
41
|
+
/**
|
|
42
|
+
* Reads patterns from loglevel-patterns in localStorage.
|
|
43
|
+
* @returns The parsed patterns map.
|
|
44
|
+
*/
|
|
45
|
+
private readPatternsFromJSON;
|
|
46
|
+
/**
|
|
47
|
+
* Unifies patterns from loglevel-patterns with individual keys from localStorage.
|
|
48
|
+
* @param basePatterns - The base patterns loaded from loglevel-patterns.
|
|
49
|
+
* @returns A unified map of patterns.
|
|
50
|
+
*/
|
|
51
|
+
private unifyWithIndividualKeys;
|
|
52
|
+
/**
|
|
53
|
+
* Parses a log level string, identifying if it's an override.
|
|
54
|
+
* @param value - The value to parse (e.g., "ERROR!").
|
|
55
|
+
* @returns An object with the level and override flag.
|
|
56
|
+
*/
|
|
57
|
+
private parseLogLevel;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=local-storage-level.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-storage-level.service.d.ts","sourceRoot":"","sources":["../../../../../src/lib/logger/core/services/local-storage-level.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,eAAO,MAAM,qBAAqB,EAAG,mBAA4B,CAAC;AAClE,eAAO,MAAM,eAAe,EAAG,WAAoB,CAAC;AACpD,eAAO,MAAM,eAAe,EAAG,GAAY,CAAC;AAU5C,qBAAa,wBAAyB,YAAW,YAAY;IAC3D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,aAAa,CAA8B;IAEnD;;;OAGG;gBACS,OAAO,EAAE,MAAM;IAI3B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ;IAKnC;;;;OAIG;IACH,QAAQ,CACN,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,QAAQ,GAAG,GAAG,QAAQ,GAAG,OAAO,eAAe,EAAE,GACvD,IAAI;IAcP;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAS5B;;;;;;OAMG;IACH,OAAO,CAAC,2BAA2B;IAwBnC;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAU5B;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAuB/B;;;;OAIG;IACH,OAAO,CAAC,aAAa;CAYtB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LogLevel } from '../../constants';
|
|
2
|
+
/**
|
|
3
|
+
* Validates whether a given value is a valid LogTypes.
|
|
4
|
+
* @param value - The value to validate.
|
|
5
|
+
* @returns True if valid, false otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isValidLogType(value: unknown): value is LogLevel;
|
|
8
|
+
export declare class InvalidLogLevelError extends Error {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new instance of InvalidLogLevelError.
|
|
11
|
+
* @param level - The invalid log level.
|
|
12
|
+
*/
|
|
13
|
+
constructor(level: any);
|
|
14
|
+
}
|
|
15
|
+
export declare function getRootSource(source: string): string;
|
|
16
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/logger/core/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAIhE;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C;;;OAGG;gBACS,KAAK,EAAE,GAAG;CAIvB;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseDB } from '../dexie';
|
|
2
|
+
import { Logger } from './logger';
|
|
3
|
+
export declare function createNizzaLogger(source: string): Logger;
|
|
4
|
+
export declare function createPinoLogger(project: string, db: BaseDB): Logger;
|
|
5
|
+
export { Logger };
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAMlC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAGxD;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CASpE;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { LogLevel } from '../constants';
|
|
2
|
+
import { LoggerChain } from './core/logger-chain';
|
|
3
|
+
import { LoggerAdapter, LoggerMetadata, LogOptions } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Logger class that provides a structured, chainable, and extensible logging API.
|
|
6
|
+
*
|
|
7
|
+
* This class allows logging messages with various severity levels (`trace`, `debug`,
|
|
8
|
+
* `info`, `warn`, `error`, `fatal`) and supports setting global metadata.
|
|
9
|
+
*
|
|
10
|
+
* It follows a **chainable pattern**, allowing flexible usage such as:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* logger.info('Application started');
|
|
14
|
+
* logger.error(new Error('Critical failure')).options({ silent: true });
|
|
15
|
+
* logger.options({ silent: true }).debug('User data', user);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare class Logger {
|
|
19
|
+
private adapter;
|
|
20
|
+
/**
|
|
21
|
+
* Private constructor to enforce instantiation through `Logger.create()`.
|
|
22
|
+
*
|
|
23
|
+
* @param {LoggerAdapter} adapter - The logging adapter implementation.
|
|
24
|
+
*/
|
|
25
|
+
private constructor();
|
|
26
|
+
/**
|
|
27
|
+
* Factory Static Method to create a new Logger instance.
|
|
28
|
+
*
|
|
29
|
+
* This method accepts a logging adapter and returns a new Logger instance.
|
|
30
|
+
*
|
|
31
|
+
* @param {LoggerAdapter} adapter - The logging adapter implementation.
|
|
32
|
+
* @returns {Logger} A new Logger instance.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const logger = Logger.create(new PinoAdapter(config));
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
static create(adapter: LoggerAdapter): Logger;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a child logger with additional context.
|
|
42
|
+
*
|
|
43
|
+
* The child logger inherits the parent's configuration and metadata.
|
|
44
|
+
*
|
|
45
|
+
* @param {string} name - The context to append to the logger's source.
|
|
46
|
+
* @param {LoggerMetadata} [metadata={}] - Additional metadata for the child logger.
|
|
47
|
+
* @returns {Logger} A new child Logger instance.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const userLogger = logger.child('UserService');
|
|
52
|
+
* userLogger.info('Fetching user data');
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
child(name: string, metadata?: LoggerMetadata): Logger;
|
|
56
|
+
/**
|
|
57
|
+
* Creates a lazy child logger with delayed initialization.
|
|
58
|
+
*
|
|
59
|
+
* The lazy child logger is a proxy that initializes the child logger only when its methods are first accessed.
|
|
60
|
+
*
|
|
61
|
+
* @param {string} name - The context name for the lazy child logger.
|
|
62
|
+
* @param {LoggerMetadata} [metadata={}] - Additional metadata for the lazy child logger.
|
|
63
|
+
* @returns {Logger} A new lazy child Logger instance.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* const lazyLogger = logger.lazyChild('Deferred');
|
|
68
|
+
* lazyLogger.info('This is executed only when used');
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
lazyChild(name: string, metadata?: LoggerMetadata): Logger;
|
|
72
|
+
/**
|
|
73
|
+
* Sets or updates the metadata for the logger.
|
|
74
|
+
*
|
|
75
|
+
* The provided metadata is merged with existing global metadata and included in every log entry.
|
|
76
|
+
*
|
|
77
|
+
* @param {LoggerMetadata} metadata - The metadata to set.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* logger.setMetadata({ account: '1234', user: 'admin' });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
setMetadata(metadata: LoggerMetadata): void;
|
|
85
|
+
/**
|
|
86
|
+
* Sets the log level.
|
|
87
|
+
*
|
|
88
|
+
* @param {LogLevel} level - The new log level to be set.
|
|
89
|
+
* @throws {Error} Throws an error if the provided log level is invalid.
|
|
90
|
+
*/
|
|
91
|
+
setLevel(level: LogLevel): void;
|
|
92
|
+
/**
|
|
93
|
+
* Creates a new instance of LoggerChain for chaining log calls with optional settings.
|
|
94
|
+
*
|
|
95
|
+
* @param {LogOptions} [initialOptions] - Optional log options.
|
|
96
|
+
* @returns {LoggerChain} A new LoggerChain instance.
|
|
97
|
+
*/
|
|
98
|
+
private createChain;
|
|
99
|
+
/**
|
|
100
|
+
* Logs a **trace-level** message for deep debugging.
|
|
101
|
+
*
|
|
102
|
+
* Use this for very detailed logs that help trace the execution flow.
|
|
103
|
+
*
|
|
104
|
+
* @param {...any} args - The log message and optional additional data.
|
|
105
|
+
* @returns {LoggerChain} A chainable logger instance.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* logger.trace('Function execution trace', { function: 'fetchData' });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
trace(...args: any[]): LoggerChain;
|
|
113
|
+
/**
|
|
114
|
+
* Logs a **debug-level** message for troubleshooting.
|
|
115
|
+
*
|
|
116
|
+
* Use this for diagnostic information useful during development.
|
|
117
|
+
*
|
|
118
|
+
* @param {...any} args - The log message and optional additional data.
|
|
119
|
+
* @returns {LoggerChain} A chainable logger instance.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* logger.debug('User session data', session);
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
debug(...args: any[]): LoggerChain;
|
|
127
|
+
/**
|
|
128
|
+
* Logs an **info-level** message for general system events.
|
|
129
|
+
*
|
|
130
|
+
* Use this for regular information that tracks system operations.
|
|
131
|
+
*
|
|
132
|
+
* @param {...any} args - The log message and optional additional data.
|
|
133
|
+
* @returns {LoggerChain} A chainable logger instance.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* logger.info('User logged in', { userId: 123 });
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
info(...args: any[]): LoggerChain;
|
|
141
|
+
/**
|
|
142
|
+
* Logs a **warning-level** message to indicate potential issues.
|
|
143
|
+
*
|
|
144
|
+
* Use this when an unexpected event occurs but the application can continue operating.
|
|
145
|
+
*
|
|
146
|
+
* @param {...any} args - The log message and optional additional data.
|
|
147
|
+
* @returns {LoggerChain} A chainable logger instance.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* logger.warn('API response took too long', { duration: 5000 });
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
warn(...args: any[]): LoggerChain;
|
|
155
|
+
/**
|
|
156
|
+
* Logs an **error-level** message for recoverable failures.
|
|
157
|
+
*
|
|
158
|
+
* Use this when an error occurs that does not require immediate termination of the application.
|
|
159
|
+
*
|
|
160
|
+
* @param {...any} args - The log message and optional additional data.
|
|
161
|
+
* @returns {LoggerChain} A chainable logger instance.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* logger.error(new Error('Database connection lost'));
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
error(...args: any[]): LoggerChain;
|
|
169
|
+
/**
|
|
170
|
+
* Logs a **fatal-level** message for critical failures.
|
|
171
|
+
*
|
|
172
|
+
* Use this when an unrecoverable error occurs and the system must be terminated.
|
|
173
|
+
*
|
|
174
|
+
* @param {...any} args - The log message and optional additional data.
|
|
175
|
+
* @returns {LoggerChain} A chainable logger instance.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```ts
|
|
179
|
+
* logger.fatal('Critical system failure', { code: 'SYSTEM_CRASH' });
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
fatal(...args: any[]): LoggerChain;
|
|
183
|
+
/**
|
|
184
|
+
* Sets the log options for the current chain.
|
|
185
|
+
*
|
|
186
|
+
* This method allows modifying log behavior (e.g., silencing the console output)
|
|
187
|
+
* before calling a log method.
|
|
188
|
+
*
|
|
189
|
+
* @param {LogOptions} opts - The log options to apply.
|
|
190
|
+
* @returns {LoggerChain} A chainable logger instance.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```ts
|
|
194
|
+
* logger.options({ silent: true }).error(new Error('Silent error'));
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
options(opts: LogOptions): LoggerChain;
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/lib/logger/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEpE;;;;;;;;;;;;;GAaG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,OAAO,CAAgB;IAE/B;;;;OAIG;IACH,OAAO;IAIP;;;;;;;;;;;;OAYG;WACW,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM;IAUpD;;;;;;;;;;;;;;OAcG;IACI,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,cAAmB,GAAG,MAAM;IAIjE;;;;;;;;;;;;;;OAcG;IACI,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,cAAmB,GAAG,MAAM;IAYrE;;;;;;;;;;;OAWG;IACI,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAIlD;;;;;OAKG;IACI,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAOtC;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAInB;;;;;;;;;;;;OAYG;IACI,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,WAAW;IAIzC;;;;;;;;;;;;OAYG;IACI,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,WAAW;IAIzC;;;;;;;;;;;;OAYG;IACI,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,WAAW;IAIxC;;;;;;;;;;;;OAYG;IACI,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,WAAW;IAIxC;;;;;;;;;;;;OAYG;IACI,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,WAAW;IAIzC;;;;;;;;;;;;OAYG;IACI,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,WAAW;IAIzC;;;;;;;;;;;;;OAaG;IACI,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW;CAG9C"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { LogLevel } from '../constants';
|
|
2
|
+
import { BaseDB } from '../dexie';
|
|
3
|
+
import { Log } from '../types';
|
|
4
|
+
export interface LogOptions {
|
|
5
|
+
/** Determines whether the log entry should not be displayed in the console. */
|
|
6
|
+
silent?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface LogContent {
|
|
9
|
+
/** The main message or error to be logged. Can be of any type. */
|
|
10
|
+
message: any;
|
|
11
|
+
/** Additional arguments that may be included in the log entry. */
|
|
12
|
+
args?: any[];
|
|
13
|
+
}
|
|
14
|
+
export interface LogEntry {
|
|
15
|
+
/** The primary log content, including message and optional arguments. */
|
|
16
|
+
content: LogContent;
|
|
17
|
+
/** The stack trace of the log entry. */
|
|
18
|
+
stack: string;
|
|
19
|
+
/** Additional log options. */
|
|
20
|
+
options?: LogOptions;
|
|
21
|
+
}
|
|
22
|
+
export interface FormattedLogEntry {
|
|
23
|
+
/** The user partial log data. */
|
|
24
|
+
payload: Partial<Log>;
|
|
25
|
+
/** Additional logging options. */
|
|
26
|
+
options: LogOptions;
|
|
27
|
+
/** The stack trace of the log entry. */
|
|
28
|
+
stack: string;
|
|
29
|
+
/** Additional properties managed by the logger. */
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}
|
|
32
|
+
export interface LoggerAdapter {
|
|
33
|
+
readonly source: string;
|
|
34
|
+
trace(entry: LogEntry): void;
|
|
35
|
+
debug(entry: LogEntry): void;
|
|
36
|
+
info(entry: LogEntry): void;
|
|
37
|
+
warn(entry: LogEntry): void;
|
|
38
|
+
error(entry: LogEntry): void;
|
|
39
|
+
fatal(entry: LogEntry): void;
|
|
40
|
+
child(source: string, metadata?: LoggerMetadata): LoggerAdapter;
|
|
41
|
+
setMetadata(data: LoggerMetadata): void;
|
|
42
|
+
setLevel(level: string): void;
|
|
43
|
+
}
|
|
44
|
+
export interface LevelService {
|
|
45
|
+
getLevel(context?: string): LogLevel;
|
|
46
|
+
setLevel(context: string, level: LogLevel): void;
|
|
47
|
+
}
|
|
48
|
+
export type LoggerMetadata = Record<string, any>;
|
|
49
|
+
export interface ThemeConfig {
|
|
50
|
+
baseStyles: Record<string, string>;
|
|
51
|
+
levels: Record<number, string>;
|
|
52
|
+
messages: Record<number, string>;
|
|
53
|
+
}
|
|
54
|
+
export interface ConsoleLoggerConfig {
|
|
55
|
+
stackExclusionPatterns: RegExp;
|
|
56
|
+
themes: {
|
|
57
|
+
dark: ThemeConfig;
|
|
58
|
+
light: ThemeConfig;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Configuration options for the HttpLogger.
|
|
63
|
+
*/
|
|
64
|
+
export interface HttpLoggerConfig {
|
|
65
|
+
/**
|
|
66
|
+
* Database for run operations.
|
|
67
|
+
*/
|
|
68
|
+
db: BaseDB;
|
|
69
|
+
/**
|
|
70
|
+
* Name of the project or service generating the logs.
|
|
71
|
+
* Used to identify the source of logs in the backend.
|
|
72
|
+
*/
|
|
73
|
+
project: string;
|
|
74
|
+
/**
|
|
75
|
+
* The endpoint where logs will be sent.
|
|
76
|
+
*/
|
|
77
|
+
endpoint?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Maximum number of logs to send in a single batch.
|
|
80
|
+
* Determines the batch size for each request.
|
|
81
|
+
*/
|
|
82
|
+
batchSize?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Interval in seconds between log flushes.
|
|
85
|
+
* Controls how frequently logs are sent to the server.
|
|
86
|
+
*/
|
|
87
|
+
flushInterval?: number;
|
|
88
|
+
/**
|
|
89
|
+
* Maximum number of retry attempts for failed requests.
|
|
90
|
+
* If exceeded, logs will remain in the database for the next successful flush.
|
|
91
|
+
*/
|
|
92
|
+
maxRetries?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Exponential backoff factor for retry delays.
|
|
95
|
+
* Delay = flushInterval * (retryBackoffFactor ^ retryCount).
|
|
96
|
+
*/
|
|
97
|
+
retryBackoffFactor?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Maximum payload size in kilobytes (KB) for a single request.
|
|
100
|
+
* Helps to prevent requests that exceed server or network limits.
|
|
101
|
+
*/
|
|
102
|
+
maxPayloadSize?: number;
|
|
103
|
+
}
|
|
104
|
+
export interface LogBatch {
|
|
105
|
+
logs: Log[];
|
|
106
|
+
timestamp: number;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/logger/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/lib/mobx/hooks.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,cAAc,EACd,cAAc,EACf,MAAM,OAAO,CAAC;AAGf,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/lib/mobx/hooks.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,cAAc,EACd,cAAc,EACf,MAAM,OAAO,CAAC;AAGf,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,cAAc,EACtB,IAAI,GAAE,cAAmB,GACxB,IAAI,CAKN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACzB,OAAO,EAAE,MAAM,CAAC,EAChB,MAAM,GAAE,eAAe,CAAC,CAAC,CAAM,GAC9B,CAAC,CAcH;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,OAAO,EAAE,MAAM,CAAC,EAChB,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EAC1B,IAAI,GAAE,cAAmB,GACxB,IAAI,CAQN"}
|