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,7 +1,7 @@
import { execFile, spawn } from "node:child_process";
import { promisify } from "node:util";
import { danger, isVerbose } from "../globals.js";
import { danger, shouldLogVerbose } from "../globals.js";
import { logDebug, logError } from "../logger.js";
const execFileAsync = promisify(execFile);
@@ -22,13 +22,13 @@ export async function runExec(
};
try {
const { stdout, stderr } = await execFileAsync(command, args, options);
if (isVerbose()) {
if (shouldLogVerbose()) {
if (stdout.trim()) logDebug(stdout.trim());
if (stderr.trim()) logError(stderr.trim());
}
return { stdout, stderr };
} catch (err) {
if (isVerbose()) {
if (shouldLogVerbose()) {
logError(danger(`Command failed: ${command} ${args.join(" ")}`));
}
throw err;