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:
Joakim Jäderberg
2025-07-03 12:37:04 +00:00
parent 7e32ed294d
commit daf765f3d5
110 changed files with 681 additions and 441 deletions

View File

@@ -1,5 +1,6 @@
import * as Sentry from "@sentry/nextjs"
import { logger } from "@scandic-hotels/common/logger"
import { getServiceToken } from "@scandic-hotels/common/tokenManager"
import { env } from "../env/server"
@@ -68,10 +69,10 @@ export const protectedProcedure = baseProcedure.use(async function (opts) {
const session = await opts.ctx.auth()
if (!authRequired && env.NODE_ENV === "development") {
console.info(
logger.debug(
`❌❌❌❌ You are opting out of authorization, if its done on purpose maybe you should use the publicProcedure instead. ❌❌❌❌`
)
console.info(`path: ${opts.path} | type: ${opts.type}`)
logger.debug(`path: ${opts.path} | type: ${opts.type}`)
}
if (!session) {
@@ -93,10 +94,10 @@ export const safeProtectedProcedure = baseProcedure.use(async function (opts) {
const authRequired = opts.meta?.authRequired ?? true
let session = await opts.ctx.auth()
if (!authRequired && env.NODE_ENV === "development") {
console.info(
logger.debug(
`❌❌❌❌ You are opting out of authorization, if its done on purpose maybe you should use the publicProcedure instead. ❌❌❌❌`
)
console.info(`path: ${opts.path} | type: ${opts.type}`)
logger.debug(`path: ${opts.path} | type: ${opts.type}`)
}
if (!session || session.error === "RefreshAccessTokenError") {