@rsdk/logging 2.4.0 → 2.4.1-next.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 CHANGED
@@ -3,6 +3,10 @@
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.0](https://github.com/R-Vision/rsdk/compare/v2.4.0...v2.4.1-next.0) (2023-06-15)
7
+
8
+ **Note:** Version bump only for package @rsdk/logging
9
+
6
10
  # [2.4.0](https://github.com/R-Vision/rsdk/compare/v2.3.1...v2.4.0) (2023-06-15)
7
11
 
8
12
  **Note:** Version bump only for package @rsdk/logging
@@ -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 events_1 = __importDefault(require("events"));
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
- static events = new events_1.default();
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
- const trigger = (level, data) => this.events.emit('msg', level, data);
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,oDAAkC;AAGlC,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;IAEK,MAAM,CAAC,MAAM,GAAG,IAAI,gBAAY,EAAE,CAAC;IAE3C,MAAM,CAAC,WAAW,CAChB,EAAE,KAAK,EAAE,MAAM,EAAiB,EAChC,MAA0B;QAE1B,8DAA8D;QAC9D,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,MAAM,OAAO,GAAc,CAAC,KAAe,EAAE,IAAa,EAAE,EAAE,CAC5D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAEvC,OAAO,IAAI,4BAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;;AAvCU,sCAAa"}
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.0",
3
+ "version": "2.4.1-next.0",
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.0"
17
+ "@rsdk/common": "^2.4.1-next.0"
18
18
  },
19
- "gitHead": "2c2c1eac3027955838c0883ca1cb76b051a541ed"
19
+ "gitHead": "02cbc6be59dcf7d7784b316b315eb746c6d5ac4a"
20
20
  }
@@ -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
- const trigger: OnMessage = (level: LogLevel, data: unknown) =>
56
- this.events.emit('msg', level, data);
57
-
58
- return new PinoLogger(() => this._globalPino, trigger, context);
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
  }