Luigit
repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

extensions/os-notifier/src/debug.ts

Raw
import { defineDebug } from "./pi-ext-debug.ts";

type Schema = {
	events: readonly ["session.start", "session.shutdown", "notification.skip"];
	spans: readonly ["notification.deliver"];
	fields: {
		mode: readonly ["tui", "interactive", "print", "json", "rpc"];
		platform: readonly [
			"aix",
			"android",
			"cygwin",
			"darwin",
			"freebsd",
			"haiku",
			"linux",
			"netbsd",
			"openbsd",
			"sunos",
			"win32",
		];
		status: readonly ["info", "warning", "error"];
		kind: readonly ["delivery"];
		reason: readonly ["ineligible", "missing_result", "focused"];
		outcome: readonly ["native", "fallback", "failed"];
	};
};

const debug: ReturnType<typeof defineDebug<Schema>> = defineDebug({
	events: ["session.start", "session.shutdown", "notification.skip"],
	spans: ["notification.deliver"],
	fields: {
		mode: ["tui", "interactive", "print", "json", "rpc"],
		platform: [
			"aix",
			"android",
			"cygwin",
			"darwin",
			"freebsd",
			"haiku",
			"linux",
			"netbsd",
			"openbsd",
			"sunos",
			"win32",
		],
		status: ["info", "warning", "error"],
		kind: ["delivery"],
		reason: ["ineligible", "missing_result", "focused"],
		outcome: ["native", "fallback", "failed"],
	},
} as const);
export const dbg: typeof debug.dbg = debug.dbg;
export const span: typeof debug.span = debug.span;
export const closeDebug: typeof debug.closeDebug = debug.closeDebug;