Skip to content

Use python logging module for util.log(), separate into log levels #390

Description

@comps

The lib.util.log code can be modified to look like atex/util/log.py to be usable natively with Python's logging module, and then split into multiple functions like util.debug(), util.info(), util.warning(), etc.

This is very useful for multiple levels of verbosity, allowing us to run with ie. info or warning during large productization runs, but override that with debug when debugging a single test.

This would allow us to see fine details like ssh key generation, virsh executions for starting up VMs, systemctl commands to query a service, etc. ... For example, the util.subprocess_* functions could take loglevel= argument rather than being "verbose vs silent" as now.

The code to set up console logging would be in lib/runtest.py and look like

logging.basicConfig(
    level=logging.INFO,
    stream=sys.stderr,
    format='%(asctime)s %(name)s: %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S',
)

(to simulate the output format we have now)

In that example, logging.INFO could come from some CONTEST_LOGLEVEL env var, or something like that, again checked in lib/runtest.py to avoid extra test code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions