Files
windmill/cli/src/core/log.ts
T
Ruben FiszelandClaude Fable 5.1 0f5a1db2ab fix(cli): make a sync push into a fork converge on schedules and inline names (#10951)
* fix(cli): make a sync push into a fork converge on schedules and inline names

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JcofduXAs9FT948Aj78V8m

* fix(cli): gate the fork schedule lookup, tolerate fork-conflict, keep rendered names unique

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JcofduXAs9FT948Aj78V8m

* test(cli): use the OS path separator in the push convergence fixtures

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JcofduXAs9FT948Aj78V8m

* fix(cli): report a set-aside fork schedule flag and keep checkout inline names inside the flow folder

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JcofduXAs9FT948Aj78V8m

* fix(cli): enable a fork-only schedule on create, and treat a fork with no parent as owning its schedules

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JcofduXAs9FT948Aj78V8m

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-03 08:45:39 +02:00

53 lines
1.6 KiB
TypeScript

let logLevel: "DEBUG" | "INFO" | "WARN" | "ERROR" = "INFO";
let silentMode = false;
const levels = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
export function setup(level: "DEBUG" | "INFO" | "WARN" | "ERROR") {
logLevel = level;
}
export function setSilent(silent: boolean) {
silentMode = silent;
}
export function debug(msg: unknown) {
if (levels[logLevel] <= levels.DEBUG)
console.log(`\x1b[90m${String(msg)}\x1b[39m`);
}
export function info(msg: unknown) {
if (silentMode) return;
console.log(`\x1b[34m${String(msg)}\x1b[39m`);
}
// Like `info` but written to stderr, for diagnostics (e.g. the workspace-profile
// banner printed on every command) that must not pollute stdout when a command's
// data output is piped or redirected (e.g. `wmill variable get path > file`).
export function infoStderr(msg: unknown) {
if (silentMode) return;
console.error(`\x1b[34m${String(msg)}\x1b[39m`);
}
export function warn(msg: unknown) {
if (silentMode) return;
console.log(`\x1b[33m${String(msg)}\x1b[39m`);
}
// Like `warn` but written to stderr; see `infoStderr` for why diagnostics must
// not land on stdout.
export function warnStderr(msg: unknown) {
if (silentMode) return;
console.error(`\x1b[33m${String(msg)}\x1b[39m`);
}
// A notice that must reach a log even in silent (`--json-output`) mode:
// stderr keeps stdout parseable, and a job that runs the CLI records both.
export function warnAlways(msg: unknown) {
console.error(`\x1b[33m${String(msg)}\x1b[39m`);
}
export function error(msg: unknown) {
console.error(`\x1b[31m${String(msg)}\x1b[39m`);
}