#27691: Avoid `logger=logging.getLogger(__name__)`
--------------------------------+--------------------------------------
     Reporter:  Thomas Güttler  |                    Owner:  nobody
         Type:  Uncategorized   |                   Status:  new
    Component:  Uncategorized   |                  Version:  1.10
     Severity:  Normal          |               Resolution:
     Keywords:                  |             Triage Stage:  Unreviewed
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+--------------------------------------

Comment (by Simon Charette):

 > I don't like it. But I like the optimize-Imports feature of PyCharm, and
 the following line (often between the imports) disturbs this.

 Is there a reason you can't instantiate the logger after all of your
 imports instead of in the middle of them?

 > Is there no way to avoid this logger = logging.getLogger(__name__) ?

 I don't think so if you want to create a namespaced logger. If you don't
 mind logging all of your messages in the ''root'' namespace and relying on
 a formatter to describe their origin nothing prevents you from doing it
 (by using logging directly) but I don't think it's a practice we should
 encourage as the main strength of the logging framework lies in per-
 namespace routing of messages.

 From my experience the more complex your application gets the more it will
 require namespaced logging messages. It's also a hard requirement if
 you're writing any kind of third-party applications.

--
Ticket URL: <https://code.djangoproject.com/ticket/27691#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.f1798608eb8b926ba97a554480949d00%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to