-
-
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.
fix: handle cases where hostname, pid, and message could be undefined (…
…#1753) Slight performance increase as well with setting the pid and hostname strings at creation of the instance rather than at each call
- Loading branch information
Showing
4 changed files
with
39 additions
and
27 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,5 @@ | ||
--- | ||
'@ogma/logger': patch | ||
--- | ||
|
||
Properly ignore the hostname, pid, and application in json logsm if the option is set to not usethem |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ layout: ../../../layouts/MainLayout.astro | |
|
||
To create a custom parser, you can either `extend` an existing parser and override any of the methods, such as the `getCallerIp()` if you need to get a value other than `req.ip` in the [`@ogma/platform-express`](/en/nestjs/http/platform-express) parser, or you can create your own class that `extends AbstractInterceptorService` or `implements InterceptorService`. All of the methods of these classes and interfaces have appropriate typings and doc strings to help with creating your own parser if you want to work with a system that is not directly yet supported. | ||
|
||
As of `@ogma/[email protected]` you also need to add the `@Parser()` decorator to your custom parser. This decorator can replace the `@Injectable()` or they can both be present, Nest will handle them the same. The `@Parser()` decorator takes in a string that should match the `ExecutionContext#getType()` method's return. e.g. for express or fastify, this would be `http`. This allows for developers of other application types that integrate with Nest to provider their own parsers and not have the interceptor throw errors about unknown context types. If a requesttype comes in the the interceptor does not know how to deal with, the request will simply continue | ||
As of `@ogma/[email protected]` you also need to add the `@Parser()` decorator to your custom parser. This decorator can replace the `@Injectable()` or they can both be present, Nest will handle them the same. The `@Parser()` decorator takes in a string that should match the `ExecutionContext#getType()` method's return. e.g. for express or fastify, this would be `http`. This allows for developers of other application types that integrate with Nest to provider their own parsers and not have the interceptor throw errors about unknown context types. If a request type comes in the the interceptor does not know how to deal with, the request will simply continue | ||
|
||
```ts | ||
interface InterceptorService { | ||
|
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