UNPKG

@archon-inc/sdk

Version:

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

21 lines (20 loc) 782 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = logEvent; const Archon_js_1 = require("../Archon.js"); const logging_js_1 = require("../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. */ async function logEvent(event, options) { // if no severity is provided, default to info if (options.severity === undefined) { options.severity = logging_js_1.Severity.INFO; } Archon_js_1.Archon.request("/logging/log", "POST", { ...options, eventType: event, source: Archon_js_1.Archon.getComponentName() }) .catch((err) => { console.error(`Failed to log event: ${err}`); }); }