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:
- I tried changing
"dev"
in package.json to "DEBUG= blitz dev" but that didn't help - 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?
- npm run dev
- go to a pay that returns a large payload via blitz-rpc
- 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](https://private-user-images.githubusercontent.com/5559355/305683024-de268992-2090-4ee9-8688-6c1f69fc0c44.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTE4MDA1MzcsIm5iZiI6MTcxMTgwMDIzNywicGF0aCI6Ii81NTU5MzU1LzMwNTY4MzAyNC1kZTI2ODk5Mi0yMDkwLTRlZTktODY4OC02YzFmNjlmYzBjNDQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDMzMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAzMzBUMTIwMzU3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MjZhM2JlMGFjMmVkMDlmZTJkNjY3M2FhZGRkYjQzMTFjYTA1OWJiMjJjNDlkNGZhZjE3NzM3MDhiNmYxZWY0YSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.C8SzKJxiXYQzIwUs-prwgRFHt4-Ss2KGBfl-iy8jFd8)
@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.