Skip to content

deprecated-log-warn (PGH002)#

Derived from the pygrep-hooks linter.

What it does#

Check for usages of the deprecated warn method from the logging module.

Why is this bad?#

The warn method is deprecated. Use warning instead.


import logging

def foo():
    logging.warn("Something happened")

Use instead:

import logging

def foo():
    logging.warning("Something happened")