Skip to content

Scheduling infrastructure for absolutely everyone.

Silence trpc logging by default (#1949)

Demian Caldelaseac2e4e53e3a
diff --git a/README.md b/README.md
index 8cc9a772478..fb74e2bdd06 100644
--- a/README.md
+++ b/README.md
@@ -124,6 +124,14 @@ Here is what you need to be able to run Cal.
yarn dx
```
+#### Development tip
+
+> Add `NEXT_PUBLIC_DEBUG=1` anywhere in your `apps/web/.env` to get logging information for all the queries and mutations driven by **trpc**.
+
+```sh
+echo 'NEXT_PUBLIC_DEBUG=1' >> apps/web/.env
+```
+
#### Manual setup
1. Configure environment variables in the .env file. Replace `<user>`, `<pass>`, `<db-host>`, `<db-port>` with their applicable values
diff --git a/apps/web/pages/_app.tsx b/apps/web/pages/_app.tsx
index 7d67ff40851..1c7a4ad4792 100644
--- a/apps/web/pages/_app.tsx
+++ b/apps/web/pages/_app.tsx
@@ -45,8 +45,7 @@ export default withTRPC<AppRouter>({
// adds pretty logs to your console in development and logs errors in production
loggerLink({
enabled: (opts) =>
- process.env.NODE_ENV === "development" ||
- (opts.direction === "down" && opts.result instanceof Error),
+ !!process.env.NEXT_PUBLIC_DEBUG || (opts.direction === "down" && opts.result instanceof Error),
}),
httpBatchLink({
url: `/api/trpc`,