config.configure_logging()

Configure the global loguru logger for an application entry point.

Usage

Source

config.configure_logging(
    *, level=None, console=False, log_file=None, diagnose=False, plugin=False
)

Call this ONCE, explicitly, from an application’s main() (or, for the napari plugin, from the top-level widget — see configure_logging_once). Libraries must never call it. Because loguru’s logger is a single process-global object, this one call governs logging for every module in every package in the process.

Production defaults (zero config required): a rotating file sink at INFO, console off (the Rich progress display / panels are the user channel — a console log sink would corrupt them). Calling it again simply re-applies the configuration (logger.remove() first), so it is safe to call from an idempotent widget hook.

Resolution precedence for level/log_file is argument > env var > default (env vars OMERO_SCREEN_LOG_LEVEL / OMERO_SCREEN_LOG_FILE, read here at call time — never at import).

Parameters

level: str | None = None

Minimum level (e.g. "DEBUG"). Falls back to OMERO_SCREEN_LOG_LEVEL then "INFO".

console: bool = False

Add a Rich console sink (sharing progress.py’s Console). Off by default; turn on for --verbose / interactive debugging.

log_file: str | None = None

File-sink path. Falls back to OMERO_SCREEN_LOG_FILE then logs/app.log. "none"/"off"/"" disables the file sink.

diagnose: bool = False

loguru variable-value tracebacks. Off in production (can leak values/secrets into the log); on for --verbose.

plugin: bool = False
When embedded in a host that owns the stdlib root logger (napari), skip installing the stdlib InterceptHandler.