@rsdk/logging 3.5.0 → 3.6.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 +11 -0
- package/dist/logger.factory.d.ts +1 -2
- package/dist/logger.factory.js +3 -2
- package/dist/logger.factory.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
- package/src/logger.factory.ts +5 -6
- package/src/types.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
## [3.6.0](https://github.com/R-Vision/rsdk/compare/v3.6.0-next.8...v3.6.0) (2023-10-20)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @rsdk/logging
|
|
9
|
+
|
|
10
|
+
## [3.6.0-next.6](https://github.com/R-Vision/rsdk/compare/v3.6.0-next.5...v3.6.0-next.6) (2023-10-20)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **logging:** sync logs env variable ([6c38363](https://github.com/R-Vision/rsdk/commit/6c3836320cbca5faef75c71a7d883466c1a911cf))
|
|
15
|
+
* **logging:** sync logs env variable ([383da47](https://github.com/R-Vision/rsdk/commit/383da478d11640053918e74e522c86286eba4150))
|
|
16
|
+
|
|
6
17
|
## [3.5.0](https://github.com/R-Vision/rsdk/compare/v3.5.0-next.9...v3.5.0) (2023-10-03)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @rsdk/logging
|
package/dist/logger.factory.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { DestinationStream } from 'pino';
|
|
2
1
|
import type { ILogger } from './logger.interface';
|
|
3
2
|
import type { LoggerOptions, LoggingContext, OnMessage } from './types';
|
|
4
3
|
/**
|
|
@@ -17,7 +16,7 @@ export declare class LoggerFactory {
|
|
|
17
16
|
*/
|
|
18
17
|
private static _globalPino;
|
|
19
18
|
private static events;
|
|
20
|
-
static reconfigure(
|
|
19
|
+
static reconfigure(opts: LoggerOptions): void;
|
|
21
20
|
static onMessage(handler: OnMessage): void;
|
|
22
21
|
static create(context: LoggingContext): ILogger;
|
|
23
22
|
}
|
package/dist/logger.factory.js
CHANGED
|
@@ -27,9 +27,10 @@ class LoggerFactory {
|
|
|
27
27
|
});
|
|
28
28
|
// eslint-disable-next-line unicorn/prefer-event-target
|
|
29
29
|
static events = new node_events_1.default();
|
|
30
|
-
static reconfigure(
|
|
30
|
+
static reconfigure(opts) {
|
|
31
|
+
const { redact, level, stream = pino_1.default.destination() } = opts;
|
|
31
32
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,unicorn/prefer-module
|
|
32
|
-
this._globalPino =
|
|
33
|
+
this._globalPino = (0, pino_1.default)({
|
|
33
34
|
level: level ?? defaults_1.DEFAULT_LEVEL,
|
|
34
35
|
...(redact && { redact }),
|
|
35
36
|
}, stream);
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,CAAC,IAAmB;QACpC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,cAAI,CAAC,WAAW,EAAE,EAAE,GAAG,IAAI,CAAC;QAE5D,oFAAoF;QACpF,IAAI,CAAC,WAAW,GAAG,IAAA,cAAI,EACrB;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;;AAxCH,sCAyCC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Constructor } from '@rsdk/common';
|
|
2
|
+
import type pino from 'pino';
|
|
2
3
|
export declare enum LogLevel {
|
|
3
4
|
fatal = "fatal",
|
|
4
5
|
error = "error",
|
|
@@ -11,6 +12,7 @@ export type Params = Record<string, unknown>;
|
|
|
11
12
|
export interface LoggerOptions {
|
|
12
13
|
level?: LogLevel;
|
|
13
14
|
redact?: string[];
|
|
15
|
+
stream?: pino.DestinationStream;
|
|
14
16
|
}
|
|
15
17
|
export type LoggingContext = string | Constructor;
|
|
16
18
|
export type OnMessage = (level: LogLevel, data: object) => void;
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAGA,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,2BAAe,CAAA;IACf,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,2BAAe,CAAA;IACf,2BAAe,CAAA;AACjB,CAAC,EAPW,QAAQ,wBAAR,QAAQ,QAOnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/logging",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Base framework independent logging functionality",
|
|
5
5
|
"license": "Apache License 2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@rsdk/common": "^3.5.0"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "cc75fb4595bd49e877974f6eeeef66f30743011c"
|
|
23
23
|
}
|
package/src/logger.factory.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import EventEmitter from 'node:events';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Logger as Pino } from 'pino';
|
|
3
3
|
import pino from 'pino';
|
|
4
4
|
|
|
5
5
|
import { DEFAULT_LEVEL } from './defaults';
|
|
@@ -33,12 +33,11 @@ export class LoggerFactory {
|
|
|
33
33
|
// eslint-disable-next-line unicorn/prefer-event-target
|
|
34
34
|
private static events = new EventEmitter();
|
|
35
35
|
|
|
36
|
-
static reconfigure(
|
|
37
|
-
{ level,
|
|
38
|
-
|
|
39
|
-
): void {
|
|
36
|
+
static reconfigure(opts: LoggerOptions): void {
|
|
37
|
+
const { redact, level, stream = pino.destination() } = opts;
|
|
38
|
+
|
|
40
39
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,unicorn/prefer-module
|
|
41
|
-
this._globalPino =
|
|
40
|
+
this._globalPino = pino(
|
|
42
41
|
{
|
|
43
42
|
level: level ?? DEFAULT_LEVEL,
|
|
44
43
|
...(redact && { redact }),
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Constructor } from '@rsdk/common';
|
|
2
|
+
import type pino from 'pino';
|
|
2
3
|
|
|
3
4
|
export enum LogLevel {
|
|
4
5
|
fatal = 'fatal',
|
|
@@ -14,6 +15,7 @@ export type Params = Record<string, unknown>;
|
|
|
14
15
|
export interface LoggerOptions {
|
|
15
16
|
level?: LogLevel;
|
|
16
17
|
redact?: string[];
|
|
18
|
+
stream?: pino.DestinationStream;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export type LoggingContext = string | Constructor;
|