Skip to content

Commit 54f199b

Browse files
committed
chore: update readme
1 parent 3f26068 commit 54f199b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,15 @@ this.logger.log(message, 'here you can also pass something that will be added to
158158

159159
`nestjs-pino` package has exceptional feature that allows to leverage the request-id that you might noticed previously when we added `pino-http` middleware. Essentially this is great feature, but at the moment I don't think that it should be implemented within this package anytime in the future. It can be achieved by storing this info using `AsyncLocalStorage` inside the middleware function in `main.ts` file, and then retrieved in pino mixin. But in more complex scenario you should be using open telemetry, which can handle global trace-id and pass it with every log message. Also having request object in each log message would increase it's size and make it more expensive to transfer and store.
160160

161-
For instance:
161+
Example of using open telemetry:
162162
```typescript
163163
// pino.config.ts
164-
165-
//...registerAs...
166164
import { context, isSpanContextValid, trace } from '@opentelemetry/api';
167165

166+
//...registerAs...
168167
return {
168+
// ... transfer
169+
// ... other pino options
169170
mixin: () => {
170171
const record = {};
171172
const span = trace.getSpan(context.active());

0 commit comments

Comments
 (0)