Skip to content

deprecated-log-warn (PGH002)#

Derived from the pygrep-hooks linter.

Warning: This rule has been removed and its documentation is only available for historical reasons.

Fix is sometimes available.


This rule is identical to G010 which should be used instead.

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")