Adopt a single logging approach across commands and services:
print/direct FileHandle.standardError.write in production code for user-facing or diagnostic messages. Use Logger.AsyncLoggableCommand, use the provided log—don’t create a redundant logger.log: Logger (or log: Logger? when optional) from the caller; don’t do unconditional stderr output inside the helper.metadata dictionaries over interpolating values into the message.
log.warning(
"failed to load container",
metadata: ["path": dir.path, "error": String(describing: error)]
)
warning/error for actionable issues, and use debug/trace for noisy entry/exit or busy calls.Applying this consistently will keep stderr output clean, make logs machine-parseable, and ensure logging behavior follows configured verbosity (e.g., --debug should increase log level via the logger/handler, not by adding new ad-hoc prints).