@asaidimu/utils-store 10.2.12 → 10.2.13
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/index.d.cts +31 -1
- package/package.json +5 -5
package/index.d.cts
CHANGED
|
@@ -610,6 +610,19 @@ type StoreAction<T, R extends any[] = any[]> = {
|
|
|
610
610
|
* Levels are ordered by increasing severity: trace, debug, info, warn, error.
|
|
611
611
|
*/
|
|
612
612
|
type LogLevel = "trace" | "debug" | "info" | "warn" | "error";
|
|
613
|
+
/**
|
|
614
|
+
* Defines a destination where system logs are outputted or processed.
|
|
615
|
+
* Custom sinks (e.g., File, Logstash, Sentry) must implement this interface.
|
|
616
|
+
*/
|
|
617
|
+
interface LogSink {
|
|
618
|
+
/**
|
|
619
|
+
* Dispatches a structured log entry to the underlying destination.
|
|
620
|
+
*
|
|
621
|
+
* @param record - The complete log object containing metadata and payload.
|
|
622
|
+
* @returns A void or Promise that resolves when the log has been safely handed off.
|
|
623
|
+
*/
|
|
624
|
+
write(record: SystemLog): void | Promise<void>;
|
|
625
|
+
}
|
|
613
626
|
/**
|
|
614
627
|
* Structure representing a fully contextualized system log entry ready for sinking.
|
|
615
628
|
*/
|
|
@@ -626,7 +639,8 @@ interface SystemLog {
|
|
|
626
639
|
timestamp: number;
|
|
627
640
|
}
|
|
628
641
|
/**
|
|
629
|
-
* Primary logger interface providing level-specific log dispatching
|
|
642
|
+
* Primary logger interface providing level-specific log dispatching, context-chaining,
|
|
643
|
+
* and dynamic sink management.
|
|
630
644
|
*/
|
|
631
645
|
interface SystemLogger {
|
|
632
646
|
/** Logs high-volume, extremely fine-grained diagnostic details. */
|
|
@@ -653,6 +667,22 @@ interface SystemLogger {
|
|
|
653
667
|
* @param context - The metadata to append to all subsequent logs emitted by the child logger.
|
|
654
668
|
*/
|
|
655
669
|
child(context: object): SystemLogger;
|
|
670
|
+
/**
|
|
671
|
+
* Adds a new sink to this logger instance.
|
|
672
|
+
* The sink will receive all logs emitted by this logger and its descendants (unless
|
|
673
|
+
* a descendant removes it). This operation does not affect the parent logger.
|
|
674
|
+
*
|
|
675
|
+
* @param sink - The LogSink to add.
|
|
676
|
+
*/
|
|
677
|
+
addSink(sink: LogSink): void;
|
|
678
|
+
/**
|
|
679
|
+
* Removes a previously added sink from this logger instance.
|
|
680
|
+
* Returns `true` if the sink was found and removed, otherwise `false`.
|
|
681
|
+
* This operation does not affect the parent logger.
|
|
682
|
+
*
|
|
683
|
+
* @param sink - The LogSink to remove.
|
|
684
|
+
*/
|
|
685
|
+
removeSink(sink: LogSink): boolean;
|
|
656
686
|
}
|
|
657
687
|
//#endregion
|
|
658
688
|
//#region src/store/logger.d.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asaidimu/utils-store",
|
|
3
|
-
"version": "10.2.
|
|
3
|
+
"version": "10.2.13",
|
|
4
4
|
"description": "A reactive data store",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@asaidimu/utils-events": "^1.2.
|
|
33
|
-
"@asaidimu/utils-logger": "^1.0.
|
|
32
|
+
"@asaidimu/utils-events": "^1.2.7",
|
|
33
|
+
"@asaidimu/utils-logger": "^1.0.9",
|
|
34
34
|
"uuid": "^14.0.0",
|
|
35
|
-
"@asaidimu/utils-sync": "^2.3.
|
|
36
|
-
"@asaidimu/utils-persistence": "^6.1.
|
|
35
|
+
"@asaidimu/utils-sync": "^2.3.6",
|
|
36
|
+
"@asaidimu/utils-persistence": "^6.1.17"
|
|
37
37
|
},
|
|
38
38
|
"exports": {
|
|
39
39
|
".": {
|