@rxap/nest-sentry 9.0.3-dev.1 → 9.0.3-dev.3
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 +22 -0
- package/package.json +1 -1
- package/src/lib/sentry.logger.d.ts +10 -6
- package/src/lib/sentry.logger.js +100 -22
- package/src/lib/sentry.logger.js.map +1 -1
- package/src/lib/sentry.module.d.ts +3 -2
- package/src/lib/sentry.module.js +10 -2
- package/src/lib/sentry.module.js.map +1 -1
- package/src/lib/tokens.d.ts +1 -0
- package/src/lib/tokens.js +2 -1
- package/src/lib/tokens.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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
|
+
## [9.0.3-dev.3](https://gitlab.com/rxap/nest/compare/@rxap/nest-sentry@9.0.3-dev.2...@rxap/nest-sentry@9.0.3-dev.3) (2023-04-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **logger:** mirror the ConsoleLogger implementation ([4ce7f2a](https://gitlab.com/rxap/nest/commit/4ce7f2a144d1e1ab3f0b3e6f858c928cc0482587))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [9.0.3-dev.2](https://gitlab.com/rxap/nest/compare/@rxap/nest-sentry@9.0.3-dev.1...@rxap/nest-sentry@9.0.3-dev.2) (2023-04-04)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **logger:** split options into sentry and console ([21e8b59](https://gitlab.com/rxap/nest/commit/21e8b5991b0b30bb30bfc4d11d7b703c2a26904b))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [9.0.3-dev.1](https://gitlab.com/rxap/nest/compare/@rxap/nest-sentry@9.0.3-dev.0...@rxap/nest-sentry@9.0.3-dev.1) (2023-03-13)
|
|
7
29
|
|
|
8
30
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { ConsoleLogger } from '@nestjs/common';
|
|
2
2
|
import { SentryModuleOptions } from './sentry.interfaces';
|
|
3
|
+
import { ConsoleLoggerOptions } from '@nestjs/common/services/console-logger.service';
|
|
3
4
|
export declare class SentryLogger extends ConsoleLogger {
|
|
4
|
-
protected readonly options:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
protected readonly options: ConsoleLoggerOptions;
|
|
6
|
+
private readonly sentryOptions;
|
|
7
|
+
constructor(options: ConsoleLoggerOptions, sentryOptions: SentryModuleOptions);
|
|
8
|
+
log(message: string, ...optionalParams: any[]): void;
|
|
9
|
+
error(message: string, ...optionalParams: any[]): void;
|
|
10
|
+
warn(message: string, ...optionalParams: any[]): void;
|
|
11
|
+
debug(message: string, ...optionalParams: any[]): void;
|
|
12
|
+
private _getContextAndMessagesToPrint;
|
|
13
|
+
private _getContextAndStackAndMessagesToPrint;
|
|
10
14
|
}
|
package/src/lib/sentry.logger.js
CHANGED
|
@@ -5,17 +5,29 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const common_1 = require("@nestjs/common");
|
|
6
6
|
const Sentry = require("@sentry/node");
|
|
7
7
|
const tokens_1 = require("./tokens");
|
|
8
|
+
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
|
|
8
9
|
let SentryLogger = class SentryLogger extends common_1.ConsoleLogger {
|
|
9
|
-
constructor(options) {
|
|
10
|
+
constructor(options, sentryOptions) {
|
|
10
11
|
super();
|
|
11
12
|
this.options = options;
|
|
13
|
+
this.sentryOptions = sentryOptions;
|
|
12
14
|
}
|
|
13
|
-
log(message,
|
|
14
|
-
|
|
15
|
-
if (
|
|
15
|
+
log(message, ...optionalParams) {
|
|
16
|
+
let asBreadcrumb = false;
|
|
17
|
+
if (optionalParams.length) {
|
|
18
|
+
if (typeof optionalParams[optionalParams.length - 1] === 'boolean') {
|
|
19
|
+
asBreadcrumb = optionalParams.pop();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const { context } = this._getContextAndMessagesToPrint([
|
|
23
|
+
message,
|
|
24
|
+
...optionalParams,
|
|
25
|
+
]);
|
|
26
|
+
super.log(message, ...optionalParams);
|
|
27
|
+
if (!this.sentryOptions.dsn) {
|
|
16
28
|
return;
|
|
17
29
|
}
|
|
18
|
-
if (this.
|
|
30
|
+
if (this.sentryOptions.logLevels && !this.sentryOptions.logLevels.includes('log')) {
|
|
19
31
|
return;
|
|
20
32
|
}
|
|
21
33
|
try {
|
|
@@ -29,33 +41,51 @@ let SentryLogger = class SentryLogger extends common_1.ConsoleLogger {
|
|
|
29
41
|
}) :
|
|
30
42
|
Sentry.captureMessage(message, {
|
|
31
43
|
level: 'log',
|
|
44
|
+
extra: { context },
|
|
32
45
|
});
|
|
33
46
|
}
|
|
34
47
|
catch (err) {
|
|
35
48
|
console.error('Failed to capture message with sentry: ' + err.message);
|
|
36
49
|
}
|
|
37
50
|
}
|
|
38
|
-
error(message,
|
|
39
|
-
|
|
40
|
-
|
|
51
|
+
error(message, ...optionalParams) {
|
|
52
|
+
const { context, stack } = this._getContextAndStackAndMessagesToPrint([
|
|
53
|
+
message,
|
|
54
|
+
...optionalParams,
|
|
55
|
+
]);
|
|
56
|
+
super.error(message, ...optionalParams);
|
|
57
|
+
if (!this.sentryOptions.dsn) {
|
|
41
58
|
return;
|
|
42
59
|
}
|
|
43
|
-
if (this.
|
|
60
|
+
if (this.sentryOptions.logLevels && !this.sentryOptions.logLevels.includes('error')) {
|
|
44
61
|
return;
|
|
45
62
|
}
|
|
46
63
|
try {
|
|
47
|
-
Sentry.captureMessage(message, {
|
|
64
|
+
Sentry.captureMessage(message, {
|
|
65
|
+
level: 'error',
|
|
66
|
+
extra: { context, stack },
|
|
67
|
+
});
|
|
48
68
|
}
|
|
49
69
|
catch (err) {
|
|
50
70
|
console.error('Failed to capture message with sentry: ' + err.message);
|
|
51
71
|
}
|
|
52
72
|
}
|
|
53
|
-
warn(message,
|
|
54
|
-
|
|
55
|
-
if (
|
|
73
|
+
warn(message, ...optionalParams) {
|
|
74
|
+
let asBreadcrumb = false;
|
|
75
|
+
if (optionalParams.length) {
|
|
76
|
+
if (typeof optionalParams[optionalParams.length - 1] === 'boolean') {
|
|
77
|
+
asBreadcrumb = optionalParams.pop();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const { context } = this._getContextAndMessagesToPrint([
|
|
81
|
+
message,
|
|
82
|
+
...optionalParams,
|
|
83
|
+
]);
|
|
84
|
+
super.warn(message, ...optionalParams);
|
|
85
|
+
if (!this.sentryOptions.dsn) {
|
|
56
86
|
return;
|
|
57
87
|
}
|
|
58
|
-
if (this.
|
|
88
|
+
if (this.sentryOptions.logLevels && !this.sentryOptions.logLevels.includes('warn')) {
|
|
59
89
|
return;
|
|
60
90
|
}
|
|
61
91
|
try {
|
|
@@ -67,18 +97,31 @@ let SentryLogger = class SentryLogger extends common_1.ConsoleLogger {
|
|
|
67
97
|
context
|
|
68
98
|
}
|
|
69
99
|
}) :
|
|
70
|
-
Sentry.captureMessage(message, {
|
|
100
|
+
Sentry.captureMessage(message, {
|
|
101
|
+
level: 'warning',
|
|
102
|
+
extra: { context },
|
|
103
|
+
});
|
|
71
104
|
}
|
|
72
105
|
catch (err) {
|
|
73
106
|
console.error('Failed to capture message with sentry: ' + err.message);
|
|
74
107
|
}
|
|
75
108
|
}
|
|
76
|
-
debug(message,
|
|
77
|
-
|
|
78
|
-
if (
|
|
109
|
+
debug(message, ...optionalParams) {
|
|
110
|
+
let asBreadcrumb = false;
|
|
111
|
+
if (optionalParams.length) {
|
|
112
|
+
if (typeof optionalParams[optionalParams.length - 1] === 'boolean') {
|
|
113
|
+
asBreadcrumb = optionalParams.pop();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const { context } = this._getContextAndMessagesToPrint([
|
|
117
|
+
message,
|
|
118
|
+
...optionalParams,
|
|
119
|
+
]);
|
|
120
|
+
super.debug(message, ...optionalParams);
|
|
121
|
+
if (!this.sentryOptions.dsn) {
|
|
79
122
|
return;
|
|
80
123
|
}
|
|
81
|
-
if (this.
|
|
124
|
+
if (this.sentryOptions.logLevels && !this.sentryOptions.logLevels.includes('debug')) {
|
|
82
125
|
return;
|
|
83
126
|
}
|
|
84
127
|
try {
|
|
@@ -90,17 +133,52 @@ let SentryLogger = class SentryLogger extends common_1.ConsoleLogger {
|
|
|
90
133
|
context
|
|
91
134
|
}
|
|
92
135
|
}) :
|
|
93
|
-
Sentry.captureMessage(message, {
|
|
136
|
+
Sentry.captureMessage(message, {
|
|
137
|
+
level: 'debug',
|
|
138
|
+
extra: { context },
|
|
139
|
+
});
|
|
94
140
|
}
|
|
95
141
|
catch (err) {
|
|
96
142
|
console.error('Failed to capture message with sentry: ' + err.message);
|
|
97
143
|
}
|
|
98
144
|
}
|
|
145
|
+
_getContextAndMessagesToPrint(args) {
|
|
146
|
+
if ((args === null || args === void 0 ? void 0 : args.length) <= 1) {
|
|
147
|
+
return { messages: args, context: this.context };
|
|
148
|
+
}
|
|
149
|
+
const lastElement = args[args.length - 1];
|
|
150
|
+
const isContext = (0, shared_utils_1.isString)(lastElement);
|
|
151
|
+
if (!isContext) {
|
|
152
|
+
return { messages: args, context: this.context };
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
context: lastElement,
|
|
156
|
+
messages: args.slice(0, args.length - 1),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
_getContextAndStackAndMessagesToPrint(args) {
|
|
160
|
+
const { messages, context } = this._getContextAndMessagesToPrint(args);
|
|
161
|
+
if ((messages === null || messages === void 0 ? void 0 : messages.length) <= 1) {
|
|
162
|
+
return { messages, context };
|
|
163
|
+
}
|
|
164
|
+
const lastElement = messages[messages.length - 1];
|
|
165
|
+
const isStack = (0, shared_utils_1.isString)(lastElement);
|
|
166
|
+
// https://github.com/nestjs/nest/issues/11074#issuecomment-1421680060
|
|
167
|
+
if (!isStack && !(0, shared_utils_1.isUndefined)(lastElement)) {
|
|
168
|
+
return { messages, context };
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
stack: lastElement,
|
|
172
|
+
messages: messages.slice(0, messages.length - 1),
|
|
173
|
+
context,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
99
176
|
};
|
|
100
177
|
SentryLogger = tslib_1.__decorate([
|
|
101
178
|
(0, common_1.Injectable)(),
|
|
102
|
-
tslib_1.__param(0, (0, common_1.Inject)(tokens_1.
|
|
103
|
-
tslib_1.
|
|
179
|
+
tslib_1.__param(0, (0, common_1.Inject)(tokens_1.CONSOLE_LOGGER_OPTIONS)),
|
|
180
|
+
tslib_1.__param(1, (0, common_1.Inject)(tokens_1.SENTRY_MODULE_OPTIONS)),
|
|
181
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object])
|
|
104
182
|
], SentryLogger);
|
|
105
183
|
exports.SentryLogger = SentryLogger;
|
|
106
184
|
//# sourceMappingURL=sentry.logger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.logger.js","sourceRoot":"","sources":["../../../../../libs/sentry/src/lib/sentry.logger.ts"],"names":[],"mappings":";;;;AAAA,2CAAmE;AACnE,uCAAuC;AAEvC,
|
|
1
|
+
{"version":3,"file":"sentry.logger.js","sourceRoot":"","sources":["../../../../../libs/sentry/src/lib/sentry.logger.ts"],"names":[],"mappings":";;;;AAAA,2CAAmE;AACnE,uCAAuC;AAEvC,qCAAyE;AAEzE,oEAA0E;AAGnE,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,sBAAa;IAE7C,YAE8B,OAA6B,EAExC,aAAkC;QAEnD,KAAK,EAAE,CAAC;QAJoB,YAAO,GAAP,OAAO,CAAsB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AC,CAAC;QACtC,sEAAsE;QACtE,IAAI,CAAC,OAAO,IAAI,CAAC,IAAA,0BAAW,EAAC,WAAW,CAAC,EAAE;YACzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;SAC9B;QACD,OAAO;YACL,KAAK,EAAE,WAAqB;YAC5B,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;YAChD,OAAO;SACR,CAAC;IACJ,CAAC;CAEF,CAAA;AA9KY,YAAY;IADxB,IAAA,mBAAU,GAAE;IAIR,mBAAA,IAAA,eAAM,EAAC,+BAAsB,CAAC,CAAA;IAE9B,mBAAA,IAAA,eAAM,EAAC,8BAAqB,CAAC,CAAA;;GALrB,YAAY,CA8KxB;AA9KY,oCAAY"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { DynamicModule } from '@nestjs/common';
|
|
2
2
|
import { SentryModuleAsyncOptions, SentryModuleOptions } from './sentry.interfaces';
|
|
3
|
+
import { ConsoleLoggerOptions } from '@nestjs/common/services/console-logger.service';
|
|
3
4
|
export declare class SentryModule {
|
|
4
|
-
static forRoot(options: SentryModuleOptions): DynamicModule;
|
|
5
|
-
static forRootAsync(options: SentryModuleAsyncOptions): DynamicModule;
|
|
5
|
+
static forRoot(options: SentryModuleOptions, { timestamp, logLevels }?: ConsoleLoggerOptions): DynamicModule;
|
|
6
|
+
static forRootAsync(options: SentryModuleAsyncOptions, { timestamp, logLevels }?: ConsoleLoggerOptions): DynamicModule;
|
|
6
7
|
private static createAsyncProviders;
|
|
7
8
|
private static createAsyncOptionsProvider;
|
|
8
9
|
}
|
package/src/lib/sentry.module.js
CHANGED
|
@@ -8,7 +8,7 @@ const tokens_1 = require("./tokens");
|
|
|
8
8
|
const sentry_logger_1 = require("./sentry.logger");
|
|
9
9
|
const sentry_service_1 = require("./sentry.service");
|
|
10
10
|
let SentryModule = SentryModule_1 = class SentryModule {
|
|
11
|
-
static forRoot(options) {
|
|
11
|
+
static forRoot(options, { timestamp, logLevels } = {}) {
|
|
12
12
|
return {
|
|
13
13
|
exports: [sentry_service_1.SentryService],
|
|
14
14
|
module: SentryModule_1,
|
|
@@ -17,16 +17,24 @@ let SentryModule = SentryModule_1 = class SentryModule {
|
|
|
17
17
|
provide: tokens_1.SENTRY_MODULE_OPTIONS,
|
|
18
18
|
useValue: options,
|
|
19
19
|
},
|
|
20
|
+
{
|
|
21
|
+
provide: tokens_1.CONSOLE_LOGGER_OPTIONS,
|
|
22
|
+
useValue: { timestamp: timestamp !== null && timestamp !== void 0 ? timestamp : true, logLevels: logLevels !== null && logLevels !== void 0 ? logLevels : ['log', 'error', 'warn'] },
|
|
23
|
+
}
|
|
20
24
|
],
|
|
21
25
|
};
|
|
22
26
|
}
|
|
23
|
-
static forRootAsync(options) {
|
|
27
|
+
static forRootAsync(options, { timestamp, logLevels } = {}) {
|
|
24
28
|
return {
|
|
25
29
|
exports: [sentry_service_1.SentryService],
|
|
26
30
|
imports: options.imports,
|
|
27
31
|
module: SentryModule_1,
|
|
28
32
|
providers: [
|
|
29
33
|
...this.createAsyncProviders(options),
|
|
34
|
+
{
|
|
35
|
+
provide: tokens_1.CONSOLE_LOGGER_OPTIONS,
|
|
36
|
+
useValue: { timestamp: timestamp !== null && timestamp !== void 0 ? timestamp : true, logLevels: logLevels !== null && logLevels !== void 0 ? logLevels : ['log', 'error', 'warn'] },
|
|
37
|
+
}
|
|
30
38
|
],
|
|
31
39
|
};
|
|
32
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.module.js","sourceRoot":"","sources":["../../../../../libs/sentry/src/lib/sentry.module.ts"],"names":[],"mappings":";;;;;AAAA,2CAA+E;AAC/E,
|
|
1
|
+
{"version":3,"file":"sentry.module.js","sourceRoot":"","sources":["../../../../../libs/sentry/src/lib/sentry.module.ts"],"names":[],"mappings":";;;;;AAAA,2CAA+E;AAC/E,qCAAyE;AAEzE,mDA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CAAC;SACnD;QACD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAsC,CAAC;QAChE,OAAO;YACL,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC;YACxC;gBACE,OAAO,EAAE,QAAQ;gBACjB,QAAQ;aACT;SACF,CAAC;IACJ,CAAC;IAEO,MAAM,CAAC,0BAA0B,CACvC,OAAiC;QAEjC,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,OAAO;gBACL,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;gBAC5B,OAAO,EAAE,8BAAqB;gBAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC;SACH;QACD,MAAM,MAAM,GAAG;YACb,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,WAAW,CAA+B;SACxE,CAAC;QACF,OAAO;YACL,OAAO,EAAE,8BAAqB;YAC9B,UAAU,EAAE,CAAO,cAAoC,EAAE,EAAE,wDACzD,OAAA,MAAM,cAAc,CAAC,yBAAyB,EAAE,CAAA,GAAA;YAClD,MAAM;SACP,CAAC;IACJ,CAAC;CAEF,CAAA;AA5EY,YAAY;IALxB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAE,4BAAY,EAAE,8BAAa,CAAE;QAC1C,OAAO,EAAE,CAAE,4BAAY,EAAE,8BAAa,CAAE;KACzC,CAAC;GACW,YAAY,CA4ExB;AA5EY,oCAAY"}
|
package/src/lib/tokens.d.ts
CHANGED
package/src/lib/tokens.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SENTRY_INTERCEPTOR_OPTIONS = exports.SENTRY_MODULE_OPTIONS = void 0;
|
|
3
|
+
exports.CONSOLE_LOGGER_OPTIONS = exports.SENTRY_INTERCEPTOR_OPTIONS = exports.SENTRY_MODULE_OPTIONS = void 0;
|
|
4
4
|
exports.SENTRY_MODULE_OPTIONS = Symbol('SentryModuleOptions');
|
|
5
5
|
exports.SENTRY_INTERCEPTOR_OPTIONS = Symbol('SENTRY_INTERCEPTOR_OPTIONS');
|
|
6
|
+
exports.CONSOLE_LOGGER_OPTIONS = Symbol('CONSOLE_LOGGER_OPTIONS');
|
|
6
7
|
//# sourceMappingURL=tokens.js.map
|
package/src/lib/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../../libs/sentry/src/lib/tokens.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACtD,QAAA,0BAA0B,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../../libs/sentry/src/lib/tokens.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACtD,QAAA,0BAA0B,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAA;AACjE,QAAA,sBAAsB,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC"}
|