@globalart/nestjs-logger 1.0.5 → 1.0.6
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/constants/index.d.ts +5 -4
- package/dist/constants/index.js +6 -5
- package/dist/core/logger.di-tokens.d.ts +1 -0
- package/dist/core/logger.di-tokens.js +7 -0
- package/dist/core/logger.module.js +4 -4
- package/dist/decorators/index.d.ts +4 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export declare const LOGGER_CONFIG_TOKEN
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
1
|
+
export declare const LOGGER_CONFIG_TOKEN: unique symbol;
|
|
2
|
+
export declare const LOGGER_SERVICE_TOKEN: unique symbol;
|
|
3
|
+
export declare const LOGGER_CONTEXT_METADATA: unique symbol;
|
|
4
|
+
export declare const LOGGER_METADATA_METADATA: unique symbol;
|
|
5
|
+
export declare const LOGGER_EXCLUDE_METADATA: unique symbol;
|
|
5
6
|
export declare const DEFAULT_SENSITIVE_FIELDS: readonly ["password", "pass", "token", "accessToken", "refreshToken", "secret", "key", "apiKey", "authorization", "auth", "credential", "credentials"];
|
|
6
7
|
export declare const COLORS: {
|
|
7
8
|
readonly reset: "\u001B[0m";
|
package/dist/constants/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_LOGGER_CONFIG = exports.COLORS = exports.DEFAULT_SENSITIVE_FIELDS = exports.LOGGER_EXCLUDE_METADATA = exports.LOGGER_METADATA_METADATA = exports.LOGGER_CONTEXT_METADATA = exports.LOGGER_CONFIG_TOKEN = void 0;
|
|
4
|
-
exports.LOGGER_CONFIG_TOKEN = "LOGGER_CONFIG";
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
3
|
+
exports.DEFAULT_LOGGER_CONFIG = exports.COLORS = exports.DEFAULT_SENSITIVE_FIELDS = exports.LOGGER_EXCLUDE_METADATA = exports.LOGGER_METADATA_METADATA = exports.LOGGER_CONTEXT_METADATA = exports.LOGGER_SERVICE_TOKEN = exports.LOGGER_CONFIG_TOKEN = void 0;
|
|
4
|
+
exports.LOGGER_CONFIG_TOKEN = Symbol("LOGGER_CONFIG");
|
|
5
|
+
exports.LOGGER_SERVICE_TOKEN = Symbol("LOGGER_SERVICE");
|
|
6
|
+
exports.LOGGER_CONTEXT_METADATA = Symbol("LOGGER_CONTEXT");
|
|
7
|
+
exports.LOGGER_METADATA_METADATA = Symbol("LOGGER_METADATA");
|
|
8
|
+
exports.LOGGER_EXCLUDE_METADATA = Symbol("LOGGER_EXCLUDE");
|
|
8
9
|
exports.DEFAULT_SENSITIVE_FIELDS = [
|
|
9
10
|
"password",
|
|
10
11
|
"pass",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const InjectLogger: () => PropertyDecorator & ParameterDecorator;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InjectLogger = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const InjectLogger = () => (0, common_1.Inject)(constants_1.LOGGER_SERVICE_TOKEN);
|
|
7
|
+
exports.InjectLogger = InjectLogger;
|
|
@@ -25,7 +25,7 @@ let LoggerModule = LoggerModule_1 = class LoggerModule {
|
|
|
25
25
|
return {
|
|
26
26
|
module: LoggerModule_1,
|
|
27
27
|
providers,
|
|
28
|
-
exports: [
|
|
28
|
+
exports: [constants_1.LOGGER_SERVICE_TOKEN, http_logger_interceptor_1.HttpLoggerInterceptor],
|
|
29
29
|
global: true,
|
|
30
30
|
};
|
|
31
31
|
}
|
|
@@ -42,7 +42,7 @@ let LoggerModule = LoggerModule_1 = class LoggerModule {
|
|
|
42
42
|
return {
|
|
43
43
|
module: LoggerModule_1,
|
|
44
44
|
providers,
|
|
45
|
-
exports: [
|
|
45
|
+
exports: [constants_1.LOGGER_SERVICE_TOKEN, http_logger_interceptor_1.HttpLoggerInterceptor],
|
|
46
46
|
global: true,
|
|
47
47
|
};
|
|
48
48
|
}
|
|
@@ -75,7 +75,7 @@ let LoggerModule = LoggerModule_1 = class LoggerModule {
|
|
|
75
75
|
inject: [constants_1.LOGGER_CONFIG_TOKEN],
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
|
-
provide:
|
|
78
|
+
provide: constants_1.LOGGER_SERVICE_TOKEN,
|
|
79
79
|
useFactory: (config, formatterFactory, writer, contextResolver) => {
|
|
80
80
|
const formatter = formatterFactory.create(config.format, {
|
|
81
81
|
colors: config.colors,
|
|
@@ -98,7 +98,7 @@ let LoggerModule = LoggerModule_1 = class LoggerModule {
|
|
|
98
98
|
return new http_logger_interceptor_1.HttpLoggerInterceptor(logger, dataSanitizer, requestIdGenerator, config, reflector);
|
|
99
99
|
},
|
|
100
100
|
inject: [
|
|
101
|
-
|
|
101
|
+
constants_1.LOGGER_SERVICE_TOKEN,
|
|
102
102
|
data_sanitizer_1.DataSanitizer,
|
|
103
103
|
request_id_generator_1.RequestIdGenerator,
|
|
104
104
|
constants_1.LOGGER_CONFIG_TOKEN,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { LOGGER_CONTEXT_METADATA, LOGGER_METADATA_METADATA, LOGGER_EXCLUDE_METADATA } from "../constants";
|
|
1
2
|
/**
|
|
2
3
|
* Decorator to set logging context for a class or method
|
|
3
4
|
*/
|
|
4
|
-
export declare const LogContext: (context: string) => import("@nestjs/common").CustomDecorator<
|
|
5
|
+
export declare const LogContext: (context: string) => import("@nestjs/common").CustomDecorator<typeof LOGGER_CONTEXT_METADATA>;
|
|
5
6
|
/**
|
|
6
7
|
* Decorator to add metadata to logs
|
|
7
8
|
*/
|
|
8
|
-
export declare const LogMetadata: (metadata: Record<string, unknown>) => import("@nestjs/common").CustomDecorator<
|
|
9
|
+
export declare const LogMetadata: (metadata: Record<string, unknown>) => import("@nestjs/common").CustomDecorator<typeof LOGGER_METADATA_METADATA>;
|
|
9
10
|
/**
|
|
10
11
|
* Decorator to exclude logging for a controller or method
|
|
11
12
|
*/
|
|
12
|
-
export declare const ExcludeLogging: () => import("@nestjs/common").CustomDecorator<
|
|
13
|
+
export declare const ExcludeLogging: () => import("@nestjs/common").CustomDecorator<typeof LOGGER_EXCLUDE_METADATA>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { LoggerModule, LoggerModuleOptions, LoggerModuleAsyncOptions, } from "./core/logger.module";
|
|
2
|
+
export { InjectLogger } from "./core/logger.di-tokens";
|
|
2
3
|
export { LoggerService } from "./core/logger.service";
|
|
3
4
|
export { HttpLoggerInterceptor } from "./core/http-logger.interceptor";
|
|
4
5
|
export { LogContext, LogMetadata, ExcludeLogging } from "./decorators";
|
package/dist/index.js
CHANGED
|
@@ -14,10 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ExcludeLogging = exports.LogMetadata = exports.LogContext = exports.HttpLoggerInterceptor = exports.LoggerService = exports.LoggerModule = void 0;
|
|
17
|
+
exports.ExcludeLogging = exports.LogMetadata = exports.LogContext = exports.HttpLoggerInterceptor = exports.LoggerService = exports.InjectLogger = exports.LoggerModule = void 0;
|
|
18
18
|
// Core
|
|
19
19
|
var logger_module_1 = require("./core/logger.module");
|
|
20
20
|
Object.defineProperty(exports, "LoggerModule", { enumerable: true, get: function () { return logger_module_1.LoggerModule; } });
|
|
21
|
+
var logger_di_tokens_1 = require("./core/logger.di-tokens");
|
|
22
|
+
Object.defineProperty(exports, "InjectLogger", { enumerable: true, get: function () { return logger_di_tokens_1.InjectLogger; } });
|
|
21
23
|
var logger_service_1 = require("./core/logger.service");
|
|
22
24
|
Object.defineProperty(exports, "LoggerService", { enumerable: true, get: function () { return logger_service_1.LoggerService; } });
|
|
23
25
|
var http_logger_interceptor_1 = require("./core/http-logger.interceptor");
|