@oino-ts/types 0.7.1 → 0.8.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/common/src/OINOLog.d.ts +56 -19
- package/package.json +1 -1
package/common/src/OINOLog.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/** Logging levels */
|
|
2
2
|
export declare enum OINOLogLevel {
|
|
3
3
|
/** Debug messages */
|
|
4
|
-
debug =
|
|
4
|
+
debug = 1,
|
|
5
5
|
/** Informational messages */
|
|
6
|
-
info =
|
|
6
|
+
info = 2,
|
|
7
7
|
/** Warning messages */
|
|
8
|
-
|
|
8
|
+
warning = 3,
|
|
9
9
|
/** Error messages */
|
|
10
|
-
error =
|
|
10
|
+
error = 4,
|
|
11
|
+
/** Exception messages */
|
|
12
|
+
exception = 5
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* Abstract base class for logging implementations supporting
|
|
@@ -17,11 +19,11 @@ export declare enum OINOLogLevel {
|
|
|
17
19
|
*/
|
|
18
20
|
export declare abstract class OINOLog {
|
|
19
21
|
protected static _instance: OINOLog;
|
|
20
|
-
protected
|
|
22
|
+
protected _logLevels: Record<string, OINOLogLevel>;
|
|
21
23
|
/**
|
|
22
24
|
* Abstract logging method to implement the actual logging operation.
|
|
23
25
|
*
|
|
24
|
-
* @param logLevel
|
|
26
|
+
* @param logLevel default loglevel for all log events
|
|
25
27
|
*
|
|
26
28
|
*/
|
|
27
29
|
constructor(logLevel?: OINOLogLevel);
|
|
@@ -29,11 +31,14 @@ export declare abstract class OINOLog {
|
|
|
29
31
|
* Abstract logging method to implement the actual logging operation.
|
|
30
32
|
*
|
|
31
33
|
* @param levelStr level string of the log event
|
|
34
|
+
* @param domain domain of the log event
|
|
35
|
+
* @param channel channel of the log event
|
|
36
|
+
* @param method method of the log event
|
|
32
37
|
* @param message message of the log event
|
|
33
38
|
* @param data structured data associated with the log event
|
|
34
39
|
*
|
|
35
40
|
*/
|
|
36
|
-
protected abstract _writeLog(levelStr: string, message: string, data?: any): void;
|
|
41
|
+
protected abstract _writeLog(levelStr: string, domain: string, channel: string, method: string, message: string, data?: any): void;
|
|
37
42
|
/**
|
|
38
43
|
* Abstract logging method to implement the actual logging operation.
|
|
39
44
|
*
|
|
@@ -43,7 +48,7 @@ export declare abstract class OINOLog {
|
|
|
43
48
|
* @param data structured data associated with the log event
|
|
44
49
|
*
|
|
45
50
|
*/
|
|
46
|
-
protected static _log(level: OINOLogLevel, levelStr: string, message: string, data?: any): void;
|
|
51
|
+
protected static _log(level: OINOLogLevel, levelStr: string, domain: string, channel: string, method: string, message: string, data?: any): void;
|
|
47
52
|
/**
|
|
48
53
|
* Set active logger and log level.
|
|
49
54
|
*
|
|
@@ -52,44 +57,76 @@ export declare abstract class OINOLog {
|
|
|
52
57
|
*/
|
|
53
58
|
static setLogger(logger: OINOLog): void;
|
|
54
59
|
/**
|
|
55
|
-
* Set log level.
|
|
60
|
+
* Set log level for given combination of domain/channel/method. Not defining dimension(s) means they match any value.
|
|
61
|
+
* Multiple settings can be combined to set different logging accuracy specifically
|
|
62
|
+
*
|
|
63
|
+
* For example:
|
|
64
|
+
* logLevel: warning, domain: *, channel: *, method: * will only output error events.
|
|
65
|
+
* logLevel: debug, domain: d1, channel: c1, method: "*" will enable debug events for channel c1 of domain d1.
|
|
66
|
+
* logLevel: info, domain: d1, channel: c1, method: m1 will supress debug events for method m1.
|
|
56
67
|
*
|
|
57
68
|
* @param logLevel log level to use
|
|
69
|
+
* @param domain domain of the log event (default: "*" for all)
|
|
70
|
+
* @param channel channel of the log event (default: "*" for all)
|
|
71
|
+
* @param method method of the log event (default: "*" for all)
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
74
|
+
static setLogLevel(logLevel: OINOLogLevel, domain?: string, channel?: string, method?: string): void;
|
|
75
|
+
/**
|
|
76
|
+
* Log exception event. Exception events are prettyprinted and preserve newlines so that stack traces are readable.
|
|
77
|
+
*
|
|
78
|
+
* @param domain domain of the log event
|
|
79
|
+
* @param channel channel of the log event
|
|
80
|
+
* @param method method of the log event
|
|
81
|
+
* @param message message of the log event
|
|
82
|
+
* @param data structured data associated with the log event
|
|
58
83
|
*
|
|
59
84
|
*/
|
|
60
|
-
static
|
|
85
|
+
static exception(domain: string, channel: string, method: string, message: string, data?: any): void;
|
|
61
86
|
/**
|
|
62
|
-
* Log error event.
|
|
87
|
+
* Log error event. Error events are printed as a single line.
|
|
63
88
|
*
|
|
89
|
+
* @param domain domain of the log event
|
|
90
|
+
* @param channel channel of the log event
|
|
91
|
+
* @param method method of the log event
|
|
64
92
|
* @param message message of the log event
|
|
65
93
|
* @param data structured data associated with the log event
|
|
66
94
|
*
|
|
67
95
|
*/
|
|
68
|
-
static error(message: string, data?: any): void;
|
|
96
|
+
static error(domain: string, channel: string, method: string, message: string, data?: any): void;
|
|
69
97
|
/**
|
|
70
|
-
* Log warning event.
|
|
98
|
+
* Log warning event. Warning events are printed as a single line.
|
|
71
99
|
*
|
|
100
|
+
* @param domain domain of the log event
|
|
101
|
+
* @param channel channel of the log event
|
|
102
|
+
* @param method method of the log event
|
|
72
103
|
* @param message message of the log event
|
|
73
104
|
* @param data structured data associated with the log event
|
|
74
105
|
*
|
|
75
106
|
*/
|
|
76
|
-
static warning(message: string, data?: any): void;
|
|
107
|
+
static warning(domain: string, channel: string, method: string, message: string, data?: any): void;
|
|
77
108
|
/**
|
|
78
|
-
* Log info event.
|
|
109
|
+
* Log info event. Info events are printed as a single line.
|
|
79
110
|
*
|
|
111
|
+
* @param domain domain of the log event
|
|
112
|
+
* @param channel channel of the log event
|
|
113
|
+
* @param method method of the log event
|
|
80
114
|
* @param message message of the log event
|
|
81
115
|
* @param data structured data associated with the log event
|
|
82
116
|
*
|
|
83
117
|
*/
|
|
84
|
-
static info(message: string, data?: any): void;
|
|
118
|
+
static info(domain: string, channel: string, method: string, message: string, data?: any): void;
|
|
85
119
|
/**
|
|
86
|
-
* Log debug event.
|
|
120
|
+
* Log debug event. Debug events are prettyprinted.
|
|
87
121
|
*
|
|
122
|
+
* @param domain domain of the log event
|
|
123
|
+
* @param channel channel of the log event
|
|
124
|
+
* @param method method of the log event
|
|
88
125
|
* @param message message of the log event
|
|
89
126
|
* @param data structured data associated with the log event
|
|
90
127
|
*
|
|
91
128
|
*/
|
|
92
|
-
static debug(message: string, data?: any): void;
|
|
129
|
+
static debug(domain: string, channel: string, method: string, message: string, data?: any): void;
|
|
93
130
|
}
|
|
94
131
|
/**
|
|
95
132
|
* Logging implementation based on console.log.
|
|
@@ -101,5 +138,5 @@ export declare class OINOConsoleLog extends OINOLog {
|
|
|
101
138
|
* @param logLevel logging level
|
|
102
139
|
*/
|
|
103
140
|
constructor(logLevel?: OINOLogLevel);
|
|
104
|
-
protected _writeLog(level: string, message: string, data?: any): void;
|
|
141
|
+
protected _writeLog(level: string, domain: string, channel: string, method: string, message: string, data?: any): void;
|
|
105
142
|
}
|