fix: add improved logging for contentstack requests
This commit is contained in:
@@ -131,6 +131,14 @@ export const languageSwitcherQueryRouter = router({
|
||||
if (!ctx.uid || !ctx.lang) {
|
||||
return { lang: ctx.lang, urls: baseUrls }
|
||||
}
|
||||
console.info(
|
||||
"contentstack.languageSwitcher start ",
|
||||
JSON.stringify({
|
||||
uid: ctx.uid,
|
||||
lang: ctx.lang,
|
||||
contentType: ctx.contentType,
|
||||
})
|
||||
)
|
||||
const res = await getLanguageSwitcher({
|
||||
contentType: ctx.contentType!,
|
||||
uid: ctx.uid,
|
||||
@@ -155,12 +163,12 @@ export const languageSwitcherQueryRouter = router({
|
||||
|
||||
if (!validatedLanguageSwitcherData.success) {
|
||||
console.error(
|
||||
`Failed to validate Language Switcher Data - (contentType: ${ctx.contentType}, lang: ${ctx.lang}, uid: ${ctx.uid})`
|
||||
"contentstack.languageSwitcher validation error",
|
||||
JSON.stringify(validatedLanguageSwitcherData.error)
|
||||
)
|
||||
console.error(validatedLanguageSwitcherData.error)
|
||||
return null
|
||||
}
|
||||
|
||||
console.info("contentstack.languageSwitcher success")
|
||||
return {
|
||||
lang: ctx.lang,
|
||||
urls,
|
||||
|
||||
Reference in New Issue
Block a user