- Hybrid Python/Node.js architecture with WebSocket bridge - PySide6 desktop app with smoky blue futuristic theme - Dashboard, Create Doug, Settings screens - bedrock-protocol connection to BDS (offline + Xbox Live auth) - Realm support (auth flow with device code + browser auto-open) - Ollama integration with lean persona prompt (~95 tokens) - 40 personality traits (15 sliders + 23 quirks + 2 toggles) - SQLite + MariaDB database with 12 tables - Chat working in-game with proper Bedrock text packet format - RakNet protocol 11 patch for newer BDS versions - jsp-raknet backend (native crashes on ARM64 macOS) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
/**
|
|
* Simple structured logger for the bridge process.
|
|
* Outputs JSON lines to stdout for Python to capture.
|
|
*/
|
|
|
|
export enum LogLevel {
|
|
DEBUG = 'DEBUG',
|
|
INFO = 'INFO',
|
|
WARN = 'WARN',
|
|
ERROR = 'ERROR',
|
|
}
|
|
|
|
let currentLevel = LogLevel.INFO;
|
|
|
|
export function setLogLevel(level: LogLevel): void {
|
|
currentLevel = level;
|
|
}
|
|
|
|
const levelPriority: Record<LogLevel, number> = {
|
|
[LogLevel.DEBUG]: 0,
|
|
[LogLevel.INFO]: 1,
|
|
[LogLevel.WARN]: 2,
|
|
[LogLevel.ERROR]: 3,
|
|
};
|
|
|
|
function log(level: LogLevel, module: string, message: string, data?: any): void {
|
|
if (levelPriority[level] < levelPriority[currentLevel]) return;
|
|
|
|
const entry = {
|
|
timestamp: new Date().toISOString(),
|
|
level,
|
|
module,
|
|
message,
|
|
...(data !== undefined ? { data } : {}),
|
|
};
|
|
|
|
// Output as JSON line for Python to parse
|
|
console.log(JSON.stringify(entry));
|
|
}
|
|
|
|
export function createLogger(module: string) {
|
|
return {
|
|
debug: (msg: string, data?: any) => log(LogLevel.DEBUG, module, msg, data),
|
|
info: (msg: string, data?: any) => log(LogLevel.INFO, module, msg, data),
|
|
warn: (msg: string, data?: any) => log(LogLevel.WARN, module, msg, data),
|
|
error: (msg: string, data?: any) => log(LogLevel.ERROR, module, msg, data),
|
|
};
|
|
}
|