@globalart/nestjs-logger 1.0.10 → 1.0.11
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.mts +240 -0
- package/dist/index.d.ts +240 -8
- package/dist/index.js +8144 -37
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +8113 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +9 -8
- package/dist/constants/index.d.ts +0 -27
- package/dist/constants/index.js +0 -44
- package/dist/contracts/index.d.ts +0 -25
- package/dist/contracts/index.js +0 -2
- package/dist/core/http-logger.interceptor.d.ts +0 -28
- package/dist/core/http-logger.interceptor.js +0 -319
- package/dist/core/logger.di-tokens.d.ts +0 -3
- package/dist/core/logger.di-tokens.js +0 -27
- package/dist/core/logger.module.d.ts +0 -23
- package/dist/core/logger.module.js +0 -139
- package/dist/core/logger.service.d.ts +0 -19
- package/dist/core/logger.service.js +0 -60
- package/dist/decorators/index.d.ts +0 -13
- package/dist/decorators/index.js +0 -20
- package/dist/factories/dynamic-context-logger.factory.d.ts +0 -14
- package/dist/factories/dynamic-context-logger.factory.js +0 -52
- package/dist/factories/formatter.factory.d.ts +0 -5
- package/dist/factories/formatter.factory.js +0 -31
- package/dist/formatters/base-formatter.d.ts +0 -14
- package/dist/formatters/base-formatter.js +0 -43
- package/dist/formatters/json-formatter.d.ts +0 -8
- package/dist/formatters/json-formatter.js +0 -48
- package/dist/formatters/pino-formatter.d.ts +0 -6
- package/dist/formatters/pino-formatter.js +0 -26
- package/dist/formatters/text-formatter.d.ts +0 -14
- package/dist/formatters/text-formatter.js +0 -67
- package/dist/types/index.d.ts +0 -90
- package/dist/types/index.js +0 -19
- package/dist/utils/context-resolver.d.ts +0 -7
- package/dist/utils/context-resolver.js +0 -66
- package/dist/utils/data-sanitizer.d.ts +0 -9
- package/dist/utils/data-sanitizer.js +0 -56
- package/dist/utils/request-id-generator.d.ts +0 -8
- package/dist/utils/request-id-generator.js +0 -34
- package/dist/writers/console-writer.d.ts +0 -4
- package/dist/writers/console-writer.js +0 -19
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import * as _nestjs_common0 from "@nestjs/common";
|
|
2
|
+
import { CallHandler, DynamicModule, ExecutionContext, LoggerService as LoggerService$1, NestInterceptor, RequestMethod } from "@nestjs/common";
|
|
3
|
+
import { Reflector } from "@nestjs/core";
|
|
4
|
+
import { Observable } from "rxjs";
|
|
5
|
+
|
|
6
|
+
//#region src/types/index.d.ts
|
|
7
|
+
type LogLevel = "error" | "warn" | "info" | "debug" | "verbose";
|
|
8
|
+
type LogFormat = "json" | "text" | "pino";
|
|
9
|
+
declare const LOG_LEVELS: Record<LogLevel, number>;
|
|
10
|
+
declare const PINO_LEVELS: Record<number, string>;
|
|
11
|
+
interface LogEntry {
|
|
12
|
+
readonly level: LogLevel;
|
|
13
|
+
readonly message: string;
|
|
14
|
+
readonly timestamp: Date;
|
|
15
|
+
readonly context?: string;
|
|
16
|
+
readonly metadata?: Record<string, unknown>;
|
|
17
|
+
readonly trace?: string;
|
|
18
|
+
}
|
|
19
|
+
interface LogOptions {
|
|
20
|
+
message: any;
|
|
21
|
+
context?: string;
|
|
22
|
+
metadata?: any;
|
|
23
|
+
trace?: string;
|
|
24
|
+
}
|
|
25
|
+
interface HttpRequest {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly method: string;
|
|
28
|
+
readonly url: string;
|
|
29
|
+
readonly query: Record<string, unknown>;
|
|
30
|
+
readonly params: Record<string, unknown>;
|
|
31
|
+
readonly headers: Record<string, string>;
|
|
32
|
+
readonly remoteAddress: string;
|
|
33
|
+
readonly remotePort?: number;
|
|
34
|
+
readonly body?: unknown;
|
|
35
|
+
}
|
|
36
|
+
interface HttpResponse {
|
|
37
|
+
readonly statusCode: number;
|
|
38
|
+
readonly headers: Record<string, string>;
|
|
39
|
+
}
|
|
40
|
+
interface HttpRequestLogEntry {
|
|
41
|
+
readonly level: number;
|
|
42
|
+
readonly time: number;
|
|
43
|
+
readonly pid: number;
|
|
44
|
+
readonly hostname: string;
|
|
45
|
+
readonly req: HttpRequest;
|
|
46
|
+
readonly res: HttpResponse;
|
|
47
|
+
readonly responseTime: number;
|
|
48
|
+
readonly msg: string;
|
|
49
|
+
}
|
|
50
|
+
interface ExcludeOption {
|
|
51
|
+
method: RequestMethod;
|
|
52
|
+
path: string;
|
|
53
|
+
}
|
|
54
|
+
interface LoggerConfiguration {
|
|
55
|
+
readonly level: LogLevel;
|
|
56
|
+
readonly timestamp: boolean;
|
|
57
|
+
readonly colors: boolean;
|
|
58
|
+
readonly context?: string;
|
|
59
|
+
readonly format: LogFormat;
|
|
60
|
+
readonly sensitiveFields: readonly string[];
|
|
61
|
+
readonly exclude: readonly ExcludeOption[];
|
|
62
|
+
}
|
|
63
|
+
interface FormatterOptions {
|
|
64
|
+
readonly colors: boolean;
|
|
65
|
+
readonly timestamp: boolean;
|
|
66
|
+
readonly context?: string;
|
|
67
|
+
}
|
|
68
|
+
interface LoggerOptions {
|
|
69
|
+
level?: LogLevel;
|
|
70
|
+
timestamp?: boolean;
|
|
71
|
+
colors?: boolean;
|
|
72
|
+
context?: string;
|
|
73
|
+
format?: LogFormat;
|
|
74
|
+
transports?: LoggerTransport[];
|
|
75
|
+
pino?: PinoOptions;
|
|
76
|
+
}
|
|
77
|
+
interface PinoOptions {
|
|
78
|
+
level?: string;
|
|
79
|
+
timestamp?: boolean;
|
|
80
|
+
base?: boolean;
|
|
81
|
+
name?: string;
|
|
82
|
+
enabled?: boolean;
|
|
83
|
+
}
|
|
84
|
+
interface LoggerTransport {
|
|
85
|
+
name: string;
|
|
86
|
+
level?: string;
|
|
87
|
+
format?: unknown;
|
|
88
|
+
filename?: string;
|
|
89
|
+
dirname?: string;
|
|
90
|
+
maxsize?: number;
|
|
91
|
+
maxFiles?: number;
|
|
92
|
+
}
|
|
93
|
+
interface LoggerMetadata {
|
|
94
|
+
[key: string]: unknown;
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/contracts/index.d.ts
|
|
98
|
+
interface ILogger {
|
|
99
|
+
log(options: LogOptions): void;
|
|
100
|
+
error(options: LogOptions): void;
|
|
101
|
+
warn(options: LogOptions): void;
|
|
102
|
+
debug(options: LogOptions): void;
|
|
103
|
+
verbose(options: LogOptions): void;
|
|
104
|
+
logHttpRequest(entry: HttpRequestLogEntry): void;
|
|
105
|
+
}
|
|
106
|
+
interface ILogFormatter {
|
|
107
|
+
format(entry: LogEntry): string;
|
|
108
|
+
formatHttpRequest(entry: HttpRequestLogEntry): string;
|
|
109
|
+
}
|
|
110
|
+
interface ILogWriter {
|
|
111
|
+
write(formattedLog: string): void;
|
|
112
|
+
}
|
|
113
|
+
interface IContextResolver {
|
|
114
|
+
resolve(): string;
|
|
115
|
+
}
|
|
116
|
+
interface IDataSanitizer {
|
|
117
|
+
sanitize(data: unknown): unknown;
|
|
118
|
+
}
|
|
119
|
+
interface IRequestIdGenerator {
|
|
120
|
+
generate(): string;
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/core/logger.service.d.ts
|
|
124
|
+
declare class LoggerService implements LoggerService$1, ILogger {
|
|
125
|
+
private readonly config;
|
|
126
|
+
private readonly formatter;
|
|
127
|
+
private readonly writer;
|
|
128
|
+
private readonly contextResolver;
|
|
129
|
+
private context?;
|
|
130
|
+
constructor(config: LoggerConfiguration, formatter: ILogFormatter, writer: ILogWriter, contextResolver: IContextResolver);
|
|
131
|
+
setContext(context: string): void;
|
|
132
|
+
log(options: LogOptions): void;
|
|
133
|
+
error(options: LogOptions): void;
|
|
134
|
+
warn(options: LogOptions): void;
|
|
135
|
+
debug(options: LogOptions): void;
|
|
136
|
+
verbose(options: LogOptions): void;
|
|
137
|
+
logHttpRequest(entry: HttpRequestLogEntry): void;
|
|
138
|
+
private writeLog;
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/core/http-logger.interceptor.d.ts
|
|
142
|
+
declare class HttpLoggerInterceptor implements NestInterceptor {
|
|
143
|
+
private readonly logger;
|
|
144
|
+
private readonly dataSanitizer;
|
|
145
|
+
private readonly requestIdGenerator;
|
|
146
|
+
private readonly config;
|
|
147
|
+
private readonly reflector;
|
|
148
|
+
private readonly hostname;
|
|
149
|
+
private readonly pid;
|
|
150
|
+
constructor(logger: LoggerService, dataSanitizer: IDataSanitizer, requestIdGenerator: IRequestIdGenerator, config: LoggerConfiguration, reflector: Reflector);
|
|
151
|
+
intercept(context: ExecutionContext, next: CallHandler): Observable<unknown>;
|
|
152
|
+
private handleGraphQLRequest;
|
|
153
|
+
private createHttpLogEntry;
|
|
154
|
+
private createLogEntry;
|
|
155
|
+
private getClientIp;
|
|
156
|
+
private sanitizeHeaders;
|
|
157
|
+
private getRequestMethod;
|
|
158
|
+
private shouldExcludeRequest;
|
|
159
|
+
private sanitizeGraphQLArgs;
|
|
160
|
+
private getGraphQLResultSize;
|
|
161
|
+
private extractErrorMessage;
|
|
162
|
+
private extractErrorTrace;
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/core/logger.di-tokens.d.ts
|
|
166
|
+
declare const InjectLogger: (context?: string) => PropertyDecorator & ParameterDecorator;
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/core/logger.module.d.ts
|
|
169
|
+
interface LoggerModuleOptions {
|
|
170
|
+
level?: "error" | "warn" | "info" | "debug" | "verbose";
|
|
171
|
+
timestamp?: boolean;
|
|
172
|
+
colors?: boolean;
|
|
173
|
+
context?: string;
|
|
174
|
+
format?: "json" | "text" | "pino";
|
|
175
|
+
sensitiveFields?: string[];
|
|
176
|
+
exclude?: ExcludeOption[];
|
|
177
|
+
}
|
|
178
|
+
interface LoggerModuleAsyncOptions {
|
|
179
|
+
useFactory: (...args: any[]) => LoggerModuleOptions | Promise<LoggerModuleOptions>;
|
|
180
|
+
inject?: any[];
|
|
181
|
+
}
|
|
182
|
+
declare class LoggerModule {
|
|
183
|
+
static forRoot(options?: LoggerModuleOptions): DynamicModule;
|
|
184
|
+
static forRootAsync(options: LoggerModuleAsyncOptions): DynamicModule;
|
|
185
|
+
private static createConfiguration;
|
|
186
|
+
private static createProviders;
|
|
187
|
+
private static createCoreProviders;
|
|
188
|
+
private static createDynamicContextProviders;
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/utils/context-resolver.d.ts
|
|
192
|
+
declare class ContextResolver implements IContextResolver {
|
|
193
|
+
resolve(): string;
|
|
194
|
+
private shouldSkipLine;
|
|
195
|
+
private extractClassName;
|
|
196
|
+
private isValidClassName;
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/writers/console-writer.d.ts
|
|
200
|
+
declare class ConsoleWriter implements ILogWriter {
|
|
201
|
+
write(formattedLog: string): void;
|
|
202
|
+
}
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/factories/formatter.factory.d.ts
|
|
205
|
+
declare class FormatterFactory {
|
|
206
|
+
create(format: LogFormat, options: FormatterOptions): ILogFormatter;
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/factories/dynamic-context-logger.factory.d.ts
|
|
210
|
+
declare class DynamicContextLoggerFactory {
|
|
211
|
+
private readonly config;
|
|
212
|
+
private readonly formatterFactory;
|
|
213
|
+
private readonly writer;
|
|
214
|
+
private readonly contextResolver;
|
|
215
|
+
private readonly loggerCache;
|
|
216
|
+
constructor(config: LoggerConfiguration, formatterFactory: FormatterFactory, writer: ConsoleWriter, contextResolver: ContextResolver);
|
|
217
|
+
createLogger(context: string): LoggerService;
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/constants/index.d.ts
|
|
221
|
+
declare const LOGGER_CONTEXT_METADATA: unique symbol;
|
|
222
|
+
declare const LOGGER_METADATA_METADATA: unique symbol;
|
|
223
|
+
declare const LOGGER_EXCLUDE_METADATA: unique symbol;
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/decorators/index.d.ts
|
|
226
|
+
/**
|
|
227
|
+
* Decorator to set logging context for a class or method
|
|
228
|
+
*/
|
|
229
|
+
declare const LogContext: (context: string) => _nestjs_common0.CustomDecorator<typeof LOGGER_CONTEXT_METADATA>;
|
|
230
|
+
/**
|
|
231
|
+
* Decorator to add metadata to logs
|
|
232
|
+
*/
|
|
233
|
+
declare const LogMetadata: (metadata: Record<string, unknown>) => _nestjs_common0.CustomDecorator<typeof LOGGER_METADATA_METADATA>;
|
|
234
|
+
/**
|
|
235
|
+
* Decorator to exclude logging for a controller or method
|
|
236
|
+
*/
|
|
237
|
+
declare const ExcludeLogging: () => _nestjs_common0.CustomDecorator<typeof LOGGER_EXCLUDE_METADATA>;
|
|
238
|
+
//#endregion
|
|
239
|
+
export { DynamicContextLoggerFactory, ExcludeLogging, ExcludeOption, FormatterOptions, HttpLoggerInterceptor, HttpRequest, HttpRequestLogEntry, HttpResponse, IContextResolver, IDataSanitizer, ILogFormatter, ILogWriter, ILogger, IRequestIdGenerator, InjectLogger, LOG_LEVELS, LogContext, LogEntry, LogFormat, LogLevel, LogMetadata, LogOptions, LoggerConfiguration, LoggerMetadata, LoggerModule, type LoggerModuleAsyncOptions, type LoggerModuleOptions, LoggerOptions, LoggerService, LoggerTransport, PINO_LEVELS, PinoOptions };
|
|
240
|
+
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,240 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import * as _nestjs_common0 from "@nestjs/common";
|
|
2
|
+
import { CallHandler, DynamicModule, ExecutionContext, LoggerService as LoggerService$1, NestInterceptor, RequestMethod } from "@nestjs/common";
|
|
3
|
+
import { Reflector } from "@nestjs/core";
|
|
4
|
+
import { Observable } from "rxjs";
|
|
5
|
+
|
|
6
|
+
//#region src/types/index.d.ts
|
|
7
|
+
type LogLevel = "error" | "warn" | "info" | "debug" | "verbose";
|
|
8
|
+
type LogFormat = "json" | "text" | "pino";
|
|
9
|
+
declare const LOG_LEVELS: Record<LogLevel, number>;
|
|
10
|
+
declare const PINO_LEVELS: Record<number, string>;
|
|
11
|
+
interface LogEntry {
|
|
12
|
+
readonly level: LogLevel;
|
|
13
|
+
readonly message: string;
|
|
14
|
+
readonly timestamp: Date;
|
|
15
|
+
readonly context?: string;
|
|
16
|
+
readonly metadata?: Record<string, unknown>;
|
|
17
|
+
readonly trace?: string;
|
|
18
|
+
}
|
|
19
|
+
interface LogOptions {
|
|
20
|
+
message: any;
|
|
21
|
+
context?: string;
|
|
22
|
+
metadata?: any;
|
|
23
|
+
trace?: string;
|
|
24
|
+
}
|
|
25
|
+
interface HttpRequest {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly method: string;
|
|
28
|
+
readonly url: string;
|
|
29
|
+
readonly query: Record<string, unknown>;
|
|
30
|
+
readonly params: Record<string, unknown>;
|
|
31
|
+
readonly headers: Record<string, string>;
|
|
32
|
+
readonly remoteAddress: string;
|
|
33
|
+
readonly remotePort?: number;
|
|
34
|
+
readonly body?: unknown;
|
|
35
|
+
}
|
|
36
|
+
interface HttpResponse {
|
|
37
|
+
readonly statusCode: number;
|
|
38
|
+
readonly headers: Record<string, string>;
|
|
39
|
+
}
|
|
40
|
+
interface HttpRequestLogEntry {
|
|
41
|
+
readonly level: number;
|
|
42
|
+
readonly time: number;
|
|
43
|
+
readonly pid: number;
|
|
44
|
+
readonly hostname: string;
|
|
45
|
+
readonly req: HttpRequest;
|
|
46
|
+
readonly res: HttpResponse;
|
|
47
|
+
readonly responseTime: number;
|
|
48
|
+
readonly msg: string;
|
|
49
|
+
}
|
|
50
|
+
interface ExcludeOption {
|
|
51
|
+
method: RequestMethod;
|
|
52
|
+
path: string;
|
|
53
|
+
}
|
|
54
|
+
interface LoggerConfiguration {
|
|
55
|
+
readonly level: LogLevel;
|
|
56
|
+
readonly timestamp: boolean;
|
|
57
|
+
readonly colors: boolean;
|
|
58
|
+
readonly context?: string;
|
|
59
|
+
readonly format: LogFormat;
|
|
60
|
+
readonly sensitiveFields: readonly string[];
|
|
61
|
+
readonly exclude: readonly ExcludeOption[];
|
|
62
|
+
}
|
|
63
|
+
interface FormatterOptions {
|
|
64
|
+
readonly colors: boolean;
|
|
65
|
+
readonly timestamp: boolean;
|
|
66
|
+
readonly context?: string;
|
|
67
|
+
}
|
|
68
|
+
interface LoggerOptions {
|
|
69
|
+
level?: LogLevel;
|
|
70
|
+
timestamp?: boolean;
|
|
71
|
+
colors?: boolean;
|
|
72
|
+
context?: string;
|
|
73
|
+
format?: LogFormat;
|
|
74
|
+
transports?: LoggerTransport[];
|
|
75
|
+
pino?: PinoOptions;
|
|
76
|
+
}
|
|
77
|
+
interface PinoOptions {
|
|
78
|
+
level?: string;
|
|
79
|
+
timestamp?: boolean;
|
|
80
|
+
base?: boolean;
|
|
81
|
+
name?: string;
|
|
82
|
+
enabled?: boolean;
|
|
83
|
+
}
|
|
84
|
+
interface LoggerTransport {
|
|
85
|
+
name: string;
|
|
86
|
+
level?: string;
|
|
87
|
+
format?: unknown;
|
|
88
|
+
filename?: string;
|
|
89
|
+
dirname?: string;
|
|
90
|
+
maxsize?: number;
|
|
91
|
+
maxFiles?: number;
|
|
92
|
+
}
|
|
93
|
+
interface LoggerMetadata {
|
|
94
|
+
[key: string]: unknown;
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/contracts/index.d.ts
|
|
98
|
+
interface ILogger {
|
|
99
|
+
log(options: LogOptions): void;
|
|
100
|
+
error(options: LogOptions): void;
|
|
101
|
+
warn(options: LogOptions): void;
|
|
102
|
+
debug(options: LogOptions): void;
|
|
103
|
+
verbose(options: LogOptions): void;
|
|
104
|
+
logHttpRequest(entry: HttpRequestLogEntry): void;
|
|
105
|
+
}
|
|
106
|
+
interface ILogFormatter {
|
|
107
|
+
format(entry: LogEntry): string;
|
|
108
|
+
formatHttpRequest(entry: HttpRequestLogEntry): string;
|
|
109
|
+
}
|
|
110
|
+
interface ILogWriter {
|
|
111
|
+
write(formattedLog: string): void;
|
|
112
|
+
}
|
|
113
|
+
interface IContextResolver {
|
|
114
|
+
resolve(): string;
|
|
115
|
+
}
|
|
116
|
+
interface IDataSanitizer {
|
|
117
|
+
sanitize(data: unknown): unknown;
|
|
118
|
+
}
|
|
119
|
+
interface IRequestIdGenerator {
|
|
120
|
+
generate(): string;
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/core/logger.service.d.ts
|
|
124
|
+
declare class LoggerService implements LoggerService$1, ILogger {
|
|
125
|
+
private readonly config;
|
|
126
|
+
private readonly formatter;
|
|
127
|
+
private readonly writer;
|
|
128
|
+
private readonly contextResolver;
|
|
129
|
+
private context?;
|
|
130
|
+
constructor(config: LoggerConfiguration, formatter: ILogFormatter, writer: ILogWriter, contextResolver: IContextResolver);
|
|
131
|
+
setContext(context: string): void;
|
|
132
|
+
log(options: LogOptions): void;
|
|
133
|
+
error(options: LogOptions): void;
|
|
134
|
+
warn(options: LogOptions): void;
|
|
135
|
+
debug(options: LogOptions): void;
|
|
136
|
+
verbose(options: LogOptions): void;
|
|
137
|
+
logHttpRequest(entry: HttpRequestLogEntry): void;
|
|
138
|
+
private writeLog;
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/core/http-logger.interceptor.d.ts
|
|
142
|
+
declare class HttpLoggerInterceptor implements NestInterceptor {
|
|
143
|
+
private readonly logger;
|
|
144
|
+
private readonly dataSanitizer;
|
|
145
|
+
private readonly requestIdGenerator;
|
|
146
|
+
private readonly config;
|
|
147
|
+
private readonly reflector;
|
|
148
|
+
private readonly hostname;
|
|
149
|
+
private readonly pid;
|
|
150
|
+
constructor(logger: LoggerService, dataSanitizer: IDataSanitizer, requestIdGenerator: IRequestIdGenerator, config: LoggerConfiguration, reflector: Reflector);
|
|
151
|
+
intercept(context: ExecutionContext, next: CallHandler): Observable<unknown>;
|
|
152
|
+
private handleGraphQLRequest;
|
|
153
|
+
private createHttpLogEntry;
|
|
154
|
+
private createLogEntry;
|
|
155
|
+
private getClientIp;
|
|
156
|
+
private sanitizeHeaders;
|
|
157
|
+
private getRequestMethod;
|
|
158
|
+
private shouldExcludeRequest;
|
|
159
|
+
private sanitizeGraphQLArgs;
|
|
160
|
+
private getGraphQLResultSize;
|
|
161
|
+
private extractErrorMessage;
|
|
162
|
+
private extractErrorTrace;
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/core/logger.di-tokens.d.ts
|
|
166
|
+
declare const InjectLogger: (context?: string) => PropertyDecorator & ParameterDecorator;
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/core/logger.module.d.ts
|
|
169
|
+
interface LoggerModuleOptions {
|
|
170
|
+
level?: "error" | "warn" | "info" | "debug" | "verbose";
|
|
171
|
+
timestamp?: boolean;
|
|
172
|
+
colors?: boolean;
|
|
173
|
+
context?: string;
|
|
174
|
+
format?: "json" | "text" | "pino";
|
|
175
|
+
sensitiveFields?: string[];
|
|
176
|
+
exclude?: ExcludeOption[];
|
|
177
|
+
}
|
|
178
|
+
interface LoggerModuleAsyncOptions {
|
|
179
|
+
useFactory: (...args: any[]) => LoggerModuleOptions | Promise<LoggerModuleOptions>;
|
|
180
|
+
inject?: any[];
|
|
181
|
+
}
|
|
182
|
+
declare class LoggerModule {
|
|
183
|
+
static forRoot(options?: LoggerModuleOptions): DynamicModule;
|
|
184
|
+
static forRootAsync(options: LoggerModuleAsyncOptions): DynamicModule;
|
|
185
|
+
private static createConfiguration;
|
|
186
|
+
private static createProviders;
|
|
187
|
+
private static createCoreProviders;
|
|
188
|
+
private static createDynamicContextProviders;
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/utils/context-resolver.d.ts
|
|
192
|
+
declare class ContextResolver implements IContextResolver {
|
|
193
|
+
resolve(): string;
|
|
194
|
+
private shouldSkipLine;
|
|
195
|
+
private extractClassName;
|
|
196
|
+
private isValidClassName;
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/writers/console-writer.d.ts
|
|
200
|
+
declare class ConsoleWriter implements ILogWriter {
|
|
201
|
+
write(formattedLog: string): void;
|
|
202
|
+
}
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/factories/formatter.factory.d.ts
|
|
205
|
+
declare class FormatterFactory {
|
|
206
|
+
create(format: LogFormat, options: FormatterOptions): ILogFormatter;
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/factories/dynamic-context-logger.factory.d.ts
|
|
210
|
+
declare class DynamicContextLoggerFactory {
|
|
211
|
+
private readonly config;
|
|
212
|
+
private readonly formatterFactory;
|
|
213
|
+
private readonly writer;
|
|
214
|
+
private readonly contextResolver;
|
|
215
|
+
private readonly loggerCache;
|
|
216
|
+
constructor(config: LoggerConfiguration, formatterFactory: FormatterFactory, writer: ConsoleWriter, contextResolver: ContextResolver);
|
|
217
|
+
createLogger(context: string): LoggerService;
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/constants/index.d.ts
|
|
221
|
+
declare const LOGGER_CONTEXT_METADATA: unique symbol;
|
|
222
|
+
declare const LOGGER_METADATA_METADATA: unique symbol;
|
|
223
|
+
declare const LOGGER_EXCLUDE_METADATA: unique symbol;
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/decorators/index.d.ts
|
|
226
|
+
/**
|
|
227
|
+
* Decorator to set logging context for a class or method
|
|
228
|
+
*/
|
|
229
|
+
declare const LogContext: (context: string) => _nestjs_common0.CustomDecorator<typeof LOGGER_CONTEXT_METADATA>;
|
|
230
|
+
/**
|
|
231
|
+
* Decorator to add metadata to logs
|
|
232
|
+
*/
|
|
233
|
+
declare const LogMetadata: (metadata: Record<string, unknown>) => _nestjs_common0.CustomDecorator<typeof LOGGER_METADATA_METADATA>;
|
|
234
|
+
/**
|
|
235
|
+
* Decorator to exclude logging for a controller or method
|
|
236
|
+
*/
|
|
237
|
+
declare const ExcludeLogging: () => _nestjs_common0.CustomDecorator<typeof LOGGER_EXCLUDE_METADATA>;
|
|
238
|
+
//#endregion
|
|
239
|
+
export { DynamicContextLoggerFactory, ExcludeLogging, ExcludeOption, FormatterOptions, HttpLoggerInterceptor, HttpRequest, HttpRequestLogEntry, HttpResponse, IContextResolver, IDataSanitizer, ILogFormatter, ILogWriter, ILogger, IRequestIdGenerator, InjectLogger, LOG_LEVELS, LogContext, LogEntry, LogFormat, LogLevel, LogMetadata, LogOptions, LoggerConfiguration, LoggerMetadata, LoggerModule, type LoggerModuleAsyncOptions, type LoggerModuleOptions, LoggerOptions, LoggerService, LoggerTransport, PINO_LEVELS, PinoOptions };
|
|
240
|
+
//# sourceMappingURL=index.d.ts.map
|