blitz-js / blitz

⚡️ The Missing Fullstack Toolkit for Next.js

Home Page:https://Blitzjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can't locally silence [blitz-rpc] debug logs

Vandivier opened this issue · comments

What is the problem?

I have some large payloads that are washing out my terminal with useless logs that I can't silence

Paste all your error logs here:

n/a

Paste all relevant code snippets here:

  1. I tried changing "dev" in package.json to "DEBUG= blitz dev" but that didn't help
  2. I think this is a general issue but you can dive deep in my particular case by visiting localhost:3000/my-basic-checklist in the ladderly codebase https://github.com/Vandivier/ladderly-3

What are detailed steps to reproduce this?

  1. npm run dev
  2. go to a pay that returns a large payload via blitz-rpc
  3. notice a copy of the payload is logged on the command line and typical debug package approaches to silence it don't work

Run blitz -v and paste the output here:

blitz -v
Blitz version: 2.0.0-beta.31 (global)
Blitz version: 2.0.0-beta.29 (local)
macOS Ventura | darwin-arm64 | Node: v19.9.0


 Package manager: npm

  System:
    OS: macOS 13.5.2
    CPU: (8) arm64 Apple M2
    Memory: 933.02 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 19.9.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.6.3 - /usr/local/bin/npm
  npmPackages:
    @blitzjs/auth: 2.0.0-beta.29 => 2.0.0-beta.29 
    @blitzjs/next: 2.0.0-beta.29 => 2.0.0-beta.29 
    @blitzjs/rpc: 2.0.0-beta.29 => 2.0.0-beta.29 
    @prisma/client: 4.6.1 => 4.6.1 
    blitz: 2.0.0-beta.29 => 2.0.0-beta.29 
    next: 13.4.5 => 13.4.5 
    prisma: 4.6.1 => 4.6.1 
    react: 18.2.0 => 18.2.0 
    react-dom: 18.2.0 => 18.2.0 
    typescript: ^4.8.4 => 4.9.5 

Please include below any other applicable logs and screenshots that show your problem:

image

@Vandivier thanks for the feedback!

The easiest way to silence all the debug logs is adding the following code:

// blitz-server.ts
RpcServerPlugin({
  logging: {
    disablelevel: "debug",
  },
}),
//[[..blitz].ts
export default api(
  rpcHandler({
    logging: {
      disablelevel: "debug",
    },
  }),
)

I am looking to improve this API to make it more straightforward and follow the conventions of other logging solutions, so we would soon have more control over the logging.