<html><body>
<p>1 new commit in yt:</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/c55b7a1e36bf/">https://bitbucket.org/yt_analysis/yt/commits/c55b7a1e36bf/</a> Changeset:   c55b7a1e36bf Branch:      yt User:        jzuhone Date:        2016-04-06 18:09:47+00:00 Summary:     Merged in ngoldbaum/yt (pull request #2102)</p>
<p>logging: don't create a StreamHandler unless we will use it. Closes #1024 Affected #:  1 file</p>
<p>diff -r 068a53069cdff7da3ad9597a7bb868fcafabecb2 -r c55b7a1e36bf638dffa73074a047cc5c2e245bf7 yt/utilities/logger.py --- a/yt/utilities/logger.py +++ b/yt/utilities/logger.py @@ -54,36 +54,43 @@</p>
<pre>ytLogger = logging.getLogger("yt")
</pre>
<p>-yt_sh = logging.StreamHandler(stream=stream) -# create formatter and add it to the handlers -formatter = logging.Formatter(ufstring) -yt_sh.setFormatter(formatter) -# add the handler to the logger -ytLogger.addHandler(yt_sh) -ytLogger.setLevel(level) -ytLogger.propagate = False –</p>
<pre>def disable_stream_logging():</pre>
<ul><li><p>ytLogger.removeHandler(ytLogger.handlers[0])</p></li></ul>
<p>+    if len(ytLogger.handlers) > 0: +        ytLogger.removeHandler(ytLogger.handlers[0])</p>
<pre>    h = logging.NullHandler()
    ytLogger.addHandler(h)
</pre>
<p>-original_emitter = yt_sh.emit –</p>
<pre>def colorize_logging():
    f = logging.Formatter(cfstring)
    ytLogger.handlers[0].setFormatter(f)
    yt_sh.emit = add_coloring_to_emit_ansi(yt_sh.emit)

def uncolorize_logging():</pre>
<ul><li><p>f = logging.Formatter(ufstring)</p></li>
<li><p>ytLogger.handlers[0].setFormatter(f)</p></li>
<li><p>yt_sh.emit = original_emitter</p></li></ul>
<p>– -if ytcfg.getboolean("yt", "coloredlogs"):</p>
<ul><li><p>colorize_logging()</p></li></ul>
<p>+    try: +        f = logging.Formatter(ufstring) +        ytLogger.handlers[0].setFormatter(f) +        yt_sh.emit = original_emitter +    except NameError: +        # yt_sh and original_emitter are not defined because +        # suppressStreamLogging is True, so we continue since there is nothing +        # to uncolorize +        pass</p>
<pre>if ytcfg.getboolean("yt", "suppressStreamLogging"):
    disable_stream_logging()</pre>
<p>+else: +    yt_sh = logging.StreamHandler(stream=stream) +    # create formatter and add it to the handlers +    formatter = logging.Formatter(ufstring) +    yt_sh.setFormatter(formatter) +    # add the handler to the logger +    ytLogger.addHandler(yt_sh) +    ytLogger.setLevel(level) +    ytLogger.propagate = False + +    original_emitter = yt_sh.emit + +    if ytcfg.getboolean("yt", "coloredlogs"): +        colorize_logging()</p>
<pre>ytLogger.debug("Set log level to %s", level)</pre>
<p>Repository URL: <a href="https://bitbucket.org/yt_analysis/yt/">https://bitbucket.org/yt_analysis/yt/</a></p>
<p>—</p>
<p>This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.</p>

<img src="http://link.bitbucket.org/wf/open?upn=ll4ctv0L-2ByeRZFC1LslHcg6aJmnQ70VruLbmeLQr27AcAE3taOIVWAcGRZBwR8C7Eytrp51fZaPyGlhmOvy1PuQcMJgVtLOF2MZ7BmgZQUgqU3Jkv6ksv9DLgnsDhFERC0cKBxkFYKYBv07rLh4t478rV2qTONWsOqyrU9-2F-2Fin9nwjy2sX22zdI1omsIgee8EgcgvMH0LNFyU35iVq7nJ5dlI6n-2BZBbBLukTJHNq0u0-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;"/>
</body></html>