fix(logging): decouple file logs from console verbose

This commit is contained in:
Peter Steinberger
2026-01-03 12:32:14 +00:00
parent e52bdaa2a2
commit bb54e60179
18 changed files with 105 additions and 67 deletions

View File

@@ -1,5 +1,5 @@
import chalk from "chalk";
import { getLogger } from "./logging.js";
import { getLogger, isFileLogLevelEnabled } from "./logging.js";
let globalVerbose = false;
let globalYes = false;
@@ -12,14 +12,24 @@ export function isVerbose() {
return globalVerbose;
}
export function shouldLogVerbose() {
return globalVerbose || isFileLogLevelEnabled("debug");
}
export function logVerbose(message: string) {
if (!globalVerbose) return;
console.log(chalk.gray(message));
if (!shouldLogVerbose()) return;
try {
getLogger().debug({ message }, "verbose");
} catch {
// ignore logger failures to avoid breaking verbose printing
}
if (!globalVerbose) return;
console.log(chalk.gray(message));
}
export function logVerboseConsole(message: string) {
if (!globalVerbose) return;
console.log(chalk.gray(message));
}
export function setYes(v: boolean) {