Skip to content

Commit

Permalink
chore: describe usage in app-dir
Browse files Browse the repository at this point in the history
  • Loading branch information
karl-run authored Nov 8, 2024
1 parent f100ff3 commit 23b1365
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ module.exports = {

## Configuration

### Pages

If your application is using a base path, or you want to have your logger on a different API-route, you can configure the logger.

In your `_app.tsx`, on root in the file, you can use `configureLogger` as such:
Expand All @@ -81,3 +83,21 @@ configureLogger({
basePath: '/my/base/path',
})
```

### App Dir

You want this configuration to execute as early as possible, but on the actual client. Typically in your app-dir app, you will have for example a `<Providers>`-client that is `"use client"`-enabled.

On the _root_ of any `"use client"`-enabled file that wraps your root layout.tsx, you can configure the library, for example:

```ts
"use client"

configureLogger({
basePath: '/my/base/path',
})

export const MyProviders() {
...
}
```

0 comments on commit 23b1365

Please sign in to comment.