fix: set up logger from Svelte app on app boot
This commit is contained in:
parent
29ad7fcf73
commit
377a4bcd80
|
@ -3,12 +3,14 @@ import App from './components/App.svelte'
|
|||
import * as stores from './stores'
|
||||
import * as services from './services'
|
||||
import serviceWorkerBoot from './sw-boot'
|
||||
import loggerBoot from './logger-boot'
|
||||
|
||||
const boot = () => {
|
||||
|
||||
services.storageListener.register()
|
||||
|
||||
serviceWorkerBoot()
|
||||
loggerBoot()
|
||||
|
||||
new App({
|
||||
target: document.querySelector('#root'),
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
import logger from '../static/app/logger'
|
||||
import { configStore } from './stores'
|
||||
|
||||
export default () => {
|
||||
const enableTracking = configStore.track
|
||||
|
||||
logger.setRemoteLogging(enableTracking)
|
||||
}
|
|
@ -14,19 +14,4 @@ import { Request } from '../frontend/records'
|
|||
|
||||
(() => {
|
||||
document.addEventListener('DOMContentLoaded', boot)
|
||||
|
||||
const configureLogger = (logger) => {
|
||||
if (!logger) {
|
||||
return
|
||||
}
|
||||
|
||||
const prevStorage = getConfigStorage()
|
||||
const storageContents = getStorageContents(prevStorage)
|
||||
|
||||
const shouldTrack = Boolean(storageContents.track)
|
||||
|
||||
logger.setRemoteLogging(shouldTrack)
|
||||
}
|
||||
|
||||
configureLogger(logger)
|
||||
})()
|
||||
|
|
Loading…
Reference in New Issue