2022-12-21 08:56:57 +09:00
|
|
|
import * as log from 'tauri-plugin-log-api'
|
|
|
|
|
|
|
|
// When running inside Tauri, catch all logs from 3rd party packages and direct them to the unified logging stream
|
|
|
|
export default defineNuxtPlugin(() => {
|
|
|
|
// eslint-disable-next-line no-global-assign
|
|
|
|
console = {
|
|
|
|
...console,
|
|
|
|
trace: log.trace,
|
|
|
|
debug: log.debug,
|
|
|
|
log: log.info,
|
|
|
|
warn: log.warn,
|
|
|
|
error: log.error,
|
|
|
|
}
|
|
|
|
|
|
|
|
window.addEventListener('unhandledrejection', err =>
|
2024-03-05 23:48:58 +09:00
|
|
|
log.error(err.reason))
|
2022-12-21 08:56:57 +09:00
|
|
|
window.addEventListener('error', err => log.error(err.error), true)
|
|
|
|
})
|