refactored logging setup when mm is setup
This commit is contained in:
parent
eaf0baa6b6
commit
350d5dd620
|
@ -22,6 +22,17 @@ from std_err_override import LogWriter
|
||||||
import media.monitor.pure as mmp
|
import media.monitor.pure as mmp
|
||||||
from api_clients import api_client as apc
|
from api_clients import api_client as apc
|
||||||
|
|
||||||
|
def setup_logger(log_config, logpath):
|
||||||
|
logging.config.fileConfig(log_config)
|
||||||
|
#need to wait for Python 2.7 for this..
|
||||||
|
#logging.captureWarnings(True)
|
||||||
|
logger = logging.getLogger()
|
||||||
|
LogWriter.override_std_err(logger)
|
||||||
|
logfile = unicode(logpath)
|
||||||
|
setup_logging(logfile)
|
||||||
|
log = get_logger()
|
||||||
|
return log
|
||||||
|
|
||||||
def setup_global(log):
|
def setup_global(log):
|
||||||
""" setup unicode and other stuff """
|
""" setup unicode and other stuff """
|
||||||
log.info("Attempting to set the locale...")
|
log.info("Attempting to set the locale...")
|
||||||
|
@ -55,18 +66,8 @@ def main(global_config, api_client_config, log_config,
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Unknown error reading configuration file: '%s'" % global_config)
|
print("Unknown error reading configuration file: '%s'" % global_config)
|
||||||
print(str(e))
|
print(str(e))
|
||||||
|
|
||||||
|
log = setup_logger( log_config, config['logpath'] )
|
||||||
logging.config.fileConfig(log_config)
|
|
||||||
|
|
||||||
#need to wait for Python 2.7 for this..
|
|
||||||
#logging.captureWarnings(True)
|
|
||||||
|
|
||||||
logger = logging.getLogger()
|
|
||||||
LogWriter.override_std_err(logger)
|
|
||||||
logfile = unicode( config['logpath'] )
|
|
||||||
setup_logging(logfile)
|
|
||||||
log = get_logger()
|
|
||||||
|
|
||||||
if not index_create_attempt:
|
if not index_create_attempt:
|
||||||
if not os.path.exists(config['index_path']):
|
if not os.path.exists(config['index_path']):
|
||||||
|
|
Loading…
Reference in New Issue