consoleis your task’s user-facing output (results, status). It always prints, regardless of verbosity.- Logs are bakefile’s own diagnostics, plus any
loggingcalls you make in tasks. These are gated by verbosity.
Console output
console (imported from bake) is a thin wrapper over Rich. Print task output through it rather than print:
console.echo(msg)prints to stdout (your task’s normal output).console.success,info,warning,error(msg)print a labeled line to stderr. In GitHub Actions,warninganderrorbecome::warning::/::error::annotations.console.prefix(msg, label=..., emoji_code=..., label_style=...)prints a custom labeled line when the built-in labels don’t fit.labelis required - useinfofor the defaultINFOlabel.console.cmd(cmd_str)prints a command as❯ <cmd>, which is whatctx.runuses to show the command it runs. The arrow acceptsarrow_style=(default green, e.g.arrow_style="bold red"for failed commands). The command text always stays plain.console.script_block(title, script)pretty-prints a multi-line script, used byrun_script.
style, emoji, markup, highlight, …) and they apply to the message only - the label chrome is rendered as a Text object and is never affected. Chrome styling has its own param names (label_style on prefix, arrow_style on cmd) so rich kwargs are never shadowed. So console.success("tests[unit] passed", markup=False) keeps the green label but prints the message literally. Note that with markup on (the default), rich parses the message: [unit]-style tags are consumed.
Stream model: echo is for machine-readable data (stdout, safe to pipe). Everything else is human progress output (stderr). Any helper also accepts no_color=True to emit zero ANSI codes - use it when the output is parsed by another tool:
console.out / console.err (stdout / stderr, color) and console.plain_out / console.plain_err (no color).
console output, plain print(), and command output are all separate from logs. They always print, regardless of verbosity.
Logging
bakefile logs through loguru, and all logs go to stderr. Standard-librarylogging is bridged into it, so any logging.getLogger(__name__).info(...) in your tasks honors the same settings:
Verbosity
Verbosity sets the global floor. Anything below it is dropped. The default is0 (silent).
Per-module levels
--bake-log (env BAKE_LOG) is a comma-separated list of level or module=level entries. It raises or lowers specific modules independent of verbosity. The default is warning,bake=debug,bakelib=debug,bakefile=debug (the tool’s internals and your bakefile.py at debug, everything else at warning):
--bake-log replaces the default instead of merging with it, so restate any module you want to keep. In the last line, bake and bakelib stay at debug while bakefile.py is silenced to warning.
A log line shows only if it clears both the verbosity floor and its module’s level. So with the default BAKE_LOG, -v surfaces bakefile’s warnings and errors, and -vvv surfaces its debug logs too.
Format
--log-pretty / --no-log-pretty (env BAKE_LOG_PRETTY, default pretty) chooses between pretty colored text and JSON (one object per line, for CI and log shipping):
Advanced
For advanced needs, overridesetup_logging() (e.g. a custom JSON sink like GCPJsonSink for GCP Cloud Logging) or get_bake_log_thread_local_context() (inject trace IDs into each log line) on your Bakebook.