@thi.ng/rstream-log 4.1.101 → 5.0.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/CHANGELOG.md +12 -1
- package/README.md +2 -3
- package/api.d.ts +1 -10
- package/logger.d.ts +10 -17
- package/logger.js +20 -47
- package/package.json +5 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-02-
|
|
3
|
+
- **Last updated**: 2024-02-16T20:01:44Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,17 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
# [5.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/rstream-log@5.0.0) (2024-02-16)
|
|
13
|
+
|
|
14
|
+
#### 🛑 Breaking changes
|
|
15
|
+
|
|
16
|
+
- update Logger impl, remove obsolete types ([36c8649](https://github.com/thi-ng/umbrella/commit/36c8649))
|
|
17
|
+
- BREAKING CHANGE: update Logger, remove obsolete types
|
|
18
|
+
- Logger now a subclass of `ALogger` & implementing `ISubscriber` interface
|
|
19
|
+
- instead of extending rstream `StreamMerge`, now exposes a `Stream` via `.stream`
|
|
20
|
+
- adding child loggers now handled via `ILogger.childLogger()` or `ILogger.addChild()`
|
|
21
|
+
- update tests
|
|
22
|
+
|
|
12
23
|
### [4.1.84](https://github.com/thi-ng/umbrella/tree/@thi.ng/rstream-log@4.1.84) (2023-11-24)
|
|
13
24
|
|
|
14
25
|
#### 🩹 Bug fixes
|
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ filtering.
|
|
|
61
61
|
|
|
62
62
|
## Related packages
|
|
63
63
|
|
|
64
|
-
- [@thi.ng/logger](https://github.com/thi-ng/umbrella/tree/develop/packages/logger) -
|
|
64
|
+
- [@thi.ng/logger](https://github.com/thi-ng/umbrella/tree/develop/packages/logger) - Basis types for arbitrary & hierarchical logging
|
|
65
65
|
|
|
66
66
|
## Installation
|
|
67
67
|
|
|
@@ -83,13 +83,12 @@ For Node.js REPL:
|
|
|
83
83
|
const rstreamLog = await import("@thi.ng/rstream-log");
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
Package sizes (brotli'd, pre-treeshake): ESM:
|
|
86
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 707 bytes
|
|
87
87
|
|
|
88
88
|
## Dependencies
|
|
89
89
|
|
|
90
90
|
- [@thi.ng/api](https://github.com/thi-ng/umbrella/tree/develop/packages/api)
|
|
91
91
|
- [@thi.ng/checks](https://github.com/thi-ng/umbrella/tree/develop/packages/checks)
|
|
92
|
-
- [@thi.ng/errors](https://github.com/thi-ng/umbrella/tree/develop/packages/errors)
|
|
93
92
|
- [@thi.ng/logger](https://github.com/thi-ng/umbrella/tree/develop/packages/logger)
|
|
94
93
|
- [@thi.ng/rstream](https://github.com/thi-ng/umbrella/tree/develop/packages/rstream)
|
|
95
94
|
- [@thi.ng/strings](https://github.com/thi-ng/umbrella/tree/develop/packages/strings)
|
package/api.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import type { IID } from "@thi.ng/api";
|
|
2
|
-
import type { ILogger as APILogger, LogLevel } from "@thi.ng/logger";
|
|
2
|
+
import type { ILogger as APILogger, LogEntry, LogLevel } from "@thi.ng/logger";
|
|
3
3
|
import type { ISubscribable } from "@thi.ng/rstream";
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated moved to thi.ng/logger package
|
|
6
|
-
*/
|
|
7
|
-
export interface LogEntry extends Array<any> {
|
|
8
|
-
[0]: LogLevel;
|
|
9
|
-
[1]: string;
|
|
10
|
-
[2]: number;
|
|
11
|
-
[id: number]: any;
|
|
12
|
-
}
|
|
13
4
|
export interface LogEntryObj extends IID<string> {
|
|
14
5
|
level: LogLevel;
|
|
15
6
|
time: number;
|
package/logger.d.ts
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
constructor();
|
|
8
|
-
constructor(id: string);
|
|
9
|
-
constructor(id: string, level: LogLevel);
|
|
10
|
-
constructor(id: string, sources: Iterable<ISubscribable<LogEntry>>, level?: LogLevel);
|
|
11
|
-
enabled(level: LogLevel): boolean;
|
|
1
|
+
import { ALogger } from "@thi.ng/logger/alogger";
|
|
2
|
+
import { LogLevel, type ILogger, type LogEntry } from "@thi.ng/logger/api";
|
|
3
|
+
import { Stream, type ISubscriber } from "@thi.ng/rstream";
|
|
4
|
+
export declare class Logger extends ALogger implements ISubscriber<LogEntry> {
|
|
5
|
+
stream: Stream<LogEntry>;
|
|
6
|
+
constructor(id: string, level?: LogLevel, parent?: ILogger);
|
|
12
7
|
next(x: LogEntry): void;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
severe(...args: any[]): void;
|
|
18
|
-
protected log(level: LogLevel, args: any[]): void;
|
|
8
|
+
done(): void;
|
|
9
|
+
error(e: Error): boolean;
|
|
10
|
+
logEntry(e: LogEntry): void;
|
|
11
|
+
childLogger(id: string, level?: LogLevel): ILogger;
|
|
19
12
|
}
|
|
20
13
|
//# sourceMappingURL=logger.d.ts.map
|
package/logger.js
CHANGED
|
@@ -1,57 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ALogger } from "@thi.ng/logger/alogger";
|
|
2
2
|
import { LogLevel } from "@thi.ng/logger/api";
|
|
3
|
-
import { CloseMode } from "@thi.ng/rstream
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
switch (args.length) {
|
|
13
|
-
case 0:
|
|
14
|
-
break;
|
|
15
|
-
case 1:
|
|
16
|
-
id = args[0];
|
|
17
|
-
break;
|
|
18
|
-
case 2:
|
|
19
|
-
[id, level] = args;
|
|
20
|
-
break;
|
|
21
|
-
case 3:
|
|
22
|
-
[id, src, level] = args;
|
|
23
|
-
src = [...src];
|
|
24
|
-
break;
|
|
25
|
-
default:
|
|
26
|
-
illegalArity(args.length);
|
|
27
|
-
}
|
|
28
|
-
id = id || `logger-${__nextID()}`;
|
|
29
|
-
super({ src, id, closeIn: CloseMode.NEVER, closeOut: CloseMode.NEVER });
|
|
30
|
-
this.level = level;
|
|
31
|
-
}
|
|
32
|
-
enabled(level) {
|
|
33
|
-
return this.level <= level;
|
|
3
|
+
import { Stream, CloseMode } from "@thi.ng/rstream";
|
|
4
|
+
class Logger extends ALogger {
|
|
5
|
+
stream;
|
|
6
|
+
constructor(id, level, parent) {
|
|
7
|
+
super(id, level, parent);
|
|
8
|
+
this.stream = new Stream({
|
|
9
|
+
id: this.id,
|
|
10
|
+
closeOut: CloseMode.NEVER
|
|
11
|
+
});
|
|
34
12
|
}
|
|
35
13
|
next(x) {
|
|
36
|
-
x[0] >= this.level &&
|
|
37
|
-
}
|
|
38
|
-
fine(...args) {
|
|
39
|
-
this.log(LogLevel.FINE, args);
|
|
40
|
-
}
|
|
41
|
-
debug(...args) {
|
|
42
|
-
this.log(LogLevel.DEBUG, args);
|
|
14
|
+
x[0] >= this.level && this.stream.next(x);
|
|
43
15
|
}
|
|
44
|
-
|
|
45
|
-
this.
|
|
16
|
+
done() {
|
|
17
|
+
this.stream.done();
|
|
46
18
|
}
|
|
47
|
-
|
|
48
|
-
this.
|
|
19
|
+
error(e) {
|
|
20
|
+
return this.stream.error(e);
|
|
49
21
|
}
|
|
50
|
-
|
|
51
|
-
this.
|
|
22
|
+
logEntry(e) {
|
|
23
|
+
if (this.level <= e[0])
|
|
24
|
+
this.stream.next(e);
|
|
52
25
|
}
|
|
53
|
-
|
|
54
|
-
|
|
26
|
+
childLogger(id, level) {
|
|
27
|
+
return new Logger(id, level ?? this.level, this.parent);
|
|
55
28
|
}
|
|
56
29
|
}
|
|
57
30
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rstream-log",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Structured, multilevel & hierarchical loggers based on @thi.ng/rstream",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -37,11 +37,10 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@thi.ng/api": "^8.9.23",
|
|
39
39
|
"@thi.ng/checks": "^3.4.23",
|
|
40
|
-
"@thi.ng/
|
|
41
|
-
"@thi.ng/
|
|
42
|
-
"@thi.ng/rstream": "^8.3.2",
|
|
40
|
+
"@thi.ng/logger": "^3.0.0",
|
|
41
|
+
"@thi.ng/rstream": "^8.3.3",
|
|
43
42
|
"@thi.ng/strings": "^3.7.14",
|
|
44
|
-
"@thi.ng/transducers": "^8.9.
|
|
43
|
+
"@thi.ng/transducers": "^8.9.2"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
47
46
|
"@microsoft/api-extractor": "^7.40.1",
|
|
@@ -98,5 +97,5 @@
|
|
|
98
97
|
],
|
|
99
98
|
"year": 2017
|
|
100
99
|
},
|
|
101
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "25ee18f7db6d03f0b76787267ab071d16df94888\n"
|
|
102
101
|
}
|