enh: watch instance logging

This commit is contained in:
Ben Allfree 2023-06-19 05:13:37 -07:00
parent c5173e0380
commit c0bfc643a4

View File

@ -256,7 +256,7 @@ export const createPocketbaseClient = (config: PocketbaseClientConfig) => {
update: (log: InstanceLogFields) => void,
nInitial = 100
): (() => void) => {
const { dbg } = _logger.create('watchInstanceLog')
const { dbg, trace } = _logger.create('watchInstanceLog')
const auth = client.authStore.exportToCookie()
const controller = new AbortController()
@ -274,10 +274,10 @@ export const createPocketbaseClient = (config: PocketbaseClientConfig) => {
auth
}),
onmessage: (event) => {
dbg(`Got stream event`, event)
trace(`Got stream event`, event)
const {} = event
const log = JSON.parse(event.data) as InstanceLogFields
dbg(`Log is`, log)
trace(`Log is`, log)
update(log)
},
onopen: async (response) => {