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

@@ -3,6 +3,7 @@ import { redirect } from "next/navigation"
import { z } from "zod"
import { myPages } from "@scandic-hotels/common/constants/routes/myPages"
import { logger } from "@scandic-hotels/common/logger"
import { safeTry } from "@scandic-hotels/common/utils/safeTry"
import {
SAS_TOKEN_STORAGE_KEY,
@@ -173,7 +174,7 @@ async function handleLinkAccount({
const caller = await serverClient()
const [res, error] = await safeTry(caller.partner.sas.linkAccount())
if (!res || error) {
console.error("[SAS] link account error", error)
logger.error("[SAS] link account error", error)
return {
url: `/${lang}/sas-x-scandic/error`,
}
@@ -216,7 +217,7 @@ async function handleUnlinkAccount({
const caller = await serverClient()
const [res, error] = await safeTry(caller.partner.sas.unlinkAccount())
if (!res || error) {
console.error("[SAS] unlink account error", error)
logger.error("[SAS] unlink account error", error)
return {
url: `/${lang}/sas-x-scandic/error`,
}
@@ -266,7 +267,7 @@ async function handleTransferPoints({
)
if (!res || error || res.transferState === "error") {
console.error("[SAS] transfer points error", error)
logger.error("[SAS] transfer points error", error)
return {
url: `/${lang}/sas-x-scandic/error`,
type: "replace",
@@ -274,14 +275,14 @@ async function handleTransferPoints({
}
if (res.transferState === "notLinked") {
console.warn("[SAS] transfer points not linked")
logger.warn("[SAS] transfer points not linked")
return {
url: `/${lang}/sas-x-scandic/link`,
type: "replace",
}
}
console.log("[SAS] transfer points response", res)
logger.debug("[SAS] transfer points response", res)
return {
url: `/${lang}/sas-x-scandic/transfer/success?p=${points}`,