-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(interceptor): creates set up for http/ws/rpc logging
Creates interfaces and services that should handle the logic for the HTTP, WS, and RPC logging. This is a broken build and it is expected for CI to f ail. re #7 #8 #9
- Loading branch information
Showing
11 changed files
with
151 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { OGMA_INTERCEPTOR_SKIP } from '../ogma.constants'; | ||
|
||
export function OgmaSkip() { | ||
return ( | ||
target: object, | ||
key?: string | symbol, | ||
descriptor?: TypedPropertyDescriptor<any>, | ||
) => { | ||
if (descriptor) { | ||
Reflect.defineMetadata(OGMA_INTERCEPTOR_SKIP, true, descriptor.value); | ||
return descriptor; | ||
} | ||
Reflect.defineMetadata(OGMA_INTERCEPTOR_SKIP, true, target); | ||
return target; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...erceptor/interceptor-service.interface.ts → ...terfaces/interceptor-service.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
import { ExecutionContext, HttpException } from '@nestjs/common'; | ||
import { OgmaInterceptorServiceOptions } from 'src/interfaces/ogma-options.interface'; | ||
import { LogObject } from './log.interface'; | ||
|
||
export interface InterceptorService { | ||
getSuccessContext( | ||
data: any, | ||
context: ExecutionContext, | ||
startTime: number, | ||
options: OgmaInterceptorServiceOptions, | ||
): string | object; | ||
): LogObject; | ||
|
||
getErrorContext( | ||
error: Error | HttpException, | ||
context: ExecutionContext, | ||
startTime: number, | ||
options: OgmaInterceptorServiceOptions, | ||
): string | object; | ||
): LogObject; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export interface LogObject { | ||
callerAddress: string[] | string; | ||
method: string; | ||
callPoint: string; | ||
protocol: string; | ||
status: string; | ||
responseTime: number; | ||
contentLength: number; | ||
} |
Oops, something went wrong.