xcally-nest-library 0.0.16 → 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 +25 -1
- 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 +40 -2
@@ -12,6 +12,25 @@ const common_1 = require("@nestjs/common");
|
|
12
12
|
const config_1 = require("@nestjs/config");
|
13
13
|
const nestjs_pino_1 = require("nestjs-pino");
|
14
14
|
const logger_service_1 = require("./logger.service");
|
15
|
+
require("dotenv/config");
|
16
|
+
const options = {
|
17
|
+
resourceAttributes: {
|
18
|
+
'service.name': process.env.npm_package_name || 'unknown',
|
19
|
+
},
|
20
|
+
logRecordProcessorOptions: [
|
21
|
+
{
|
22
|
+
recordProcessorType: 'batch',
|
23
|
+
exporterOptions: {
|
24
|
+
protocol: 'http',
|
25
|
+
httpExporterOptions: {
|
26
|
+
url: new URL('v1/logs', process.env.OTLP_HTTP_URL || 'http://localhost:4318/').toString(),
|
27
|
+
},
|
28
|
+
},
|
29
|
+
},
|
30
|
+
],
|
31
|
+
loggerName: (process.env.npm_package_name || 'unknown') + '-logger',
|
32
|
+
serviceVersion: process.env.npm_package_version || 'unknown',
|
33
|
+
};
|
15
34
|
let LoggerModule = LoggerModule_1 = class LoggerModule {
|
16
35
|
static forRoot() {
|
17
36
|
return {
|
@@ -23,6 +42,7 @@ let LoggerModule = LoggerModule_1 = class LoggerModule {
|
|
23
42
|
imports: [config_1.ConfigModule],
|
24
43
|
inject: [config_1.ConfigService],
|
25
44
|
useFactory: async (config) => {
|
45
|
+
const projectName = process.env.npm_package_name || 'default_project';
|
26
46
|
return {
|
27
47
|
pinoHttp: {
|
28
48
|
level: config.get('LOG_LEVEL') || 'info',
|
@@ -31,6 +51,10 @@ let LoggerModule = LoggerModule_1 = class LoggerModule {
|
|
31
51
|
},
|
32
52
|
transport: {
|
33
53
|
targets: [
|
54
|
+
{
|
55
|
+
target: 'pino-opentelemetry-transport',
|
56
|
+
options,
|
57
|
+
},
|
34
58
|
{
|
35
59
|
level: 'debug',
|
36
60
|
target: 'pino-pretty',
|
@@ -42,7 +66,7 @@ let LoggerModule = LoggerModule_1 = class LoggerModule {
|
|
42
66
|
level: 'info',
|
43
67
|
target: 'pino/file',
|
44
68
|
options: {
|
45
|
-
destination:
|
69
|
+
destination: `./logs/${projectName}-info.log`,
|
46
70
|
mkdir: true,
|
47
71
|
append: process.env.NODE_ENV !== 'production' ? false : true,
|
48
72
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"logger.module.js","sourceRoot":"","sources":["../../../../../src/modules/logger/pino/logger.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA+D;AAC/D,2CAA6D;AAC7D,6CAA+D;AAC/D,qDAAiD;
|
1
|
+
{"version":3,"file":"logger.module.js","sourceRoot":"","sources":["../../../../../src/modules/logger/pino/logger.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA+D;AAC/D,2CAA6D;AAC7D,6CAA+D;AAC/D,qDAAiD;AACjD,yBAAuB;AAEvB,MAAM,OAAO,GAAY;IACvB,kBAAkB,EAAE;QAClB,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,SAAS;KAE1D;IACD,yBAAyB,EAAE;QACzB;YACE,mBAAmB,EAAE,OAAO;YAC5B,eAAe,EAAE;gBACf,QAAQ,EAAE,MAAM;gBAChB,mBAAmB,EAAE;oBACnB,GAAG,EAAE,IAAI,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,wBAAwB,CAAC,CAAC,QAAQ,EAAE;iBAC1F;aACF;SACF;KAcF;IACD,UAAU,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,SAAS,CAAC,GAAG,SAAS;IACnE,cAAc,EAAE,OAAO,CAAC,GAAG,CAA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