@@ -7,6 +7,9 @@ import { merge, get } from 'lodash-es'
77
88import languages from '@/languages/lib/languages-server'
99import { correctTranslatedContentStrings } from '@/languages/lib/correct-translation-content'
10+ import { createLogger } from '@/observability/logger'
11+
12+ const logger = createLogger ( import . meta. url )
1013
1114interface YAMLException extends Error {
1215 mark ?: any
@@ -128,7 +131,7 @@ export const getDataByLanguage = memoize((dottedPath: string, langCode: string):
128131 // would have caused a YAMLException
129132 if ( langCode !== 'en' ) {
130133 if ( DEBUG_JIT_DATA_READS ) {
131- console . warn ( ` Unable to parse Yaml in ( ${ langCode } ) ' ${ dottedPath } ': ${ error . message } ` )
134+ logger . warn ( ' Unable to parse Yaml in translation' , { langCode, dottedPath, error } )
132135 }
133136 // Give it one more chance, but use English this time
134137 return getDataByDir ( dottedPath , languages . en . dir )
@@ -208,7 +211,7 @@ function getDataByDir(
208211 return content
209212 }
210213 } else {
211- console . warn ( ` Unable to find variables Yaml file ${ fullPath . join ( path . sep ) } ` )
214+ logger . warn ( ' Unable to find variables Yaml file' , { filePath : fullPath . join ( path . sep ) } )
212215 }
213216 return undefined
214217 }
@@ -347,7 +350,7 @@ const getFileContent = (
347350 englishRoot ?: string ,
348351) : string => {
349352 const filePath = root ? path . join ( root , relPath ) : relPath
350- if ( DEBUG_JIT_DATA_READS ) console . log ( 'READ' , filePath )
353+ if ( DEBUG_JIT_DATA_READS ) logger . info ( 'READ' , { filePath } )
351354 try {
352355 return fs . readFileSync ( filePath , 'utf-8' )
353356 } catch ( err ) {
0 commit comments