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,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") {
|
||||
|
||||
Reference in New Issue
Block a user