UNPKG

@archon-inc/sdk

Version:

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

18 lines (17 loc) 644 B
import { Archon } from "../Archon.js"; import { 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, options) { // 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) => { console.error(`Failed to log event: ${err}`); }); }