nest-logger-bundle 1.0.0 → 1.1.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/README.md +47 -40
- package/dist/lib/bundle/context/async-logger-context.service.d.ts +4 -4
- package/dist/lib/bundle/context/async-logger-context.service.js +10 -10
- package/dist/lib/bundle/context/async-logger-context.service.js.map +1 -1
- package/dist/lib/bundle/context/async-logger.hook.d.ts +2 -2
- package/dist/lib/bundle/context/async-logger.hook.js +4 -4
- package/dist/lib/bundle/context/async-logger.hook.js.map +1 -1
- package/dist/lib/bundle/index.d.ts +0 -1
- package/dist/lib/bundle/index.js +0 -1
- package/dist/lib/bundle/index.js.map +1 -1
- package/dist/lib/bundle/logger-branch/logger-branch.d.ts +2 -2
- package/dist/lib/bundle/logger-branch/logger-branch.js +4 -4
- package/dist/lib/bundle/logger-branch/logger-branch.js.map +1 -1
- package/dist/lib/bundle/logger-branch/logger-leaf.d.ts +2 -2
- package/dist/lib/bundle/logger-branch/logger-leaf.js.map +1 -1
- package/dist/lib/bundle/logger-branch/logger-node.d.ts +2 -2
- package/dist/lib/bundle/logger-bundle.module.d.ts +1 -1
- package/dist/lib/bundle/logger-bundle.module.js +7 -7
- package/dist/lib/bundle/logger-bundle.module.js.map +1 -1
- package/dist/lib/bundle/logger-bundle.service.d.ts +4 -4
- package/dist/lib/bundle/logger-bundle.service.js +6 -6
- package/dist/lib/bundle/logger-bundle.service.js.map +1 -1
- package/dist/lib/core/filters/logger-exception.filter.d.ts +3 -3
- package/dist/lib/core/filters/logger-exception.filter.js +1 -1
- package/dist/lib/core/filters/logger-exception.filter.js.map +1 -1
- package/dist/lib/core/filters/logger-http.interceptor.d.ts +2 -2
- package/dist/lib/core/filters/logger-http.interceptor.js +1 -1
- package/dist/lib/core/filters/logger-http.interceptor.js.map +1 -1
- package/dist/lib/core/middleware/bind-logger.middleware.d.ts +3 -3
- package/dist/lib/core/middleware/bind-logger.middleware.js +7 -7
- package/dist/lib/core/middleware/bind-logger.middleware.js.map +1 -1
- package/dist/lib/core/providers/bundle-logger.provider.js +1 -1
- package/dist/lib/core/providers/bundle-logger.provider.js.map +1 -1
- package/dist/lib/core/providers/pretty-logger.provider.js +1 -1
- package/dist/lib/core/providers/pretty-logger.provider.js.map +1 -1
- package/dist/lib/core/providers/utils.d.ts +2 -2
- package/dist/lib/core/providers/utils.js +2 -2
- package/dist/lib/core/providers/utils.js.map +1 -1
- package/dist/lib/logger/logger.service.d.ts +5 -5
- package/dist/lib/logger/logger.service.js +7 -7
- package/dist/lib/logger/logger.service.js.map +1 -1
- package/dist/lib/nest-logger.module-definition.d.ts +2 -2
- package/dist/lib/nest-logger.module-definition.js.map +1 -1
- package/dist/lib/nest-logger.module.d.ts +3 -3
- package/dist/lib/nest-logger.module.js +12 -12
- package/dist/lib/nest-logger.module.js.map +1 -1
- package/dist/lib/nest-logger.params.d.ts +22 -22
- package/dist/lib/nest-logger.params.js +12 -12
- package/dist/lib/nest-logger.params.js.map +1 -1
- package/dist/lib/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,13 +49,13 @@ ________________
|
|
|
49
49
|
|
|
50
50
|
## How to use
|
|
51
51
|
|
|
52
|
-
First we need to import the
|
|
52
|
+
First we need to import the LoggerBundleModule module in the module we want to use. Follow the minimum configuration:
|
|
53
53
|
|
|
54
54
|
```ts
|
|
55
55
|
import { Global, Module } from '@nestjs/common';
|
|
56
56
|
import { APP_FILTER, APP_INTERCEPTOR } from '@nestjs/core';
|
|
57
57
|
import {
|
|
58
|
-
|
|
58
|
+
LoggerBundleModule,
|
|
59
59
|
LoggerExceptionFilter,
|
|
60
60
|
LoggerHttpInterceptor
|
|
61
61
|
} from 'nest-logger-bundle';
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
imports: [
|
|
68
68
|
// .. imports
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
LoggerBundleModule.forRoot({})
|
|
71
71
|
],
|
|
72
72
|
|
|
73
73
|
providers: [
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
},
|
|
82
82
|
],
|
|
83
83
|
|
|
84
|
-
exports: [
|
|
84
|
+
exports: [LoggerBundleModule /**, ... others exports */],
|
|
85
85
|
})
|
|
86
86
|
export class GlobalModule {}
|
|
87
87
|
|
|
@@ -100,7 +100,7 @@ To inject the Logger in some injectable service of your project follow the examp
|
|
|
100
100
|
export class SampleUserService {
|
|
101
101
|
|
|
102
102
|
constructor(
|
|
103
|
-
private logService:
|
|
103
|
+
private logService: LoggerBundleService
|
|
104
104
|
) {
|
|
105
105
|
this.logService.setContextToken(SampleService.name)
|
|
106
106
|
}
|
|
@@ -242,7 +242,7 @@ The generated logs tree follows the following structure, where the `logs` array
|
|
|
242
242
|
}
|
|
243
243
|
```
|
|
244
244
|
|
|
245
|
-
There are some methods available for use in
|
|
245
|
+
There are some methods available for use in LoggerBundleService, here is a list of them
|
|
246
246
|
|
|
247
247
|
- Log Methods <br/>
|
|
248
248
|
```ts
|
|
@@ -300,13 +300,13 @@ ______
|
|
|
300
300
|
|
|
301
301
|
## Setting-up
|
|
302
302
|
|
|
303
|
-
The
|
|
303
|
+
The LoggerBundleModule provides two ways of configuration, they are:
|
|
304
304
|
|
|
305
305
|
- *Statically Config*<br/>
|
|
306
306
|
If you want to configure it statically, just use
|
|
307
307
|
|
|
308
308
|
```ts
|
|
309
|
-
|
|
309
|
+
LoggerBundleModule.forRoot({
|
|
310
310
|
// ... params
|
|
311
311
|
})
|
|
312
312
|
```
|
|
@@ -315,9 +315,9 @@ ______
|
|
|
315
315
|
In case you want to pass the settings asynchronously
|
|
316
316
|
|
|
317
317
|
```ts
|
|
318
|
-
|
|
318
|
+
LoggerBundleModule.forRootAsync({
|
|
319
319
|
isGlobal: boolean, //
|
|
320
|
-
useFactory: (config: ConfigService):
|
|
320
|
+
useFactory: (config: ConfigService): LoggerBundleParams => {
|
|
321
321
|
return {
|
|
322
322
|
// ... params
|
|
323
323
|
}
|
|
@@ -334,12 +334,12 @@ You must provide the desired parameters for the LoggerBundleModule, the paramete
|
|
|
334
334
|
loggers: {
|
|
335
335
|
type: 'default',
|
|
336
336
|
prettyPrint: {
|
|
337
|
-
mode:
|
|
337
|
+
mode: LoggerBundleParamsLogggerMode, // DEFAULT IS LOG_BUNDLE
|
|
338
338
|
disabled: boolean,
|
|
339
339
|
options: pino.PrettyOptions,
|
|
340
340
|
},
|
|
341
341
|
streams: {
|
|
342
|
-
mode:
|
|
342
|
+
mode: LoggerBundleParamsLogggerMode, // DEFAULT IS LOG_BUNDLE
|
|
343
343
|
pinoStreams: pinoms.Streams
|
|
344
344
|
},
|
|
345
345
|
timestamp: {
|
|
@@ -353,7 +353,7 @@ You must provide the desired parameters for the LoggerBundleModule, the paramete
|
|
|
353
353
|
// You can change this
|
|
354
354
|
contextBundle: {
|
|
355
355
|
strategy: {
|
|
356
|
-
level:
|
|
356
|
+
level: LoggerBundleLevelStrategy
|
|
357
357
|
},
|
|
358
358
|
}
|
|
359
359
|
}
|
|
@@ -372,7 +372,7 @@ You must provide the desired parameters for the LoggerBundleModule, the paramete
|
|
|
372
372
|
// You can change this
|
|
373
373
|
contextBundle: {
|
|
374
374
|
strategy: {
|
|
375
|
-
level:
|
|
375
|
+
level: LoggerBundleLevelStrategy
|
|
376
376
|
},
|
|
377
377
|
}
|
|
378
378
|
}
|
|
@@ -380,56 +380,63 @@ You must provide the desired parameters for the LoggerBundleModule, the paramete
|
|
|
380
380
|
|
|
381
381
|
Below is the description of each parameter
|
|
382
382
|
|
|
383
|
-
- **
|
|
383
|
+
- **LoggerBundleParams**<br/>
|
|
384
384
|
|
|
385
385
|
| Param | Description
|
|
386
386
|
| :--- | :----:
|
|
387
|
-
| ***loggers***?:
|
|
388
|
-
| ***contextBundle***?:
|
|
387
|
+
| ***loggers***?: LoggerBundleParamsStream \| LoggerBundleParamsCustom | The LoggerBundle uses the `pino-multi-stream ` to transport the logs to several different destinations at the same time, if you want to use the default implementation that makes managing these logs very easy use type `'default'` so some parameters of `LoggerBundleParamsStream` will be provided, but if you choose to use a type `'custom'` some parameters of `LoggerBundleParamsCustom` will be provided and you can use a `pino` logger configured in your own way.
|
|
388
|
+
| ***contextBundle***?: LoggerBundleParamsContextBundle | Here you can configure some behaviors related to how the bundle is created, for example, configure what the bundle's marjoritary level will be..
|
|
389
389
|
| ***forRoutes***?: (string \| Type<any> \| RouteInfo)[] | Pattern based routes are supported as well. For instance, the asterisk is used as a wildcard, and will match any combination of characters, for more datails see [NestJS-Middlewares](https://docs.nestjs.com/middleware), the default is `[{ path: '*', method: RequestMethod.ALL }]`
|
|
390
390
|
|
|
391
|
-
- **
|
|
392
|
-
If you choose to use the default configuration in `
|
|
391
|
+
- **LoggerBundleParamsStream**<br/>
|
|
392
|
+
If you choose to use the default configuration in `LoggerBundleParams`, using '`{ type: 'default', ... }`' the options for these parameters will be provided
|
|
393
393
|
> It is worth remembering that it is recommended to use this configuration if you do not have the need to create your own configuration.
|
|
394
394
|
|
|
395
395
|
| Param | Description
|
|
396
396
|
| :--- | :----:
|
|
397
397
|
| ***type***: `'default'` | For the options to follow this pattern you must set the type to `'default'`
|
|
398
|
-
| ***prettyPrint***?:
|
|
399
|
-
| ***streams***?:
|
|
400
|
-
| ***timestamp***?:
|
|
398
|
+
| ***prettyPrint***?: LoggerBundleParamsPretty | Here you can configure `prettyStream`, choosing to disable it if necessary and also provide your `pin.PrettyOptions`
|
|
399
|
+
| ***streams***?: LoggerBundleParamsStreams | Here you can configure `streams`, choosing to disable it if necessary and also provide your own transporter
|
|
400
|
+
| ***timestamp***?: LoggerBundleParamsTimestamp | To configure how the timestamp will be formatted or even disable it, use these settings
|
|
401
401
|
|
|
402
402
|
### Related Params
|
|
403
403
|
|
|
404
|
-
- **
|
|
404
|
+
- **LoggerBundleParamsPretty**<br/>
|
|
405
405
|
|
|
406
406
|
| Param | Description
|
|
407
407
|
| :--- | :----:
|
|
408
|
-
| ***mode***?:
|
|
408
|
+
| ***mode***?: LoggerBundleParamsLogggerMode | Here you can choose the mode that `prettyStream` will display the logs, the default value is `LoggerBundleParamsLogggerMode.LOG_BUNDLE`, so the bundle will be logged.
|
|
409
409
|
| ***disabled***?: boolean | If you want to disable the `prettyStream` you can pass `false` in this option `(remembering that, as it will be disabled the 'options' will not have any effects)`
|
|
410
410
|
| ***options***?: pino.PrettyOptions | Here you can pass some options provided by `pin`, like `{colorize: true}`
|
|
411
411
|
|
|
412
|
-
- **
|
|
412
|
+
- **LoggerBundleParamsStreams**<br/>
|
|
413
413
|
|
|
414
414
|
| Param | Description
|
|
415
415
|
| :--- | :----:
|
|
416
|
-
| ***mode***?:
|
|
416
|
+
| ***mode***?: LoggerBundleParamsLogggerMode | Here you can choose the mode that `streams` will display the logs, the default value is `LoggerBundleParamsLogggerMode.LOG_BUNDLE`, so the bundle will be logged.
|
|
417
417
|
| ***pinoStreams***?: pinoms.Streams | You can also tell which `streams` you want pinoms handles, you can find implementations of various transporters that can be used here https://github.com/pinojs/pino/blob/master/docs/transports.md#legacy
|
|
418
418
|
|
|
419
|
-
- **
|
|
419
|
+
- **LoggerBundleParamsLogggerMode**<br/>
|
|
420
420
|
|
|
421
421
|
There are two types of modes used in the `prettyPrint` and `streams` settings, they are:
|
|
422
422
|
|
|
423
423
|
| Enum | Description
|
|
424
424
|
| :--- | :----:
|
|
425
|
-
| ***
|
|
426
|
-
| ***
|
|
425
|
+
| ***LoggerBundleParamsLogggerMode.LOG_BUNDLE*** | Indicates that the log will be sent to the destination as a bundle `(this is the default behavior of all destinations)`
|
|
426
|
+
| ***LoggerBundleParamsLogggerMode.LOG_LINE*** | Indicates that the log will be sent to the destination as log lines
|
|
427
427
|
|
|
428
428
|
- **pinoms.Streams**<br/>
|
|
429
429
|
|
|
430
430
|
Here you can set some streams to transport your logs, check these examples of how to use [Streams](#streams)
|
|
431
431
|
|
|
432
|
-
- **
|
|
432
|
+
- **LoggerBundleParamsTimestamp**<br/>
|
|
433
|
+
|
|
434
|
+
| Param | Description
|
|
435
|
+
| :--- | :----:
|
|
436
|
+
| ***disabled***: boolean | If necessary, you can also disable the timestamp.
|
|
437
|
+
| ***format***: LoggerBundleParamsPinoTimestampFormat | You can also configure how the timestamp will be formatted in the logs informing a template and a timezone, the template is created with the help of `dayjs` to assemble the desired string you can use the symbols informed here [Day.js](https://day.js.org/docs/en/display/format)
|
|
438
|
+
|
|
439
|
+
- **LoggerBundleParamsPinoTimestampFormat**<br/>
|
|
433
440
|
|
|
434
441
|
| Param | Description
|
|
435
442
|
| :--- | :----:
|
|
@@ -438,8 +445,8 @@ Below is the description of each parameter
|
|
|
438
445
|
|
|
439
446
|
|
|
440
447
|
|
|
441
|
-
- **
|
|
442
|
-
But if you choose to use the
|
|
448
|
+
- **LoggerBundleParamsCustom**<br/>
|
|
449
|
+
But if you choose to use the custom configuration in `LoggerBundleParams`, using '`{ type: 'custom', ... }`' the options for these parameters will be provided
|
|
443
450
|
|
|
444
451
|
| Param | Description
|
|
445
452
|
| :--- | :----:
|
|
@@ -447,21 +454,21 @@ Below is the description of each parameter
|
|
|
447
454
|
| ***bundleLogger***: pino.Logger | This logger will be used to log bundles only
|
|
448
455
|
| ***lineLogger***?: pino.Logger | This logger will be used to log only line logs (which are common logs)
|
|
449
456
|
|
|
450
|
-
- **
|
|
457
|
+
- **LoggerBundleParamsContextBundle**<br/>
|
|
451
458
|
Here you can configure bundle-related behaviors, such as the `strategy` used to dispatch the bundle to the loggers
|
|
452
459
|
|
|
453
460
|
| Param | Description
|
|
454
461
|
| :--- | :----:
|
|
455
|
-
| ***strategy***?:
|
|
462
|
+
| ***strategy***?: LoggerBundleParamsContextBundleStrategy | Strategy used to dispatch the bundle to the loggers
|
|
456
463
|
|
|
457
464
|
### Related Params
|
|
458
465
|
|
|
459
|
-
- **
|
|
466
|
+
- **LoggerBundleParamsContextBundleStrategy**<br/>
|
|
460
467
|
Below are the settings available for these strategies
|
|
461
468
|
|
|
462
469
|
| Param | Description
|
|
463
470
|
| :--- | :----:
|
|
464
|
-
| ***level***?:
|
|
471
|
+
| ***level***?: LoggerBundleLevelStrategy | This strategy defines what will be the main level of the bundle, as the bundle will contain a tree of logs, it can contain several logs with several levels, so to define the main level, the configuration provided here is used to decide the best level, the default strategy is `LoggerBundleLevelStrategy.MAJOR_LEVEL`
|
|
465
472
|
|
|
466
473
|
### Streams
|
|
467
474
|
|
|
@@ -473,8 +480,8 @@ observability service in the cloud, here is an example of how to configure this
|
|
|
473
480
|
import datadog from 'pino-datadog';
|
|
474
481
|
|
|
475
482
|
// ...
|
|
476
|
-
|
|
477
|
-
useFactory: async (config: ConfigService): Promise<
|
|
483
|
+
LoggerBundleModule.forRootAsync({
|
|
484
|
+
useFactory: async (config: ConfigService): Promise<LoggerBundleParams> => {
|
|
478
485
|
const datadogStream = await datadog.createWriteStream({
|
|
479
486
|
apiKey: config.get('datadog.apiKey'),
|
|
480
487
|
service: config.get('datadog.serviceName'),
|
|
@@ -565,13 +572,13 @@ import { GlobalInterceptor } from './example-http-interceptor.ts'
|
|
|
565
572
|
In case you need to call some asynchronous function and not block the execution with `await` this can create a point of failure for the `LoggerBundle`, this failure is not serious but it can create confusion when interpreting the logs, this happens because a request that originated this call can end before the async function finishes, so when the request is finished the `LoggerBundle` assembles a bundle and transports it, so the async call that can still be loose and calling logging in will not be packaged in the same bundle, these logs they would be lost. For this there is a function that creates an asynchronous `LoggerBundle` and transfers you the responsibility of transporting the log at the end of the asynchronous flow. An example of usage is shown below
|
|
566
573
|
|
|
567
574
|
```ts
|
|
568
|
-
import { AsyncLoggerService,
|
|
575
|
+
import { AsyncLoggerService, LoggerBundleService } from 'nest-logger-bundle';
|
|
569
576
|
|
|
570
577
|
@Injectable()
|
|
571
578
|
export class SampleUserService {
|
|
572
579
|
|
|
573
580
|
constructor(
|
|
574
|
-
private logService:
|
|
581
|
+
private logService: LoggerBundleService
|
|
575
582
|
) {
|
|
576
583
|
this.logService.setContextToken(SampleService.name)
|
|
577
584
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ModuleRef } from '@nestjs/core';
|
|
2
2
|
import pino from 'pino';
|
|
3
|
-
import {
|
|
4
|
-
export declare class
|
|
3
|
+
import { LoggerBundleParams } from '../../nest-logger.params';
|
|
4
|
+
export declare class BundleAsyncLoggerContext {
|
|
5
5
|
private params;
|
|
6
6
|
private bundleLogger;
|
|
7
7
|
private moduleRef;
|
|
8
8
|
private detachedContext;
|
|
9
|
-
constructor(params:
|
|
9
|
+
constructor(params: LoggerBundleParams, bundleLogger: pino.Logger, moduleRef: ModuleRef);
|
|
10
10
|
getCurrent(): {
|
|
11
11
|
logger: import("pino").Logger<import("pino").LoggerOptions>;
|
|
12
12
|
reqId: any;
|
|
@@ -15,5 +15,5 @@ export declare class NestAsyncLoggerContext {
|
|
|
15
15
|
dispatchCurrentLoggerBundle(message: string): void;
|
|
16
16
|
dispatchCurrentLoggerBundle(exception: unknown, message?: string): void;
|
|
17
17
|
hasContext(): boolean;
|
|
18
|
-
createDetachedContext(): Promise<
|
|
18
|
+
createDetachedContext(): Promise<BundleAsyncLoggerContext>;
|
|
19
19
|
}
|
|
@@ -14,9 +14,9 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
15
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
16
|
};
|
|
17
|
-
var
|
|
17
|
+
var BundleAsyncLoggerContext_1;
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.BundleAsyncLoggerContext = void 0;
|
|
20
20
|
const common_1 = require("@nestjs/common");
|
|
21
21
|
const core_1 = require("@nestjs/core");
|
|
22
22
|
const pino_1 = __importDefault(require("pino"));
|
|
@@ -24,7 +24,7 @@ const nest_logger_module_definition_1 = require("../../nest-logger.module-defini
|
|
|
24
24
|
const nest_logger_params_1 = require("../../nest-logger.params");
|
|
25
25
|
const logger_bundle_service_1 = require("../logger-bundle.service");
|
|
26
26
|
const async_logger_hook_1 = require("./async-logger.hook");
|
|
27
|
-
let
|
|
27
|
+
let BundleAsyncLoggerContext = BundleAsyncLoggerContext_1 = class BundleAsyncLoggerContext {
|
|
28
28
|
constructor(params, bundleLogger, moduleRef) {
|
|
29
29
|
this.params = params;
|
|
30
30
|
this.bundleLogger = bundleLogger;
|
|
@@ -36,7 +36,7 @@ let NestAsyncLoggerContext = NestAsyncLoggerContext_1 = class NestAsyncLoggerCon
|
|
|
36
36
|
if (!this.hasContext()) {
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
|
-
const fromStore = async_logger_hook_1.
|
|
39
|
+
const fromStore = async_logger_hook_1.BundleLoggerStorage.getStore();
|
|
40
40
|
return {
|
|
41
41
|
logger: fromStore.logger,
|
|
42
42
|
reqId: fromStore.reqId,
|
|
@@ -58,11 +58,11 @@ let NestAsyncLoggerContext = NestAsyncLoggerContext_1 = class NestAsyncLoggerCon
|
|
|
58
58
|
loggerBundle.expireNow();
|
|
59
59
|
}
|
|
60
60
|
hasContext() {
|
|
61
|
-
return !!async_logger_hook_1.
|
|
61
|
+
return !!async_logger_hook_1.BundleLoggerStorage.getStore();
|
|
62
62
|
}
|
|
63
63
|
async createDetachedContext() {
|
|
64
|
-
const context = await this.moduleRef.create(
|
|
65
|
-
const detachedLoggerBundle = await this.moduleRef.create(logger_bundle_service_1.
|
|
64
|
+
const context = await this.moduleRef.create(BundleAsyncLoggerContext_1);
|
|
65
|
+
const detachedLoggerBundle = await this.moduleRef.create(logger_bundle_service_1.LoggerBundle);
|
|
66
66
|
let getFrom;
|
|
67
67
|
if (this.detachedContext) {
|
|
68
68
|
getFrom = this.detachedContext;
|
|
@@ -88,11 +88,11 @@ let NestAsyncLoggerContext = NestAsyncLoggerContext_1 = class NestAsyncLoggerCon
|
|
|
88
88
|
return context;
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
|
|
91
|
+
BundleAsyncLoggerContext = BundleAsyncLoggerContext_1 = __decorate([
|
|
92
92
|
(0, common_1.Injectable)({}),
|
|
93
93
|
__param(0, (0, common_1.Inject)(nest_logger_module_definition_1.MODULE_OPTIONS_TOKEN)),
|
|
94
94
|
__param(1, (0, common_1.Inject)(nest_logger_params_1.BUNDLE_LOGGER_PROVIDER_TOKEN)),
|
|
95
95
|
__metadata("design:paramtypes", [Object, Object, core_1.ModuleRef])
|
|
96
|
-
],
|
|
97
|
-
exports.
|
|
96
|
+
], BundleAsyncLoggerContext);
|
|
97
|
+
exports.BundleAsyncLoggerContext = BundleAsyncLoggerContext;
|
|
98
98
|
//# sourceMappingURL=async-logger-context.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-logger-context.service.js","sourceRoot":"","sources":["../../../../lib/src/bundle/context/async-logger-context.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,uCAAyC;AACzC,gDAAwB;AACxB,uFAA2E;AAC3E,iEAGkC;AAClC,
|
|
1
|
+
{"version":3,"file":"async-logger-context.service.js","sourceRoot":"","sources":["../../../../lib/src/bundle/context/async-logger-context.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,uCAAyC;AACzC,gDAAwB;AACxB,uFAA2E;AAC3E,iEAGkC;AAClC,oEAAwD;AACxD,2DAA0D;AAM1D,IAAa,wBAAwB,gCAArC,MAAa,wBAAwB;IAQpC,YACuC,MAA0B,EAClB,YAAyB,EAC/D,SAAoB;QAFU,WAAM,GAAN,MAAM,CAAoB;QAClB,iBAAY,GAAZ,YAAY,CAAa;QAC/D,cAAS,GAAT,SAAS,CAAW;IAC1B,CAAC;IAEJ,UAAU;QACT,IAAI,IAAI,CAAC,eAAe;YAAE,OAAO,IAAI,CAAC,eAAe,CAAC;QAEtD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE;YACvB,OAAO,IAAI,CAAC;SACZ;QAED,MAAM,SAAS,GA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B;aAAM;YACN,OAAO,GAAG;gBACT,MAAM,EAAE,IAAI,CAAC,YAAY;gBACzB,YAAY,EAAE,IAAI;gBAClB,KAAK,EAAE,WAAW;aAClB,CAAC;SACF;QAED,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;QAEhD,IAAI,YAAY;YAAE,oBAAoB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAE9D,OAAO,CAAC,eAAe,GAAG;YACzB,MAAM;YACN,YAAY,EAAE,oBAAoB;YAClC,KAAK;SACL,CAAC;QAEF,OAAO,OAAO,CAAC;IAChB,CAAC;CACD,CAAA;AA/FY,wBAAwB;IADpC,IAAA,mBAAU,EAAC,EAAE,CAAC;IAUZ,WAAA,IAAA,eAAM,EAAC,oDAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,eAAM,EAAC,iDAA4B,CAAC,CAAA;qDAClB,gBAAS;GAXjB,wBAAwB,CA+FpC;AA/FY,4DAAwB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
3
3
|
import { Logger } from 'pino';
|
|
4
|
-
export declare class
|
|
4
|
+
export declare class BundleLoggerStore {
|
|
5
5
|
loggerContext: any;
|
|
6
6
|
reqId: any;
|
|
7
7
|
logger: Logger;
|
|
8
8
|
constructor(loggerContext: any, reqId: any, logger: Logger);
|
|
9
9
|
}
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const BundleLoggerStorage: AsyncLocalStorage<BundleLoggerStore>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.BundleLoggerStorage = exports.BundleLoggerStore = void 0;
|
|
4
4
|
const async_hooks_1 = require("async_hooks");
|
|
5
|
-
class
|
|
5
|
+
class BundleLoggerStore {
|
|
6
6
|
constructor(loggerContext, reqId, logger) {
|
|
7
7
|
this.loggerContext = loggerContext;
|
|
8
8
|
this.reqId = reqId;
|
|
9
9
|
this.logger = logger;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
12
|
+
exports.BundleLoggerStore = BundleLoggerStore;
|
|
13
|
+
exports.BundleLoggerStorage = new async_hooks_1.AsyncLocalStorage();
|
|
14
14
|
//# sourceMappingURL=async-logger.hook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-logger.hook.js","sourceRoot":"","sources":["../../../../lib/src/bundle/context/async-logger.hook.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"async-logger.hook.js","sourceRoot":"","sources":["../../../../lib/src/bundle/context/async-logger.hook.ts"],"names":[],"mappings":";;;AAAA,6CAAgD;AAGhD,MAAa,iBAAiB;IAC7B,YAAmB,aAAkB,EAAS,KAAU,EAAS,MAAc;QAA5D,kBAAa,GAAb,aAAa,CAAK;QAAS,UAAK,GAAL,KAAK,CAAK;QAAS,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;CACnF;AAFD,8CAEC;AAEY,QAAA,mBAAmB,GAAG,IAAI,+BAAiB,EAAqB,CAAC"}
|
package/dist/lib/bundle/index.js
CHANGED
|
@@ -22,6 +22,5 @@ __exportStar(require("./logger-branch/logger-branch"), exports);
|
|
|
22
22
|
__exportStar(require("./logger-branch/logger-leaf"), exports);
|
|
23
23
|
__exportStar(require("./logger-branch/logger-node"), exports);
|
|
24
24
|
__exportStar(require("./dummy-logger"), exports);
|
|
25
|
-
__exportStar(require("./logger-bundle.module"), exports);
|
|
26
25
|
__exportStar(require("./logger-bundle.service"), exports);
|
|
27
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/src/bundle/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yEAAuD;AACvD,8DAA4C;AAC5C,+DAA6C;AAE7C,+DAA6C;AAC7C,gEAA8C;AAC9C,8DAA4C;AAC5C,8DAA4C;AAE5C,iDAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/src/bundle/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yEAAuD;AACvD,8DAA4C;AAC5C,+DAA6C;AAE7C,+DAA6C;AAC7C,gEAA8C;AAC9C,8DAA4C;AAC5C,8DAA4C;AAE5C,iDAA+B;AAC/B,0DAAwC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import pino from "pino";
|
|
2
2
|
import { LoggerFunction, PinoLevels } from "../context/logger.definitions";
|
|
3
3
|
import { LoggerNode } from "./logger-node";
|
|
4
|
-
import {
|
|
4
|
+
import { LoggerBundleLevelStrategy } from '../../nest-logger.params';
|
|
5
5
|
export declare class LoggerBranch implements LoggerNode {
|
|
6
6
|
private _parent;
|
|
7
7
|
branchName: string;
|
|
@@ -14,7 +14,7 @@ export declare class LoggerBranch implements LoggerNode {
|
|
|
14
14
|
log(level: pino.Level, ...params: Parameters<LoggerFunction>): void;
|
|
15
15
|
exit(): LoggerBranch;
|
|
16
16
|
profiling(): number;
|
|
17
|
-
introspectLevel(strategy?:
|
|
17
|
+
introspectLevel(strategy?: LoggerBundleLevelStrategy, defaultLevel?: PinoLevels): PinoLevels;
|
|
18
18
|
toObject(): {
|
|
19
19
|
profiling: string;
|
|
20
20
|
name: string;
|
|
@@ -37,7 +37,7 @@ class LoggerBranch {
|
|
|
37
37
|
return undefined;
|
|
38
38
|
return this.exitedAt - this.createdAt;
|
|
39
39
|
}
|
|
40
|
-
introspectLevel(strategy = nest_logger_params_1.
|
|
40
|
+
introspectLevel(strategy = nest_logger_params_1.LoggerBundleLevelStrategy.MAJOR_LEVEL, defaultLevel = 'info') {
|
|
41
41
|
let currentLevel = null;
|
|
42
42
|
for (const branch of this.branchs) {
|
|
43
43
|
const cLevel = branch.introspectLevel(strategy, defaultLevel);
|
|
@@ -49,14 +49,14 @@ class LoggerBranch {
|
|
|
49
49
|
const lv2 = pino_1.default.levels.values[cLevel];
|
|
50
50
|
switch (strategy) {
|
|
51
51
|
default:
|
|
52
|
-
case nest_logger_params_1.
|
|
52
|
+
case nest_logger_params_1.LoggerBundleLevelStrategy.LAST_LEVEL:
|
|
53
53
|
currentLevel = cLevel;
|
|
54
54
|
break;
|
|
55
|
-
case nest_logger_params_1.
|
|
55
|
+
case nest_logger_params_1.LoggerBundleLevelStrategy.MINOR_LEVEL: {
|
|
56
56
|
currentLevel = pino_1.default.levels.labels[Math.min(lv1, lv2)];
|
|
57
57
|
break;
|
|
58
58
|
}
|
|
59
|
-
case nest_logger_params_1.
|
|
59
|
+
case nest_logger_params_1.LoggerBundleLevelStrategy.MAJOR_LEVEL:
|
|
60
60
|
currentLevel = pino_1.default.levels.labels[Math.max(lv1, lv2)];
|
|
61
61
|
break;
|
|
62
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger-branch.js","sourceRoot":"","sources":["../../../../lib/src/bundle/logger-branch/logger-branch.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,+CAA2C;AAE3C,
|
|
1
|
+
{"version":3,"file":"logger-branch.js","sourceRoot":"","sources":["../../../../lib/src/bundle/logger-branch/logger-branch.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,+CAA2C;AAE3C,iEAAqE;AAErE,MAAa,YAAY;IAMxB,YAAoB,OAAqB,EAAS,UAAkB;QAAhD,YAAO,GAAP,OAAO,CAAc;QAAS,eAAU,GAAV,UAAU,CAAQ;QALpE,cAAS,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;QAC/B,aAAQ,GAAY,IAAI,CAAC;QAEzB,YAAO,GAAiB,EAAE,CAAC;IAE4C,CAAC;IAExE,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;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C,CAAC,CAAC;SAC1C;QACD,OAAO,MAAM,CAAC;IACf,CAAC;CACD;AAnFD,oCAmFC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LoggerBundleLevelStrategy } from "../../nest-logger.params";
|
|
2
2
|
import pino from "pino";
|
|
3
3
|
import { LoggerFunction, PinoLevels } from "../context/logger.definitions";
|
|
4
4
|
import { LoggerNode } from "./logger-node";
|
|
@@ -14,6 +14,6 @@ export declare class LoggerLeaf implements LoggerNode {
|
|
|
14
14
|
error: Error;
|
|
15
15
|
level: pino.Level;
|
|
16
16
|
};
|
|
17
|
-
introspectLevel(_:
|
|
17
|
+
introspectLevel(_: LoggerBundleLevelStrategy, defaultLevel?: PinoLevels): PinoLevels;
|
|
18
18
|
clone(): LoggerNode;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger-leaf.js","sourceRoot":"","sources":["../../../../lib/src/bundle/logger-branch/logger-leaf.ts"],"names":[],"mappings":";;;AAGA,iDAAmD;
|
|
1
|
+
{"version":3,"file":"logger-leaf.js","sourceRoot":"","sources":["../../../../lib/src/bundle/logger-branch/logger-leaf.ts"],"names":[],"mappings":";;;AAGA,iDAAmD;AAGnD,MAAa,UAAU;IACtB,YAAmB,KAAiB,EAAS,GAA+B;QAAzD,UAAK,GAAL,KAAK,CAAY;QAAS,QAAG,GAAH,GAAG,CAA4B;IAAG,CAAC;IAEhF,QAAQ;QACP,OAAO;YACN,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,GAAG,gCAAiB,CAAC,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC;SACxD,CAAC;IACH,CAAC;IAED,eAAe,CAAC,CAA4B,EAAE,eAA2B,MAAM;QAC9E,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,YAAY,CAAC;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED,KAAK;QAEJ,MAAM,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAChE,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;IACvD,CAAC;CACD;AApBD,gCAoBC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LoggerBundleLevelStrategy } from "../../nest-logger.params";
|
|
2
2
|
import { PinoLevels } from "../context/logger.definitions";
|
|
3
3
|
export interface LoggerNode {
|
|
4
4
|
toObject(): any;
|
|
5
|
-
introspectLevel(_:
|
|
5
|
+
introspectLevel(_: LoggerBundleLevelStrategy, defaultLevel: string): PinoLevels;
|
|
6
6
|
clone(parent?: LoggerNode): LoggerNode;
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare class
|
|
1
|
+
export declare class LoggerBundleModule {
|
|
2
2
|
}
|
|
@@ -6,17 +6,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.LoggerBundleModule = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const async_logger_context_service_1 = require("./context/async-logger-context.service");
|
|
12
12
|
const logger_bundle_service_1 = require("./logger-bundle.service");
|
|
13
|
-
let
|
|
13
|
+
let LoggerBundleModule = class LoggerBundleModule {
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
LoggerBundleModule = __decorate([
|
|
16
16
|
(0, common_1.Module)({
|
|
17
|
-
providers: [async_logger_context_service_1.
|
|
18
|
-
exports: [async_logger_context_service_1.
|
|
17
|
+
providers: [async_logger_context_service_1.BundleAsyncLoggerContext, logger_bundle_service_1.LoggerBundle],
|
|
18
|
+
exports: [async_logger_context_service_1.BundleAsyncLoggerContext, logger_bundle_service_1.LoggerBundle],
|
|
19
19
|
})
|
|
20
|
-
],
|
|
21
|
-
exports.
|
|
20
|
+
], LoggerBundleModule);
|
|
21
|
+
exports.LoggerBundleModule = LoggerBundleModule;
|
|
22
22
|
//# sourceMappingURL=logger-bundle.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger-bundle.module.js","sourceRoot":"","sources":["../../../lib/src/bundle/logger-bundle.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"logger-bundle.module.js","sourceRoot":"","sources":["../../../lib/src/bundle/logger-bundle.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,yFAAkF;AAClF,mEAAuD;AAMvD,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;CAAG,CAAA;AAArB,kBAAkB;IAJ9B,IAAA,eAAM,EAAC;QACP,SAAS,EAAE,CAAC,uDAAwB,EAAE,oCAAY,CAAC;QACnD,OAAO,EAAE,CAAC,uDAAwB,EAAE,oCAAY,CAAC;KACjD,CAAC;GACW,kBAAkB,CAAG;AAArB,gDAAkB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LoggerBundleParams } from '../nest-logger.params';
|
|
2
2
|
import pino from 'pino';
|
|
3
3
|
export interface LoggerBindingsContext {
|
|
4
4
|
method?: string;
|
|
@@ -21,15 +21,15 @@ export declare class LoggableBundleObject {
|
|
|
21
21
|
object: any;
|
|
22
22
|
level: string;
|
|
23
23
|
}
|
|
24
|
-
export declare class
|
|
24
|
+
export declare class LoggerBundle {
|
|
25
25
|
private params;
|
|
26
26
|
private expired;
|
|
27
27
|
private currentBranch;
|
|
28
28
|
private bindings;
|
|
29
|
-
constructor(params:
|
|
29
|
+
constructor(params: LoggerBundleParams);
|
|
30
30
|
setContext(context: LoggerBindingsContext): void;
|
|
31
31
|
putTag(tag: string, value: string): void;
|
|
32
|
-
copyFrom(otherBundle:
|
|
32
|
+
copyFrom(otherBundle: LoggerBundle): void;
|
|
33
33
|
enter(branchName: string): void;
|
|
34
34
|
log(level: pino.Level, msg: string, ...args: any[]): void;
|
|
35
35
|
log(level: pino.Level, obj: unknown, msg?: string, ...args: any[]): void;
|
|
@@ -12,7 +12,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.LoggerBundle = exports.LoggableBundleObject = void 0;
|
|
16
16
|
const common_1 = require("@nestjs/common");
|
|
17
17
|
const nest_logger_params_1 = require("../nest-logger.params");
|
|
18
18
|
const nest_logger_module_definition_1 = require("../nest-logger.module-definition");
|
|
@@ -20,7 +20,7 @@ const logger_branch_1 = require("./logger-branch/logger-branch");
|
|
|
20
20
|
class LoggableBundleObject {
|
|
21
21
|
}
|
|
22
22
|
exports.LoggableBundleObject = LoggableBundleObject;
|
|
23
|
-
let
|
|
23
|
+
let LoggerBundle = class LoggerBundle {
|
|
24
24
|
constructor(params) {
|
|
25
25
|
this.params = params;
|
|
26
26
|
this.expired = false;
|
|
@@ -83,7 +83,7 @@ let NestLoggerBundle = class NestLoggerBundle {
|
|
|
83
83
|
logs: this.currentBranch.toObject(),
|
|
84
84
|
...bindings,
|
|
85
85
|
};
|
|
86
|
-
const level = this.currentBranch.introspectLevel(((_c = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.contextBundle) === null || _b === void 0 ? void 0 : _b.strategy) === null || _c === void 0 ? void 0 : _c.level) || nest_logger_params_1.
|
|
86
|
+
const level = this.currentBranch.introspectLevel(((_c = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.contextBundle) === null || _b === void 0 ? void 0 : _b.strategy) === null || _c === void 0 ? void 0 : _c.level) || nest_logger_params_1.LoggerBundleLevelStrategy.MAJOR_LEVEL, ((_e = (_d = this.params) === null || _d === void 0 ? void 0 : _d.contextBundle) === null || _e === void 0 ? void 0 : _e.defaultLevel) || 'info');
|
|
87
87
|
return {
|
|
88
88
|
object,
|
|
89
89
|
level,
|
|
@@ -96,12 +96,12 @@ let NestLoggerBundle = class NestLoggerBundle {
|
|
|
96
96
|
return this.expired;
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
|
|
99
|
+
LoggerBundle = __decorate([
|
|
100
100
|
(0, common_1.Injectable)({
|
|
101
101
|
scope: common_1.Scope.REQUEST,
|
|
102
102
|
}),
|
|
103
103
|
__param(0, (0, common_1.Inject)(nest_logger_module_definition_1.MODULE_OPTIONS_TOKEN)),
|
|
104
104
|
__metadata("design:paramtypes", [Object])
|
|
105
|
-
],
|
|
106
|
-
exports.
|
|
105
|
+
], LoggerBundle);
|
|
106
|
+
exports.LoggerBundle = LoggerBundle;
|
|
107
107
|
//# sourceMappingURL=logger-bundle.service.js.map
|