@darksheep/logger 1.0.4 → 1.0.6
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/CHANGELOG.md +16 -0
- package/package.json +4 -4
- package/types/logger.d.ts +0 -12
- package/types/replacer.d.ts +0 -12
- package/types/replacers/error.d.ts +0 -9
- package/types/utilities/colour.d.ts +0 -18
- package/types/utilities/log-types.d.ts +0 -42
- package/types/utilities/stacktrace.d.ts +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.6](https://github.com/DarkSheepSoftware/node-packages/compare/logger-v1.0.5...logger-v1.0.6) (2024-09-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### 📦 Dependencies
|
|
7
|
+
|
|
8
|
+
* **pkg:** update dependency traverse to v0.6.10 ([#369](https://github.com/DarkSheepSoftware/node-packages/issues/369)) ([ba540ec](https://github.com/DarkSheepSoftware/node-packages/commit/ba540ecb9e5e7b2fd372cf310382c13f1a05c7db))
|
|
9
|
+
|
|
10
|
+
## [1.0.5](https://github.com/DarkSheepSoftware/node-packages/compare/logger-v1.0.4...logger-v1.0.5) (2024-09-03)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Dependencies
|
|
14
|
+
|
|
15
|
+
* The following workspace dependencies were updated
|
|
16
|
+
* dependencies
|
|
17
|
+
* @darksheep/environment bumped from 3.0.7 to 3.0.8
|
|
18
|
+
|
|
3
19
|
## [1.0.4](https://github.com/DarkSheepSoftware/node-packages/compare/logger-v1.0.3...logger-v1.0.4) (2024-08-28)
|
|
4
20
|
|
|
5
21
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darksheep/logger",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Logging your stuff to where ever you want it",
|
|
5
5
|
"license": "UNLICENCED",
|
|
6
6
|
"type": "module",
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"test:watch": "node --watch --test src/**/*.test.js"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@darksheep/environment": "3.0.
|
|
25
|
+
"@darksheep/environment": "3.0.8",
|
|
26
26
|
"deepmerge-ts": "7.1.0",
|
|
27
27
|
"stacktrace-parser": "0.1.10",
|
|
28
|
-
"traverse": "0.6.
|
|
28
|
+
"traverse": "0.6.10"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "~20.16.0",
|
|
32
32
|
"@types/traverse": "~0.6.33",
|
|
33
33
|
"nock": "~13.5.0",
|
|
34
|
-
"typescript": "~5.
|
|
34
|
+
"typescript": "~5.6.0",
|
|
35
35
|
"zod": "~3.23.0"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
package/types/logger.d.ts
CHANGED
|
@@ -150,30 +150,18 @@ export class Logger {
|
|
|
150
150
|
#private;
|
|
151
151
|
}
|
|
152
152
|
export type Options = {
|
|
153
|
-
/**
|
|
154
|
-
* The replacer function to use
|
|
155
|
-
*/
|
|
156
153
|
/**
|
|
157
154
|
* The replacer function to use
|
|
158
155
|
*/
|
|
159
156
|
replace?: typeof replace | undefined;
|
|
160
|
-
/**
|
|
161
|
-
* The replacers to use in the replacer
|
|
162
|
-
*/
|
|
163
157
|
/**
|
|
164
158
|
* The replacers to use in the replacer
|
|
165
159
|
*/
|
|
166
160
|
replacers?: import("./replacer.js").Replacer<any, any>[] | undefined;
|
|
167
|
-
/**
|
|
168
|
-
* The formatter function to use (eg console or json formatter)
|
|
169
|
-
*/
|
|
170
161
|
/**
|
|
171
162
|
* The formatter function to use (eg console or json formatter)
|
|
172
163
|
*/
|
|
173
164
|
format?: import("./formatter.js").Formatter | undefined;
|
|
174
|
-
/**
|
|
175
|
-
* The place to write the log to
|
|
176
|
-
*/
|
|
177
165
|
/**
|
|
178
166
|
* The place to write the log to
|
|
179
167
|
*/
|
package/types/replacer.d.ts
CHANGED
|
@@ -14,30 +14,18 @@
|
|
|
14
14
|
*/
|
|
15
15
|
export function replace(object: unknown, replacers?: Replacer[]): unknown;
|
|
16
16
|
export type Replacer<T = unknown, O = unknown> = {
|
|
17
|
-
/**
|
|
18
|
-
* The name of the replacer
|
|
19
|
-
*/
|
|
20
17
|
/**
|
|
21
18
|
* The name of the replacer
|
|
22
19
|
*/
|
|
23
20
|
name: string;
|
|
24
|
-
/**
|
|
25
|
-
* Check to see if input can be replaced
|
|
26
|
-
*/
|
|
27
21
|
/**
|
|
28
22
|
* Check to see if input can be replaced
|
|
29
23
|
*/
|
|
30
24
|
shouldReplace: (input: unknown, path?: string[]) => boolean;
|
|
31
|
-
/**
|
|
32
|
-
* The replace function if shouldReplace returns true
|
|
33
|
-
*/
|
|
34
25
|
/**
|
|
35
26
|
* The replace function if shouldReplace returns true
|
|
36
27
|
*/
|
|
37
28
|
replace: (input: T, path?: string[]) => O;
|
|
38
|
-
/**
|
|
39
|
-
* Should the traverse stop here
|
|
40
|
-
*/
|
|
41
29
|
/**
|
|
42
30
|
* Should the traverse stop here
|
|
43
31
|
*/
|
|
@@ -10,23 +10,14 @@
|
|
|
10
10
|
/** @type {import('../replacer.js').Replacer<Error, NormalisedError>} */
|
|
11
11
|
export const ErrorReplacer: import("../replacer.js").Replacer<Error, NormalisedError>;
|
|
12
12
|
export type BaseError = {
|
|
13
|
-
/**
|
|
14
|
-
* The error type or name
|
|
15
|
-
*/
|
|
16
13
|
/**
|
|
17
14
|
* The error type or name
|
|
18
15
|
*/
|
|
19
16
|
type: string;
|
|
20
|
-
/**
|
|
21
|
-
* The error message
|
|
22
|
-
*/
|
|
23
17
|
/**
|
|
24
18
|
* The error message
|
|
25
19
|
*/
|
|
26
20
|
message: string;
|
|
27
|
-
/**
|
|
28
|
-
* The stacktrace of the error
|
|
29
|
-
*/
|
|
30
21
|
/**
|
|
31
22
|
* The stacktrace of the error
|
|
32
23
|
*/
|
|
@@ -14,44 +14,26 @@ export type ColourNames = keyof typeof colours;
|
|
|
14
14
|
export type ColourMode = "bright" | "dim";
|
|
15
15
|
export type ColourEffects = keyof typeof effects;
|
|
16
16
|
export type ColourOptions = {
|
|
17
|
-
/**
|
|
18
|
-
* The foreground colour name
|
|
19
|
-
*/
|
|
20
17
|
/**
|
|
21
18
|
* The foreground colour name
|
|
22
19
|
*/
|
|
23
20
|
foreground?: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* The foreground colour mode
|
|
26
|
-
*/
|
|
27
21
|
/**
|
|
28
22
|
* The foreground colour mode
|
|
29
23
|
*/
|
|
30
24
|
foregroundMode?: ColourMode | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* The background colour name
|
|
33
|
-
*/
|
|
34
25
|
/**
|
|
35
26
|
* The background colour name
|
|
36
27
|
*/
|
|
37
28
|
background?: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* The background colour mode
|
|
40
|
-
*/
|
|
41
29
|
/**
|
|
42
30
|
* The background colour mode
|
|
43
31
|
*/
|
|
44
32
|
backgroundMode?: ColourMode | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* The string effents
|
|
47
|
-
*/
|
|
48
33
|
/**
|
|
49
34
|
* The string effents
|
|
50
35
|
*/
|
|
51
36
|
effects?: ("bold" | "faint" | "italic" | "underline")[] | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* How to handle the string termination
|
|
54
|
-
*/
|
|
55
37
|
/**
|
|
56
38
|
* How to handle the string termination
|
|
57
39
|
*/
|
|
@@ -1,49 +1,28 @@
|
|
|
1
1
|
export type LogLevels = {
|
|
2
|
-
/**
|
|
3
|
-
* A crucial part of the application is not working
|
|
4
|
-
*/
|
|
5
2
|
/**
|
|
6
3
|
* A crucial part of the application is not working
|
|
7
4
|
*/
|
|
8
5
|
critical: 0;
|
|
9
|
-
/**
|
|
10
|
-
* A non critical operation fails
|
|
11
|
-
*/
|
|
12
6
|
/**
|
|
13
7
|
* A non critical operation fails
|
|
14
8
|
*/
|
|
15
9
|
error: 1;
|
|
16
|
-
/**
|
|
17
|
-
* An operation might fail in the future
|
|
18
|
-
*/
|
|
19
10
|
/**
|
|
20
11
|
* An operation might fail in the future
|
|
21
12
|
*/
|
|
22
13
|
warning: 2;
|
|
23
|
-
/**
|
|
24
|
-
* Information about events that may be unusual
|
|
25
|
-
*/
|
|
26
14
|
/**
|
|
27
15
|
* Information about events that may be unusual
|
|
28
16
|
*/
|
|
29
17
|
notice: 3;
|
|
30
|
-
/**
|
|
31
|
-
* Information about successful operations
|
|
32
|
-
*/
|
|
33
18
|
/**
|
|
34
19
|
* Information about successful operations
|
|
35
20
|
*/
|
|
36
21
|
info: 4;
|
|
37
|
-
/**
|
|
38
|
-
* Information that is unlikely to help in production
|
|
39
|
-
*/
|
|
40
22
|
/**
|
|
41
23
|
* Information that is unlikely to help in production
|
|
42
24
|
*/
|
|
43
25
|
debug: 5;
|
|
44
|
-
/**
|
|
45
|
-
* Information to help resolve complex logic issues
|
|
46
|
-
*/
|
|
47
26
|
/**
|
|
48
27
|
* Information to help resolve complex logic issues
|
|
49
28
|
*/
|
|
@@ -69,51 +48,30 @@ export type LogLevel = LogLevels[LogLevelNames];
|
|
|
69
48
|
export type Callsite = import("./stacktrace.js").Callsite;
|
|
70
49
|
export type NormalisedError = import("../replacers/error.js").NormalisedError;
|
|
71
50
|
export type LogInternal = {
|
|
72
|
-
/**
|
|
73
|
-
* A timestamp for the log message
|
|
74
|
-
*/
|
|
75
51
|
/**
|
|
76
52
|
* A timestamp for the log message
|
|
77
53
|
*/
|
|
78
54
|
timestamp?: Date | undefined;
|
|
79
|
-
/**
|
|
80
|
-
* A channel to bind to the log
|
|
81
|
-
*/
|
|
82
55
|
/**
|
|
83
56
|
* A channel to bind to the log
|
|
84
57
|
*/
|
|
85
58
|
channel?: string | undefined;
|
|
86
|
-
/**
|
|
87
|
-
* The log level
|
|
88
|
-
*/
|
|
89
59
|
/**
|
|
90
60
|
* The log level
|
|
91
61
|
*/
|
|
92
62
|
level?: LogLevel | undefined;
|
|
93
|
-
/**
|
|
94
|
-
* A message to use
|
|
95
|
-
*/
|
|
96
63
|
/**
|
|
97
64
|
* A message to use
|
|
98
65
|
*/
|
|
99
66
|
message?: string | undefined;
|
|
100
|
-
/**
|
|
101
|
-
* The stack trace bound to the log
|
|
102
|
-
*/
|
|
103
67
|
/**
|
|
104
68
|
* The stack trace bound to the log
|
|
105
69
|
*/
|
|
106
70
|
stack?: string | import("./stacktrace.js").Callsite[] | undefined;
|
|
107
|
-
/**
|
|
108
|
-
* A child error for the core error
|
|
109
|
-
*/
|
|
110
71
|
/**
|
|
111
72
|
* A child error for the core error
|
|
112
73
|
*/
|
|
113
74
|
cause?: Error | import("../replacers/error.js").NormalisedError | undefined;
|
|
114
|
-
/**
|
|
115
|
-
* The trail id bound to the callsite
|
|
116
|
-
*/
|
|
117
75
|
/**
|
|
118
76
|
* The trail id bound to the callsite
|
|
119
77
|
*/
|
|
@@ -14,44 +14,26 @@
|
|
|
14
14
|
*/
|
|
15
15
|
export function parseStack(stack?: string | undefined): Callsite[];
|
|
16
16
|
export type Callsite = {
|
|
17
|
-
/**
|
|
18
|
-
* The file name for the callsite
|
|
19
|
-
*/
|
|
20
17
|
/**
|
|
21
18
|
* The file name for the callsite
|
|
22
19
|
*/
|
|
23
20
|
file: string;
|
|
24
|
-
/**
|
|
25
|
-
* The relative path for the callsite.file
|
|
26
|
-
*/
|
|
27
21
|
/**
|
|
28
22
|
* The relative path for the callsite.file
|
|
29
23
|
*/
|
|
30
24
|
relativePath?: string | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* The absolute path for the callsite.file
|
|
33
|
-
*/
|
|
34
25
|
/**
|
|
35
26
|
* The absolute path for the callsite.file
|
|
36
27
|
*/
|
|
37
28
|
absolutePath?: string | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* The methodName from the callsite
|
|
40
|
-
*/
|
|
41
29
|
/**
|
|
42
30
|
* The methodName from the callsite
|
|
43
31
|
*/
|
|
44
32
|
methodName: string;
|
|
45
|
-
/**
|
|
46
|
-
* The line number in the file
|
|
47
|
-
*/
|
|
48
33
|
/**
|
|
49
34
|
* The line number in the file
|
|
50
35
|
*/
|
|
51
36
|
line: number;
|
|
52
|
-
/**
|
|
53
|
-
* The column number in the file
|
|
54
|
-
*/
|
|
55
37
|
/**
|
|
56
38
|
* The column number in the file
|
|
57
39
|
*/
|