refactor: split tauri config into module

This commit is contained in:
Daniel Roe 2022-12-20 23:56:57 +00:00
parent 44cf8aa89c
commit 2d49074242
No known key found for this signature in database
GPG key ID: 22D5008E4F5D9B55
5 changed files with 43 additions and 27 deletions

View file

@ -1,21 +0,0 @@
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 function setupLogging() {
if (import.meta.env.TAURI_PLATFORM) {
// 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 =>
log.error(err.reason),
)
window.addEventListener('error', err => log.error(err.error), true)
}
}