Keep Commonlib CLI diagnostics behind debug mode

This commit is contained in:
vorotamoroz committed 2026-11-05 08:36:36 +00:00
1 parent a0f1483891
commit e7124eda98
4 files changed
+28 -24

No files matched your search

+9 -4
View File
@@ -378,10 +378,15 @@ export async function main(
const writeLine = avoidStdoutNoise ? writeStderrLine : writeStdoutLine;
writeLine(standardIo, ...values);
};
setGlobalLogFunction((msg, level) => {
if (!options.debug && level !== LOG_LEVEL_NOTICE && level !== LOG_LEVEL_URGENT) return;
writeStderrLine(standardIo, `[${level}]`, msg);
});
if (options.debug) {
setGlobalLogFunction((msg, level) => {
writeStderrLine(standardIo, `[${level}]`, msg);
});
} else {
setGlobalLogFunction((msg, level) => {
// NO OP, leave it to logFunction
});
}
if (options.command === "init-settings") {
await createDefaultSettingsFile(options, standardIo);
return;