nestjs-log-decorator 1.3.0 → 1.4.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/dist/index.cjs +11 -7
- package/dist/index.d.cts +3 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -67,35 +67,39 @@ var LogWrapper = class {
|
|
|
67
67
|
this.method = method;
|
|
68
68
|
this.args = args;
|
|
69
69
|
}
|
|
70
|
-
invoked() {
|
|
70
|
+
invoked(message) {
|
|
71
71
|
this.logger.log({
|
|
72
72
|
method: this.method,
|
|
73
73
|
state: "invoked",
|
|
74
|
-
args: this.args
|
|
74
|
+
args: this.args,
|
|
75
|
+
...message ? { message } : {}
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
|
-
success() {
|
|
78
|
+
success(message) {
|
|
78
79
|
this.logger.log({
|
|
79
80
|
method: this.method,
|
|
80
81
|
state: "success",
|
|
81
|
-
args: this.args
|
|
82
|
+
args: this.args,
|
|
83
|
+
...message ? { message } : {}
|
|
82
84
|
});
|
|
83
85
|
}
|
|
84
|
-
error(error) {
|
|
86
|
+
error(error, message) {
|
|
85
87
|
try {
|
|
86
88
|
const pretifiedError = prettifyAxiosError(error);
|
|
87
89
|
this.logger.error({
|
|
88
90
|
method: this.method,
|
|
89
91
|
state: "error",
|
|
90
92
|
args: this.args,
|
|
91
|
-
error: pretifiedError
|
|
93
|
+
error: pretifiedError,
|
|
94
|
+
...message ? { message } : {}
|
|
92
95
|
});
|
|
93
96
|
} catch {
|
|
94
97
|
this.logger.error({
|
|
95
98
|
method: this.method,
|
|
96
99
|
state: "error",
|
|
97
100
|
args: this.args,
|
|
98
|
-
error
|
|
101
|
+
error,
|
|
102
|
+
...message ? { message } : {}
|
|
99
103
|
});
|
|
100
104
|
}
|
|
101
105
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -45,9 +45,9 @@ declare class LogWrapper {
|
|
|
45
45
|
private readonly method;
|
|
46
46
|
private readonly args;
|
|
47
47
|
constructor(logger: Logger, method: string, args: string | number | Record<string, unknown> | undefined);
|
|
48
|
-
invoked(): void;
|
|
49
|
-
success(): void;
|
|
50
|
-
error(error: unknown): void;
|
|
48
|
+
invoked(message?: string): void;
|
|
49
|
+
success(message?: string): void;
|
|
50
|
+
error(error: unknown, message?: string): void;
|
|
51
51
|
}
|
|
52
52
|
/** If you see it, then you probably forgot to add `readonly logger = new Logger(YourClass.name)` to your class */
|
|
53
53
|
interface Loggable {
|
package/package.json
CHANGED