Merged in feature/wrap-logging (pull request #2511)
Feature/wrap logging * feat: change all logging to go through our own logger function so that we can control log levels * move packages/trpc to using our own logger * merge Approved-by: Linus Flood
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import * as Sentry from "@sentry/nextjs"
|
||||
|
||||
import { createLogger } from "@scandic-hotels/common/logger/createLogger"
|
||||
|
||||
import { appRouter } from "./routers/appRouter"
|
||||
import { createCallerFactory } from "."
|
||||
|
||||
@@ -22,12 +24,13 @@ export function appServerClient(
|
||||
context: Context,
|
||||
options: ServerClientOptions = {}
|
||||
) {
|
||||
const serverClientLogger = createLogger("serverClient")
|
||||
return createCaller(context, {
|
||||
onError: (args) => {
|
||||
const { ctx, error, input, path, type } = args
|
||||
console.error(`[serverClient] error for ${type}: ${path}`, error)
|
||||
serverClientLogger.error(`error for ${type}: ${path}`, error)
|
||||
if (input) {
|
||||
console.error(`[serverClient] received input:`, input)
|
||||
serverClientLogger.error(`received input:`, input)
|
||||
}
|
||||
|
||||
options.onError?.(args)
|
||||
|
||||
Reference in New Issue
Block a user