Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

terminalDebugLog.ts

24 lines779 Bytes

1/**
2 * Debug logging for the mobile terminal pipeline. Prefix: `[t3-terminal]`.
3 *
4 * Enabled when `__DEV__` is true, or set `globalThis.__T3_TERMINAL_DEBUG__ = true` in a JS
5 * debugger / Metro console to trace release/TestFlight builds.
6 */
7export function isTerminalDebugEnabled(): boolean {
8 return (
9 (typeof __DEV__ !== "undefined" && __DEV__) ||
10 (typeof globalThis !== "undefined" &&
11 (globalThis as { __T3_TERMINAL_DEBUG__?: boolean }).__T3_TERMINAL_DEBUG__ === true)
12 );
14​
15export function terminalDebugLog(message: string, data?: Record<string, unknown>): void {
16 if (!isTerminalDebugEnabled()) {
17 return;
18 }
19 if (data !== undefined) {
20 console.log(`[t3-terminal] ${message}`, data);
21 } else {
22 console.log(`[t3-terminal] ${message}`);
23 }