Files
games/crates/apps/game-reflex-poc-tauri/frontend/ts/logging.ts

39 lines
1.2 KiB
TypeScript

// file: crates/apps/game-reflex-poc-tauri/frontend/ts/logging.ts
// version: 1
import { attachConsole, debug, error, info, trace, warn } from "@fltsci/tauri-plugin-tracing";
let detachRustConsole: (() => void) | null = null;
export async function initializeTracing(): Promise<void> {
detachRustConsole = await attachConsole();
await info("Reflex Tauri frontend tracing initialized", "games::tauri::reflex::frontend");
}
export async function tracingTrace(message: string): Promise<void> {
await trace(message, "games::tauri::reflex::frontend");
}
export async function tracingDebug(message: string): Promise<void> {
await debug(message, "games::tauri::reflex::frontend");
}
export async function tracingInfo(message: string): Promise<void> {
await info(message, "games::tauri::reflex::frontend");
}
export async function tracingWarn(message: string): Promise<void> {
await warn(message, "games::tauri::reflex::frontend");
}
export async function tracingError(message: string): Promise<void> {
await error(message, "games::tauri::reflex::frontend");
}
export function detachTracingConsole(): void {
if (detachRustConsole !== null) {
detachRustConsole();
detachRustConsole = null;
}
}