#21429: BaseCommand should use logging instead of custom output wrappers
--------------------------------------------+------------------------------
Reporter: Nical | Owner: nobody
Type: New feature | Status: new
Component: Core (Management commands) | Version: 1.6
Severity: Normal | Keywords: command output
Triage Stage: Unreviewed | logger
Easy pickings: 0 | Has patch: 0
| UI/UX: 0
--------------------------------------------+------------------------------
Since python offers the powerful logging class,
django.core.management.base.BaseCommand should use it to output messages
instead of using custom output wrappers
(django.core.management.base.OutputWrapper).
Doing so, we could override those loggers in the settings.py file.
Instead of having two wrappers in a command and having to do:
{{{
class Command(BaseCommand):
def handle(self):
self.stdout.write('this is an info message')
self.stderr.write('this is an error message')
}}}
We could do
{{{
class Command(BaseCommand):
def handle(self):
self.output.info('this is an info message')
self.output.error('this is an error message')
# and even
self.output.warning('this is a warning message')
}}}
The style_func and ending arguments that the
django.core.management.base.OutputWrapper.write method takes could be
removed and be configured at once in a overriding custom logger.
--
Ticket URL: <https://code.djangoproject.com/ticket/21429>
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/048.29dd58f1fbb8f699c5bde6c2d5a6bca8%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.