@rsdk/logging 2.4.0 → 2.4.1-next.2
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 +8 -0
- package/dist/logger.factory.js +5 -5
- package/dist/logger.factory.js.map +1 -1
- package/package.json +3 -3
- package/src/logger.factory.ts +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.4.1-next.2](https://github.com/R-Vision/rsdk/compare/v2.4.1-next.1...v2.4.1-next.2) (2023-06-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @rsdk/logging
|
|
9
|
+
|
|
10
|
+
## [2.4.1-next.0](https://github.com/R-Vision/rsdk/compare/v2.4.0...v2.4.1-next.0) (2023-06-15)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @rsdk/logging
|
|
13
|
+
|
|
6
14
|
# [2.4.0](https://github.com/R-Vision/rsdk/compare/v2.3.1...v2.4.0) (2023-06-15)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @rsdk/logging
|
package/dist/logger.factory.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.LoggerFactory = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_events_1 = __importDefault(require("node:events"));
|
|
8
8
|
const pino_1 = __importDefault(require("pino"));
|
|
9
9
|
const defaults_1 = require("./defaults");
|
|
10
10
|
const implementations_1 = require("./implementations");
|
|
@@ -25,9 +25,10 @@ class LoggerFactory {
|
|
|
25
25
|
static _globalPino = (0, pino_1.default)({
|
|
26
26
|
level: defaults_1.DEFAULT_LEVEL,
|
|
27
27
|
});
|
|
28
|
-
|
|
28
|
+
// eslint-disable-next-line unicorn/prefer-event-target
|
|
29
|
+
static events = new node_events_1.default();
|
|
29
30
|
static reconfigure({ level, redact }, stream) {
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires,unicorn/prefer-module
|
|
31
32
|
this._globalPino = require('pino')({
|
|
32
33
|
level: level ?? defaults_1.DEFAULT_LEVEL,
|
|
33
34
|
...(redact && { redact }),
|
|
@@ -37,8 +38,7 @@ class LoggerFactory {
|
|
|
37
38
|
this.events.on('msg', handler);
|
|
38
39
|
}
|
|
39
40
|
static create(context) {
|
|
40
|
-
|
|
41
|
-
return new implementations_1.PinoLogger(() => this._globalPino, trigger, context);
|
|
41
|
+
return new implementations_1.PinoLogger(() => this._globalPino, (level, data) => this.events.emit('msg', level, data), context);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
exports.LoggerFactory = LoggerFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.factory.js","sourceRoot":"","sources":["../src/logger.factory.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"logger.factory.js","sourceRoot":"","sources":["../src/logger.factory.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAuC;AAEvC,gDAAwB;AAExB,yCAA2C;AAC3C,uDAA+C;AAS/C;;;GAGG;AACH,MAAa,aAAa;IACxB;;;;;;;;OAQG;IACK,MAAM,CAAC,WAAW,GAAS,IAAA,cAAI,EAAC;QACtC,KAAK,EAAE,wBAAa;KACrB,CAAC,CAAC;IAEH,uDAAuD;IAC/C,MAAM,CAAC,MAAM,GAAG,IAAI,qBAAY,EAAE,CAAC;IAE3C,MAAM,CAAC,WAAW,CAChB,EAAE,KAAK,EAAE,MAAM,EAAiB,EAChC,MAA0B;QAE1B,oFAAoF;QACpF,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAChC;YACE,KAAK,EAAE,KAAK,IAAI,wBAAa;YAC7B,GAAG,CAAC,MAAM,IAAI,EAAE,MAAM,EAAE,CAAC;SAC1B,EACD,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,OAAkB;QACjC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,OAAuB;QACnC,OAAO,IAAI,4BAAU,CACnB,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EACtB,CAAC,KAAe,EAAE,IAAa,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,EACxE,OAAO,CACR,CAAC;IACJ,CAAC;;AAzCU,sCAAa"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/logging",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.1-next.2",
|
|
4
4
|
"description": "Base framework independent logging functionality",
|
|
5
5
|
"license": "Apache License 2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"pino": "^8.10.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@rsdk/common": "^2.4.
|
|
17
|
+
"@rsdk/common": "^2.4.1-next.2"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "f21a068dec8a1542cce73139c7a77dedbdd596d5"
|
|
20
20
|
}
|
package/src/logger.factory.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import EventEmitter from 'events';
|
|
2
|
-
|
|
1
|
+
import EventEmitter from 'node:events';
|
|
3
2
|
import type { DestinationStream, Logger as Pino } from 'pino';
|
|
4
3
|
import pino from 'pino';
|
|
5
4
|
|
|
@@ -31,13 +30,14 @@ export class LoggerFactory {
|
|
|
31
30
|
level: DEFAULT_LEVEL,
|
|
32
31
|
});
|
|
33
32
|
|
|
33
|
+
// eslint-disable-next-line unicorn/prefer-event-target
|
|
34
34
|
private static events = new EventEmitter();
|
|
35
35
|
|
|
36
36
|
static reconfigure(
|
|
37
37
|
{ level, redact }: LoggerOptions,
|
|
38
38
|
stream?: DestinationStream,
|
|
39
39
|
): void {
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires,unicorn/prefer-module
|
|
41
41
|
this._globalPino = require('pino')(
|
|
42
42
|
{
|
|
43
43
|
level: level ?? DEFAULT_LEVEL,
|
|
@@ -52,9 +52,10 @@ export class LoggerFactory {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
static create(context: LoggingContext): ILogger {
|
|
55
|
-
|
|
56
|
-
this.
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
return new PinoLogger(
|
|
56
|
+
() => this._globalPino,
|
|
57
|
+
(level: LogLevel, data: unknown) => this.events.emit('msg', level, data),
|
|
58
|
+
context,
|
|
59
|
+
);
|
|
59
60
|
}
|
|
60
61
|
}
|