avocado.sysinfo: Refactor console handler addition

Signed-off-by: NLucas Meneghel Rodrigues <lmr@redhat.com>
上级 c6599db2
......@@ -16,6 +16,16 @@ def get_paginator():
return sys.stdout
def add_console_handler(logger):
"""
Add a console handler to a logger.
"""
console_handler = logging.StreamHandler()
formatter = logging.Formatter(fmt='%(message)s')
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)
class Bcolors(object):
"""
......
......@@ -7,6 +7,7 @@ import time
from avocado import utils
from avocado.linux import software_manager
from avocado.core import output
log = logging.getLogger("avocado.utils")
......@@ -455,10 +456,7 @@ def collect_sysinfo(args):
"""
Collect sysinfo to a base directory.
"""
console_handler = logging.StreamHandler()
formatter = logging.Formatter(fmt='%(message)s')
console_handler.setFormatter(formatter)
log.addHandler(console_handler)
output.add_console_handler(log)
basedir = args.sysinfodir
if not basedir:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册