UNPKG

agents

Version:
26 lines (24 loc) • 659 B
import "../client-connection-CGMuV62J.js"; import { getCurrentAgent } from "../index.js"; //#region src/observability/index.ts /** * A generic observability implementation that logs events to the console. */ const genericObservability = { emit(event) { if (isLocalMode()) { console.log(event.displayMessage); return; } console.log(event); } }; let localMode = false; function isLocalMode() { if (localMode) return true; const { request } = getCurrentAgent(); if (!request) return false; localMode = new URL(request.url).hostname === "localhost"; return localMode; } //#endregion export { genericObservability }; //# sourceMappingURL=index.js.map