feat: add log-level system to suppress noisy fallback debug output
Replace console.debug/log/warn calls in model router, retry, and daemon startup with a structured logger that respects a configurable log_level. Default level is 'info', suppressing verbose fallback debug messages in the TUI while keeping them available via config when needed. - Add src/logger.ts with debug/info/warn/error/silent levels - Wire log_level into config schema (default: 'info') - Initialize log level in both daemon and TUI startup paths - Convert all console.debug in router.ts and retry.ts to logger.debug - Convert console.log/warn in daemon/models.ts to logger.info/warn
This commit is contained in:
@@ -4,6 +4,7 @@ import { loadConfigSafe, getConfigPath } from './shared.js';
|
||||
import { existsSync, mkdirSync, readFileSync } from 'fs';
|
||||
import { resolve } from 'path';
|
||||
import { homedir } from 'os';
|
||||
import { setLogLevel } from '../logger.js';
|
||||
|
||||
// ANSI color codes for tool status display
|
||||
const toolColors = {
|
||||
@@ -43,6 +44,8 @@ export function registerTuiCommand(program: Command): void {
|
||||
|
||||
// Dynamic imports to keep CLI startup fast
|
||||
const { SessionStore, SessionManager } = await import('../session/index.js');
|
||||
|
||||
setLogLevel(config.log_level);
|
||||
const { MinimalTui, startFullscreenTui } = await import('../frontends/tui/index.js');
|
||||
const { NativeAgent } = await import('../backends/index.js');
|
||||
const { ToolRegistry, ToolExecutor, allBuiltinTools, createWebSearchTools, createProcessTools, ProcessManager } = await import('../tools/index.js');
|
||||
|
||||
Reference in New Issue
Block a user