|
|
@ -5,6 +5,7 @@ import json
|
|
|
|
import logging
|
|
|
|
import logging
|
|
|
|
import os.path
|
|
|
|
import os.path
|
|
|
|
import subprocess
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import tempfile
|
|
|
|
import tempfile
|
|
|
|
import textwrap
|
|
|
|
import textwrap
|
|
|
|
import threading
|
|
|
|
import threading
|
|
|
@ -115,6 +116,7 @@ class Bureau(object):
|
|
|
|
log_format = logging.Formatter('LOG ${levelname} $name: $message', style='$')
|
|
|
|
log_format = logging.Formatter('LOG ${levelname} $name: $message', style='$')
|
|
|
|
log_printer.setFormatter(log_format)
|
|
|
|
log_printer.setFormatter(log_format)
|
|
|
|
self.log.addHandler(log_printer)
|
|
|
|
self.log.addHandler(log_printer)
|
|
|
|
|
|
|
|
sys.excepthook = self._log_exception
|
|
|
|
|
|
|
|
|
|
|
|
# setup a dir to store files and data
|
|
|
|
# setup a dir to store files and data
|
|
|
|
self.datadir = os.path.join(basepath, self.prefix)
|
|
|
|
self.datadir = os.path.join(basepath, self.prefix)
|
|
|
@ -133,6 +135,10 @@ class Bureau(object):
|
|
|
|
self.log.debug("commands: ")
|
|
|
|
self.log.debug("commands: ")
|
|
|
|
self.log.debug(str(self.commands))
|
|
|
|
self.log.debug(str(self.commands))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _log_exception(typ, value, tb):
|
|
|
|
|
|
|
|
self.log.error("CRASH TRACE: {0}".format(str(value)), exc_info=(typ, value, tb))
|
|
|
|
|
|
|
|
sys.__excepthook__(typ, value, tb)
|
|
|
|
|
|
|
|
|
|
|
|
def load_config(self):
|
|
|
|
def load_config(self):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
load (or reload) config data from file
|
|
|
|
load (or reload) config data from file
|
|
|
|