Skip to content

Commit

Permalink
docs: Update README to include configuration options for route handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielelpidio committed Nov 12, 2024
1 parent c44ca8f commit 7047c13
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@ export const GET = withAxiom((req: AxiomRequest) => {
});
```
Route handlers also accept a configuration object as the second argument. This object can contain the following properties:
- `details`: It accepts a boolean or an array of keys. If pass `true`, it will add the request details to the log (method, URL, headers, etc.). If you pass an array of strings, it will only log the specified keys.
```ts
export const GET = withAxiom(
async () => {
return new Response("Hello World!");
},
{ details: ['body', 'nextUrl'] } // { details: true } is also valid
);
```
### Client components
To send logs from client components, add `useLogger` from next-axiom to your component:
Expand Down

0 comments on commit 7047c13

Please sign in to comment.