globality-corp / flake8-logging-format

Flake8 extension to validate (lack of) logging format strings
Apache License 2.0
134 stars 21 forks source link

False positive on G201 when getting the exc_info from a dict #24

Open lindycoder opened 4 years ago

lindycoder commented 4 years ago

Hello :)

Thank you for this tool, i noticed that if I try to specify an exc_info with a value coming from a dict defaulting to True, it would get flag as G201 Logging: .exception(...) should be used instead of .error(..., exc_info=True)

logger.error('My Message', exc_info=mydict.get('exc_info', True))

I'm not convinced rewriting my code with an if to use .exception instead of .error is better.

If you think this is not a False positive, feel free to close this :)

Thank you!