🚀Announcing Flightcontrol - Easily Deploy Blitz.js and Next.js to AWS 🚀
Back to Documentation Menu

Logging

Blitz uses tslog as its default logger. You can configure it by modifying the logger property in your app/blitz-server.ts file.

In new Blitz apps you can find the logger property to be configured like this:

// app/blitz-server.ts

import { setupBlitzServer } from "@blitzjs/next"
import { BlitzLogger } from "blitz"

const { gSSP, gSP, api } = setupBlitzServer({
  logger: BlitzLogger({}),
})

You can pass in any of the tslog options to configure the logger.

For example:

// app/blitz-server.ts

import { setupBlitzServer } from "@blitzjs/next"
import { BlitzLogger } from "blitz"

const { gSSP, gSP, api } = setupBlitzServer({
  logger: BlitzLogger({
    colorizePrettyLogs: true,
    prefix: ["[blitz]"],
  }),
})

This configuration will be used by Blitz packages like RPC, and Auth.


Idea for improving this page? Edit it on GitHub.