<div dir="ltr">I get a message back that I'm not subscribed to the mailing list, but see my message in google groups. My sincerest apologies in advance, if this appears several times for you. Anyways:<br><br>The logging module has an easy-to-setup logger:<br><br> import logging<br> logger = logging.getLogger(__name__)<br> <br>and you just log away. Easy.<br><br>However, it's quite a bit more difficult to set up log readers, requiring IMO an unreasonably number of lines of code:<br><br> import logging<br><br> logger = logging.getLogger('mypackage')<br> logger.setLevel(logging.DEBUG)<br> handler = logging.StreamHandler()<br> formatter = logging.Formatter('%(<div dir="ltr"><wbr>levelname)s:%(name)s:%(<wbr>message)s')<br> handler.setFormatter(<wbr>formatter)<br> logger.addHandler(handler)<br><br>I
propose adding a function that sets up a log reader with sensible
defaults, but allowing customization. So, I propose a
``logging.getLogReader`` in the logging module to mirror
``logging.getLogger``. So, to use this, in your main.py, you'd typically
just do:<br><br> import logging<br><br> log_reader = logging.getLogReader('<wbr>mypackage.models')<br><br><br>and you'd get all log output from mypackage.models with sensible defaults set. Much easier. <br><br>You could also set up it up in more detail, e.g.:<br><br> log_reader = logging.getLogReader('<wbr>mypackage.models',<br> <wbr> level='debug',<br> <wbr> format='%(levelname)s | %(filename)s| line %(lineno)s | %(message)s'<br> <wbr> )<br><br>For a specific proposal, see:<br><br><a href="https://gist.github.com/topper-123/85e27ffe261850eed150eac53d61b82d" target="_blank" rel="nofollow">https://gist.github.com/<wbr>topper-123/<wbr>85e27ffe261850eed150eac53d61b8<wbr>2d</a><br><br>Because it's just a logger, log_reader can be further customized as necessary. <br><br>In
summary, I think that today it's unneccesarily complex to set up a log
reader and the proposed function serves a general enough need, that it -
or something similar - should be in the logging module. Thoughts?<br></div></div>