From 7047c130f56023f5a00875d6fa46f9270e2ee7ce Mon Sep 17 00:00:00 2001 From: gabrielelpidio Date: Tue, 12 Nov 2024 15:20:31 -0400 Subject: [PATCH] docs: Update README to include configuration options for route handlers --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 5e3f89b0..34fee52b 100644 --- a/README.md +++ b/README.md @@ -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: