@adatechnology/logger 0.0.7 → 0.0.9
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.d.ts +29 -2
- package/dist/index.js +9409 -152
- package/package.json +1 -1
- package/src/index.ts +4 -1
- package/src/interceptors/exclude-http-logging.decorator.ts +6 -0
- package/src/interceptors/http-logging.interceptor.constant.ts +5 -0
- package/src/interceptors/http-logging.interceptor.ts +110 -0
- package/src/logger.config.ts +6 -0
- package/src/logger.module.ts +22 -6
- package/src/logger.token.ts +2 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _nestjs_common from '@nestjs/common';
|
|
2
|
+
import { DynamicModule, NestMiddleware, NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
|
|
2
3
|
import { LoggerOptions } from 'winston';
|
|
4
|
+
import { Reflector } from '@nestjs/core';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
3
6
|
|
|
4
7
|
interface ObfuscatorKey {
|
|
5
8
|
key: string;
|
|
@@ -68,10 +71,17 @@ interface LoggerConfig extends WinstonModuleConfig {
|
|
|
68
71
|
* Versão da biblioteca/módulo que está gerando o log
|
|
69
72
|
*/
|
|
70
73
|
libVersion?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Rotas excluídas do HttpLoggingInterceptor (ex.: ['/health'])
|
|
76
|
+
* Suporta prefixo exato ou parcial via startsWith
|
|
77
|
+
*/
|
|
78
|
+
interceptorExcludedPaths?: string[];
|
|
71
79
|
}
|
|
72
80
|
declare const DEFAULT_LOGGER_CONFIG: LoggerConfig;
|
|
73
81
|
|
|
74
82
|
declare const LOGGER_PROVIDER = "LOGGER_PROVIDER";
|
|
83
|
+
declare const LOGGER_CONFIG = "LOGGER_CONFIG";
|
|
84
|
+
declare const HTTP_LOGGING_INTERCEPTOR = "HTTP_LOGGING_INTERCEPTOR";
|
|
75
85
|
|
|
76
86
|
declare class LoggerModule {
|
|
77
87
|
static forRoot(config?: LoggerConfig): DynamicModule;
|
|
@@ -95,9 +105,26 @@ declare class RequestContextMiddleware implements NestMiddleware {
|
|
|
95
105
|
use(req: RequestLike, _res: ResponseLike, next: NextFunctionLike): void;
|
|
96
106
|
}
|
|
97
107
|
|
|
108
|
+
declare class HttpLoggingInterceptor implements NestInterceptor {
|
|
109
|
+
private readonly logger;
|
|
110
|
+
private readonly reflector;
|
|
111
|
+
private readonly excludedPaths;
|
|
112
|
+
constructor(logger: LoggerProviderInterface, reflector: Reflector, config?: LoggerConfig);
|
|
113
|
+
private isExcluded;
|
|
114
|
+
intercept(context: ExecutionContext, next: CallHandler): Observable<unknown>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
declare const HTTP_LOGGING_INTERCEPTOR_CONTEXT: {
|
|
118
|
+
readonly INTERCEPT: "HttpLoggingInterceptor.intercept";
|
|
119
|
+
readonly ON_RESPONSE: "HttpLoggingInterceptor.onResponse";
|
|
120
|
+
readonly ON_ERROR: "HttpLoggingInterceptor.onError";
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
declare const ExcludeHttpLogging: () => _nestjs_common.CustomDecorator<string>;
|
|
124
|
+
|
|
98
125
|
type RequestContext = Record<string, unknown> | undefined;
|
|
99
126
|
|
|
100
127
|
declare function getContext(): RequestContext;
|
|
101
128
|
declare function runWithContext<T>(ctx: Record<string, unknown>, fn: () => T): T;
|
|
102
129
|
|
|
103
|
-
export { DEFAULT_LOGGER_CONFIG, LOGGER_PROVIDER, type LogPayload, type LoggerConfig, LoggerLevel, LoggerModule, type LoggerProviderInterface, RequestContextMiddleware, getContext, runWithContext };
|
|
130
|
+
export { DEFAULT_LOGGER_CONFIG, ExcludeHttpLogging, HTTP_LOGGING_INTERCEPTOR, HTTP_LOGGING_INTERCEPTOR_CONTEXT, HttpLoggingInterceptor, LOGGER_CONFIG, LOGGER_PROVIDER, type LogPayload, type LoggerConfig, LoggerLevel, LoggerModule, type LoggerProviderInterface, RequestContextMiddleware, getContext, runWithContext };
|