diff --git a/README.md b/README.md index 8cc9a772..fb74e2bd 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 ``, ``, ``, `` with their applicable values diff --git a/apps/web/pages/_app.tsx b/apps/web/pages/_app.tsx index 7d67ff40..1c7a4ad4 100644 --- a/apps/web/pages/_app.tsx +++ b/apps/web/pages/_app.tsx @@ -45,8 +45,7 @@ export default withTRPC({ // 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`,