color_enabled is initialized on line 58 of msg.py. I did this in the same way as other class variables are initialized.<div><br></div><div><div> levelnames = {</div><div> DEBUG3 : 'DEBUG',</div><div> DEBUG2 : 'DEBUG',</div>
<div> DEBUG : 'DEBUG',</div><div> VERBOSE: 'NOTE',</div><div> NOTE : 'NOTE',</div><div> PLAIN : '',</div><div> WARNING : 'WARNING',</div><div>
ERROR : 'ERROR',</div><div> CRITICAL: 'ERROR',</div><div> }</div><div><br></div><div> color_enabled = False</div><div> BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(30,38)</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Nov 11, 2012 at 4:54 PM, Chris Larson <span dir="ltr"><<a href="mailto:clarson@kergoth.com" target="_blank">clarson@kergoth.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Nov 11, 2012 at 8:17 AM, Seth Bollinger <span dir="ltr"><<a href="mailto:seth.boll@gmail.com" target="_blank">seth.boll@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><font face="arial, sans-serif">@@ -67,6 +86,8 @@ class BBLogFormatter(logging.Formatter):</font></div>
<div><font face="arial, sans-serif"> if record.levelno == self.PLAIN:</font></div><div><font face="arial, sans-serif"> msg = record.getMessage()</font></div><div><font face="arial, sans-serif"> else:</font></div>
<div><font face="arial, sans-serif">+ if self.color_enabled:</font></div><div><font face="arial, sans-serif">+ self.colorize(record)</font></div></blockquote></div><br><br>I'm not seeing your definition of color_enabled in the constructor. Wouldn't this attribute not exist when it's first created, before enable_color() is called? Have you tested this with a non-interactive terminal? I'd think you'd want a self.color_enabled = False in the constructor for the formatter.<span class="HOEnZb"><font color="#888888"><br>
-- <br>Christopher Larson<br>
</font></span></div>
</blockquote></div><br></div>