[Python-projects] Checker for use of the standard logging module

Nathaniel Manista nathaniel at google.com
Mon Jun 15 00:31:51 CEST 2009


On Thu, Jun 11, 2009 at 8:33 AM, Sylvain Thénault <
sylvain.thenault at logilab.fr> wrote:

> On 10 juin 18:58, Nathaniel Manista wrote:
> > Pylint developers-
>
> Hey Nathaniel,
>
> >     Another patch (this time wrapped up by "hg bundle"). Let me know what
> > you think.
>
> it's fine with me. And hg bundle rocks ;) I've checked it in. What would be
> great is to have it working on case such as:
>
>  logger = logging.getLogger('mylogger')
>  logger.warn('hop %s' % 'whatever')
>
> but that's a start.


I agree that this would be ideal, but I think doing it correctly requires
static typing. Truth be told, there's a little static typing going on with
the way the checker currently checks calls to module-level logging methods,
but it works because programmers who rename or reassign modules after they
have been imported generally deserve the bad things that they get as a
result.
Checking calls to logging methods called on logger instances could possibly
be done, and done well, but I'm not sure that I'll be the one to do it, or
when.


> Also would you add a note as Martin suggested about
> why it's worth ?
>

I've enhanced the in-code documentation string to include a few words about
the value of the delayed interpolation form; I hope that this is what you
and Maarten had in mind. Please find another bundle attached.


>
> thank you for your contribution!


You're welcome!
-Nathaniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.logilab.org/pipermail/python-projects/attachments/20090614/e52ecb50/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nathaniel_logging_comment.bundle
Type: application/octet-stream
Size: 3029 bytes
Desc: not available
URL: <http://lists.logilab.org/pipermail/python-projects/attachments/20090614/e52ecb50/attachment.obj>


More information about the Python-Projects mailing list