1 ##############################################################################
2 # Copyright (c) 2015 Ericsson AB and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
14 import yardstick.vTC.apexlake as apexlake
16 # Hack to be able to run apexlake unit tests
17 # without having to install apexlake.
18 sys.path.append(os.path.dirname(apexlake.__file__))
20 LOG_FILE = '/tmp/yardstick.log'
21 LOG_FORMATTER = ('%(asctime)s '
22 '%(name)s %(filename)s:%(lineno)d '
23 '%(levelname)s %(message)s')
25 _LOG_FORMATTER = logging.Formatter(LOG_FORMATTER)
26 _LOG_STREAM_HDLR = logging.StreamHandler()
27 _LOG_FILE_HDLR = logging.FileHandler(LOG_FILE)
29 LOG = logging.getLogger(__name__)
34 _LOG_STREAM_HDLR.setFormatter(_LOG_FORMATTER)
36 # don't append to log file, clobber
37 _LOG_FILE_HDLR.setFormatter(_LOG_FORMATTER)
39 del logging.root.handlers[:]
40 logging.root.addHandler(_LOG_STREAM_HDLR)
41 logging.root.addHandler(_LOG_FILE_HDLR)
42 logging.debug("logging.root.handlers = %s", logging.root.handlers)
44 if os.environ.get('CI_DEBUG', '').lower() in {'1', 1, 'y', "yes", "true"}:
45 LOG.setLevel(logging.DEBUG)
47 LOG.setLevel(logging.INFO)