Skip to content

Commit

Permalink
feat(logging): create LoggingInterceptorOptions interface
Browse files Browse the repository at this point in the history
LoggingInterceptorOptions interface is used to configure the logging
interceptor.
  • Loading branch information
amarlankri committed Dec 7, 2023
1 parent 924f1ef commit 61d4dd8
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion packages/logging-interceptor/src/logging.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@ import { tap } from 'rxjs/operators';
import { parse, stringify } from 'flatted';
import { LogOptions, METHOD_LOG_METADATA } from './log.decorator';

/**
* Logging interceptor options
*/
export interface LoggingInterceptorOptions {
/**
* User prefix to add to the logs
*/
userPrefix?: string;
/**
* Disable masking
*/
disableMasking?: boolean;
/**
* Masking placeholder
*/
maskingPlaceholder?: string;
}

/**
* Interceptor that logs input/output requests
*/
Expand All @@ -25,7 +43,7 @@ export class LoggingInterceptor implements NestInterceptor {
private disableMasking: boolean;
private maskingPlaceholder: string | undefined;

constructor(@Optional() options?: { userPrefix?: string; disableMasking?: boolean; maskingPlaceholder?: string }) {
constructor(@Optional() options?: LoggingInterceptorOptions) {
this.userPrefix = options?.userPrefix ?? '';
this.disableMasking = options?.disableMasking ?? false;
this.maskingPlaceholder = options?.maskingPlaceholder ?? '****';
Expand Down

0 comments on commit 61d4dd8

Please sign in to comment.