MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / emit

Function emit

apps/ui/src/lib/logger/logger.utils.ts:34–62  ·  view source on GitHub ↗
(level: ILogLevel, payload: ILogEvent)

Source from the content-addressed store, hash-verified

32}
33
34export function emit(level: ILogLevel, payload: ILogEvent): void {
35 const maskedRaw = mask(payload);
36 const masked: Record<string, unknown> = isRecord(maskedRaw) ? maskedRaw : {};
37 const entry = {
38 level,
39 timestamp: now(),
40 app: env.VITE_APP_NAME,
41 ...masked
42 };
43
44 if (env.DEV) {
45 const fn = level === "error" ? console.error : console.log;
46
47 fn(entry);
48
49 return;
50 }
51
52 /*
53 * Production is breadcrumb-only: entries ride along with Sentry events
54 * instead of landing in the browser console, where they would expose the
55 * app's event stream to anyone with devtools open.
56 */
57 Sentry.addBreadcrumb({
58 level: level === "warn" ? "warning" : level,
59 category: typeof masked.event === "string" ? masked.event : "log",
60 data: masked
61 });
62}

Callers 2

logger.tsFile · 0.90

Calls 3

isRecordFunction · 0.90
nowFunction · 0.90
maskFunction · 0.85

Tested by

no test coverage detected