Silence trpc logging by default (#1949)
Co-authored-by: Bailey Pumfleet <pumfleet@hey.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com>pull/1958/head
parent
d9d95ba17c
commit
eac2e4e53e
|
@ -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
|
||||
|
|
|
@ -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`,
|
||||
|
|
Loading…
Reference in New Issue