tmt icon indicating copy to clipboard operation
tmt copied to clipboard

Silencing the logger output

Open Athwale opened this issue 1 year ago • 14 comments

Hi, there does not seem to be a way of silencing warning messages from tmt in python.

Run the example below in a test directory with main.fmf with a wrong attribute for example "lik" instead of "link" You will get: warn: /Sanity/experimental-test-will-be-removed-please-ignore-this-case: - 'lik' does not match any of the regexes: '^extra- Despite all attempts at disabling output.'

#!/bin/python3

import tmt
import fmf
import logging

logger = tmt.log.Logger.create()
logger.quiet = True
logger._logger.setLevel(logging.ERROR)
tree = tmt.Tree(tree=fmf.Tree('.'), logger=logger)

for test in tree.tests(logger=logger):
    print(test)

Athwale avatar May 23 '23 11:05 Athwale