Skip to content

chk_log_value spams the debug log with suppressed errors #235

@daniel-montanari

Description

@daniel-montanari

Not super important, I just noticed when looking through the atdev log for testing NATA scripts there were a hundred lines of silent errors with the formatter. My understanding is that logging values should be fairly arbitrary in the data that is accepted, and I don't see the value in rounding logged things.

Maybe when we get onto 3.13 we can figure out how to use generics to make it clearer what values a check and all its methods expect.

def chk_log_value(test_val, description="", fmt=None) -> bool:
    """Log test_val"""
    return _message_parse(
        test_val=test_val,
        target=_log_value,
        description=description,
        formatter=_format_testvalue,
        fmt=fmt,
    )
...

def _format_testvalue(chk: _CheckClass) -> str:
    fmt = chk.fmt if chk.fmt is not None else ".3g"  # Default
    return f"{chk.status}: {chk.test_val:{fmt}} : {chk.description}"

ValueError: Unknown format code 'g' for object of type 'str'

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