Skip to content

Logging setup #8

@heilerich

Description

@heilerich

Hi there,
thank you for your awesome work here! I just have one tiny problem with your module:

Importing your module breaks the logging setup of the importing module because you're calling basicConfig (which cannot be used twice) on import here

logging.basicConfig(level=logging.ERROR)

I think it would be good practice to remove that call entirely so that the user of the module can decide how he want's to setup his logger. If you insist on setting the logLevel I would suggest using logger.setLevel which only modifies your own logger.
An alternative would be calling basicConfig in your class initialization, in case the user hasn't done it so far. This ensures that a logger is properly setup but doesn't overwrite anything if the user has already done his own logging setup (which usually happens after importing modules but before initializing any classes).
But as I said, I would leave the choices of logging setup to the user. Everyone has different loggging needs ;)

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