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

Logging

Topics

Jump to a Topic

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.

Blitz RPC Logging Setup

The logger setup in app/blitz-server.ts is used by Blitz RPC to provide robust logging. There are additional logging options for RPC verbosity, whether to log input, output, and filters for specific RPC endpoints.


Idea for improving this page? Edit it on GitHub.