Skip to content

Commit

Permalink
make logger optional (will default to BlitzLogger) (#3939)
Browse files Browse the repository at this point in the history
* make logger optional (will default to BlitzLogger)
  • Loading branch information
flybayer authored Nov 1, 2022
1 parent ceb7db2 commit 11b548e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/odd-bears-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blitzjs/next": minor
---

Change setupBlitzServer logger config to be optional. Will default to BlitzLogger
4 changes: 2 additions & 2 deletions packages/blitz-next/src/index-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export type NextApiHandler<TResult> = (
type SetupBlitzOptions = {
plugins: BlitzServerPlugin<RequestMiddleware, Ctx>[]
onError?: (err: Error) => void
logger: ReturnType<typeof BlitzLogger>
logger?: ReturnType<typeof BlitzLogger>
}

export type Redirect =
Expand Down Expand Up @@ -131,7 +131,7 @@ const prefetchQueryFactory = (
}

export const setupBlitzServer = ({plugins, onError, logger}: SetupBlitzOptions) => {
initializeLogger(logger)
initializeLogger(logger ?? BlitzLogger())

const middlewares = plugins.flatMap((p) => p.requestMiddlewares)
const contextMiddleware = plugins.flatMap((p) => p.contextMiddleware).filter(Boolean)
Expand Down
20 changes: 8 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 11b548e

Please sign in to comment.