Source code for verboselogs.pylint

# Verbose, notice, and spam log levels for Python's logging module.
# Author: Glenn Matthews <>
# Last Change: August 7, 2017
# URL:

Pylint_ plugin to fix invalid errors about the :mod:`logging` module.

.. _Pylint:

from astroid import MANAGER, scoped_nodes, nodes

[docs]def register(linter): """No-op (required by Pylint)."""
[docs]def verboselogs_class_transform(cls): """Make Pylint aware of our custom logger methods.""" if == 'RootLogger': for meth in ['notice', 'spam', 'success', 'verbose']: cls.locals[meth] = [scoped_nodes.Function(meth, None)]
[docs]def verboselogs_module_transform(mod): """Make Pylint aware of our custom log levels.""" if == 'logging': for const in ['NOTICE', 'SPAM', 'SUCCESS', 'VERBOSE']: mod.locals[const] = [nodes.Const(const)]
# Register the above methods with Pylint. MANAGER.register_transform(scoped_nodes.Class, verboselogs_class_transform) MANAGER.register_transform(scoped_nodes.Module, verboselogs_module_transform)