UNPKG

@archon-inc/sdk

Version:

Integrate easily to our government platform using this SDK. More info on https://archon.inc/sdk

19 lines (17 loc) 740 B
import { Archon } from "../Archon.js"; import { EventType, LogOptions, Severity } from "../types/logging.js"; /** * Log an event that occurs in your application. * @param event The event that occurred. * @param options Options to include with the log message. */ export default async function logEvent(event: EventType, options: Omit<LogOptions, 'eventType'>): Promise<void> { // if no severity is provided, default to info if (options.severity === undefined) { options.severity = Severity.INFO; } Archon.request("/logging/log", "POST", { ...options, eventType: event, source: Archon.getComponentName() }) .catch((err: Error) => { console.error(`Failed to log event: ${err}`); }); }