#32552: Change DiscoverRunner to use a logger instead of print
-------------------------------------+-------------------------------------
     Reporter:  Chris Jerdonek       |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Testing framework    |                  Version:  4.0
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
  DiscoverRunner,print,logging,stdout,stderr|  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Chris Jerdonek):

 Only the last three are in the `DiscoverRunner` class. The others have
 different considerations.

 I don't think this ticket is necessarily straightforward. For example, I
 think the behavior should be opt-in (at least for now) because callers
 might not have logging enabled. I'm not sure yet what the API should be
 for opting in though. I'm still thinking about it.

 I think a good first step would be to add a `log(level, msg)` method to
 the `DiscoverRunner` class that preserves the existing `print()` behavior.
 I.e. the signature of the method would match:
 https://docs.python.org/3/library/logging.html#logging.Logger.log
 And then change the class to use that method for its print statements. The
 method would use the given `level` and compare to `self.verbosity` to
 determine whether the message should be printed.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32552#comment:3>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.f78ad1aa94940fc5aa9e2d36f34f4e20%40djangoproject.com.

Reply via email to