def setUp(self): (self.fd, self.logfn) = tempfile.mkstemp() self.handle = os.fdopen(self.fd) # set the test log format fancylogger.setTestLogFormat() # make new logger fancylogger.logToFile(self.logfn) # disable default ones (with default format) fancylogger.disableDefaultHandlers()
def setUp(self): (self.fd, self.logfn) = tempfile.mkstemp() self.handle = os.fdopen(self.fd) # set the test log format fancylogger.setTestLogFormat() # make new logger fancylogger.logToFile(self.logfn) # disable default ones (with default format) fancylogger.disableDefaultHandlers() self.orig_raise_exception_class = fancylogger.FancyLogger.RAISE_EXCEPTION_CLASS self.orig_raise_exception_method = fancylogger.FancyLogger.RAISE_EXCEPTION_LOG_METHOD
def make_worker_log(name, debug=False, logfn_name=None, disable_defaulthandlers=False): """Make a basic log object""" if logfn_name is None: logfn_name = name logfn = '/tmp/scoop_%s.log' % logfn_name if debug: setLogLevelDebug() logToFile(logfn, name=name) os.chmod(logfn, stat.S_IRUSR | stat.S_IWUSR) if disable_defaulthandlers: disableDefaultHandlers() _log = getLogger(name=name) return _log
import unittest from vsc.utils import fancylogger # initialize EasyBuild logging, so we disable it from easybuild.tools.build_log import EasyBuildError from easybuild.tools.config import set_tmpdir # set plain text key ring to be used, so a GitHub token stored in it can be obtained without having to provide a password try: import keyring keyring.set_keyring(keyring.backends.file.PlaintextKeyring()) except ImportError: pass # disable all logging to significantly speed up tests fancylogger.disableDefaultHandlers() fancylogger.setLogLevelError() # toolkit should be first to allow hacks to work import test.framework.asyncprocess as a import test.framework.config as c import test.framework.easyblock as b import test.framework.easyconfig as e import test.framework.easyconfigparser as ep import test.framework.easyconfigformat as ef import test.framework.ebconfigobj as ebco import test.framework.easyconfigversion as ev import test.framework.filetools as f import test.framework.format_convert as f_c import test.framework.general as gen import test.framework.github as g