xcally-nest-library 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/modules/logger/pino/logger.module.d.ts +1 -0
- package/dist/src/modules/logger/pino/logger.module.js +23 -0
- package/dist/src/modules/logger/pino/logger.module.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -1
- package/src/modules/logger/pino/logger.module.ts +38 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "xcally-nest-library",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.18",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -39,11 +39,13 @@
|
|
39
39
|
"class-transformer": "^0.5.1",
|
40
40
|
"class-validator": "^0.14.1",
|
41
41
|
"datadog-winston": "^1.6.0",
|
42
|
+
"dotenv": "^16.4.5",
|
42
43
|
"nest-winston": "^1.9.4",
|
43
44
|
"nestjs-grpc-exceptions": "^0.2.2",
|
44
45
|
"nestjs-paginate": "^8.6.2",
|
45
46
|
"nestjs-pino": "^4.1.0",
|
46
47
|
"pino": "^9.4.0",
|
48
|
+
"pino-opentelemetry-transport": "^1.0.1",
|
47
49
|
"pino-pretty": "^11.2.2",
|
48
50
|
"reflect-metadata": "^0.2.2",
|
49
51
|
"rxjs": "^7.8.1",
|
@@ -2,7 +2,40 @@ import { DynamicModule, Global, Module } from '@nestjs/common';
|
|
2
2
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
3
3
|
import { LoggerModule as LoggerModulePino } from 'nestjs-pino';
|
4
4
|
import { LoggerService } from './logger.service';
|
5
|
-
|
5
|
+
import 'dotenv/config';
|
6
|
+
import type { Options } from 'pino-opentelemetry-transport';
|
7
|
+
const options: Options = {
|
8
|
+
resourceAttributes: {
|
9
|
+
'service.name': process.env.npm_package_name || 'unknown',
|
10
|
+
// 'service.version': process.env.npm_package_version || '1.0.0',
|
11
|
+
},
|
12
|
+
logRecordProcessorOptions: [
|
13
|
+
{
|
14
|
+
recordProcessorType: 'batch',
|
15
|
+
exporterOptions: {
|
16
|
+
protocol: 'http',
|
17
|
+
httpExporterOptions: {
|
18
|
+
url: new URL('v1/logs', process.env.OTLP_HTTP_URL || 'http://localhost:4318/').toString(),
|
19
|
+
},
|
20
|
+
},
|
21
|
+
},
|
22
|
+
// {
|
23
|
+
// recordProcessorType: 'batch',
|
24
|
+
// exporterOptions: {
|
25
|
+
// protocol: 'grpc',
|
26
|
+
// grpcExporterOptions: {
|
27
|
+
// headers: { foo: 'some custom header' },
|
28
|
+
// },
|
29
|
+
// },
|
30
|
+
// },
|
31
|
+
// {
|
32
|
+
// recordProcessorType: 'simple',
|
33
|
+
// exporterOptions: { protocol: 'console' },
|
34
|
+
// },
|
35
|
+
],
|
36
|
+
loggerName: (process.env.npm_package_name || 'unknown') + '-logger',
|
37
|
+
serviceVersion: process.env.npm_package_version || 'unknown',
|
38
|
+
};
|
6
39
|
@Global()
|
7
40
|
@Module({})
|
8
41
|
export class LoggerModule {
|
@@ -35,6 +68,10 @@ export class LoggerModule {
|
|
35
68
|
},
|
36
69
|
transport: {
|
37
70
|
targets: [
|
71
|
+
{
|
72
|
+
target: 'pino-opentelemetry-transport',
|
73
|
+
options,
|
74
|
+
},
|
38
75
|
{
|
39
76
|
level: 'debug',
|
40
77
|
target: 'pino-pretty',
|