Adds structured logging and fixes event reactivity.

This commit is contained in:
2023-09-26 13:32:46 +02:00
parent be4c25d333
commit f1b46b788d
12 changed files with 505 additions and 57 deletions

View File

@@ -12,13 +12,8 @@ const services: Record<string, ServiceRecord> = {};
const components: Record<string, any> = {};
async function pollURL(config: ServiceConfig): Promise<ServiceData> {
try {
const resp = await fetch(config.url);
return { status: resp.ok ? 'online' : 'offline' };
} catch (error) {
console.warn(`could not poll '${config.url}': ` + error);
return { status: 'offline' };
}
const resp = await fetch(config.url);
return { status: resp.ok ? 'online' : 'offline' };
}
function registerService(type: string, service: Partial<ServiceRecord>) {