本页还没有译文
本页 6 段还没译成Русский,下面显示的是英文原文。setLogger
还没翻译译自英文(tanstack.com)本页 6 段都还没译
setLogger
setLogger is an optional function that allows you to replace the default logger used by React Query to log errors. By default, the window.console object is used. If no global console object is found in the environment, nothing will be logged.
Examples:
import { setLogger } from 'react-query'
import { printLog, printWarn, printError } from 'custom-logger'
// Custom logger
setLogger({
log: printLog,
warn: printWarn,
error: printError,
})
// Sentry logger
setLogger({
log: message => {
Sentry.captureMessage(message)
},
warn: message => {
Sentry.captureMessage(message)
},
error: error => {
Sentry.captureException(error)
},
})
// Winston logger
setLogger(winston.createLogger())Options
logger: Logger- Must implement the
log,warn, anderrormethods.
- Must implement the
AI 翻译查看英文原文