Skip to content

Don't allow passing in loguru #420

@crizCraig

Description

@crizCraig

Loguru is not api compatible with standard logging despite efforts in #294, so it may be best to raise an error or wrap the loguru logger with a standard logger when doing this

from loguru import logger
@retry(
    stop=stop_after_attempt(10),
    wait=wait_random_exponential(multiplier=1, max=10),
    reraise=True,
    before_sleep=before_sleep_log(logger, "ERROR"),  # type: ignore
    after=after_log(logger, "ERROR"),  # type: ignore
)

As it can cause a KeyError due to this

Here's a wrapping approach which may be the best thing for people to setup in accordance with their own logging needs. Not sure if @Delgan has a better approach though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions