[Yt-svn] commit/yt: MatthewTurk: Fixing root logger handler format setting for suppressed stream logging.
Bitbucket
commits-noreply at bitbucket.org
Thu Mar 3 15:23:57 PST 2011
1 new changeset in yt:
http://bitbucket.org/yt_analysis/yt/changeset/29546a479f3e/
changeset: r3783:29546a479f3e
branch: yt
user: MatthewTurk
date: 2011-03-04 00:23:35
summary: Fixing root logger handler format setting for suppressed stream logging.
affected #: 2 files (131 bytes)
--- a/yt/utilities/logger.py Sun Feb 27 22:33:20 2011 -0500
+++ b/yt/utilities/logger.py Thu Mar 03 18:23:35 2011 -0500
@@ -73,11 +73,11 @@
original_emitter = logging.StreamHandler.emit
def colorize_logging():
f = logging.Formatter(cfstring)
- rootLogger.handlers[0].setFormatter(f)
+ if len(rootLogger.handlers) > 0: rootLogger.handlers[0].setFormatter(f)
logging.StreamHandler.emit = add_coloring_to_emit_ansi(logging.StreamHandler.emit)
def uncolorize_logging():
f = logging.Formatter(ufstring)
- rootLogger.handlers[0].setFormatter(f)
+ if len(rootLogger.handlers) > 0: rootLogger.handlers[0].setFormatter(f)
logging.StreamHandler.emit = original_emitter
if ytcfg.getboolean("yt","coloredlogs"):
--- a/yt/utilities/parallel_tools/parallel_analysis_interface.py Sun Feb 27 22:33:20 2011 -0500
+++ b/yt/utilities/parallel_tools/parallel_analysis_interface.py Thu Mar 03 18:23:35 2011 -0500
@@ -69,7 +69,8 @@
# we reset it again so that it includes the processor.
f = logging.Formatter("P%03i %s" % (MPI.COMM_WORLD.rank,
yt.utilities.logger.ufstring))
- yt.utilities.logger.rootLogger.handlers[0].setFormatter(f)
+ if len(yt.utilities.logger.rootLogger.handlers) > 0:
+ yt.utilities.logger.rootLogger.handlers[0].setFormatter(f)
if ytcfg.getboolean("yt", "parallel_traceback"):
sys.excepthook = traceback_writer_hook("_%03i" % MPI.COMM_WORLD.rank)
if ytcfg.getint("yt","LogLevel") < 20:
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list