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

@@ -2,6 +2,7 @@ import { z } from "zod"
import { Lang } from "@scandic-hotels/common/constants/language"
import { getCacheClient } from "@scandic-hotels/common/dataCache"
import { createLogger } from "@scandic-hotels/common/logger/createLogger"
import { isDefined } from "@scandic-hotels/common/utils/isDefined"
import { safeTry } from "@scandic-hotels/common/utils/safeTry"
@@ -97,6 +98,7 @@ export async function getAutoCompleteDestinationsData({
serviceToken: string
warmup?: boolean
}) {
const autoCompleteLogger = createLogger("autocomplete-destinations")
const cacheClient = await getCacheClient()
return await cacheClient.cacheOrGet(
`autocomplete:destinations:locations:${lang}`,
@@ -110,7 +112,7 @@ export async function getAutoCompleteDestinationsData({
})
if (!countries) {
console.error("Unable to fetch countries")
autoCompleteLogger.error("Unable to fetch countries")
throw new Error("Unable to fetch countries")
}
@@ -146,7 +148,7 @@ export async function getAutoCompleteDestinationsData({
!cityUrls ||
!countryUrls
) {
console.error("Unable to fetch location URLs")
autoCompleteLogger.error("Unable to fetch location URLs")
throw new Error("Unable to fetch location URLs")
}