From: W. Trevor King Date: Thu, 1 Jul 2010 04:18:51 +0000 (-0400) Subject: Only initize logger once X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c1364f85a7a163025acf836ea55e14549a5af339;p=sitecorepy.git Only initize logger once --- diff --git a/sitecore/__init__.py b/sitecore/__init__.py index 90a3892..63fc6a2 100755 --- a/sitecore/__init__.py +++ b/sitecore/__init__.py @@ -37,7 +37,13 @@ try: except ImportError, e: WebDriver = e # allow some functionality without selenium + +_LOGGER = None + def get_logger(verbose=0): + global _LOGGER + if _LOGGER != None: + return LOGGER verbosities = [ # in order of decreasing severity logging.CRITICAL, logging.ERROR, @@ -59,6 +65,7 @@ def get_logger(verbose=0): ch.setFormatter(formatter) # add ch to logger logger.addHandler(ch) + _LOGGER = logger return logger