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,7 @@
|
||||
// https://docs.lokalise.com/en/articles/3229161-structured-json
|
||||
|
||||
import { logger } from "@scandic-hotels/common/logger"
|
||||
|
||||
import type { LokaliseMessageDescriptor } from "@/types/intl"
|
||||
|
||||
type TranslationEntry = {
|
||||
@@ -28,7 +30,7 @@ export function format(
|
||||
|
||||
if (description) {
|
||||
if (typeof description === "string") {
|
||||
console.warn(
|
||||
logger.warn(
|
||||
`Unsupported type for description, expected 'object', got ${typeof context}. Skipping!`,
|
||||
msg
|
||||
)
|
||||
@@ -39,7 +41,7 @@ export function format(
|
||||
if (typeof context === "string") {
|
||||
entry.context = context
|
||||
} else {
|
||||
console.warn(
|
||||
logger.warn(
|
||||
`Unsupported type for context, expected 'string', got ${typeof context}`,
|
||||
msg
|
||||
)
|
||||
@@ -50,7 +52,7 @@ export function format(
|
||||
if (limit && typeof limit === "number") {
|
||||
entry.limit = limit
|
||||
} else {
|
||||
console.warn(
|
||||
logger.warn(
|
||||
`Unsupported type for limit, expected 'number', got ${typeof limit}`,
|
||||
msg
|
||||
)
|
||||
@@ -64,7 +66,7 @@ export function format(
|
||||
entry.tags = tagArray
|
||||
}
|
||||
} else {
|
||||
console.warn(
|
||||
logger.warn(
|
||||
`Unsupported type for tags, expected Array, got ${typeof tags}`,
|
||||
msg
|
||||
)
|
||||
@@ -75,7 +77,7 @@ export function format(
|
||||
|
||||
results[id] = entry
|
||||
} else {
|
||||
console.warn(
|
||||
logger.warn(
|
||||
`Skipping message, unsupported type for defaultMessage, expected string, got ${typeof defaultMessage}`,
|
||||
{
|
||||
id,
|
||||
|
||||
Reference in New Issue
Block a user