Commit 3dc5e1fd authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis
Browse files

ci: Redirect logging to stdout/stderr

Use stdout for info/debug messages and stderr for
warning/error messages.
parent a187bc69
...@@ -91,6 +91,15 @@ class _MyFormatter(logging.Formatter): ...@@ -91,6 +91,15 @@ class _MyFormatter(logging.Formatter):
return result return result
# Too few public methods. pylint: disable-msg=R0903
class _InfoFilter(logging.Filter):
"""Logging Filter that allows DEBUG and INFO messages only"""
def filter(self, rec):
"""The filter"""
return rec.levelno in (logging.DEBUG, logging.INFO)
# Too many instance attributes. pylint: disable-msg=R0902
class SynnefoCI(object): class SynnefoCI(object):
"""SynnefoCI python class""" """SynnefoCI python class"""
...@@ -102,9 +111,17 @@ class SynnefoCI(object): ...@@ -102,9 +111,17 @@ class SynnefoCI(object):
# Setup logger # Setup logger
self.logger = logging.getLogger('synnefo-ci') self.logger = logging.getLogger('synnefo-ci')
self.logger.setLevel(logging.DEBUG) self.logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
handler.setFormatter(_MyFormatter()) handler1 = logging.StreamHandler(sys.stdout)
self.logger.addHandler(handler) handler1.setLevel(logging.DEBUG)
handler2 = logging.StreamHandler(sys.stderr)
# Get our local dir # Get our local dir
self.ci_dir = os.path.dirname(os.path.abspath(__file__)) self.ci_dir = os.path.dirname(os.path.abspath(__file__))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment