def disable_logger(): """Context manager to disable asyncio logger. For example, it can be used to ignore warnings in debug mode. """ old_level = logger.level try: logger.setLevel(logging.CRITICAL + 1) yield finally: logger.setLevel(old_level)
def disable_logger(): """Context manager to disable asyncio logger. For example, it can be used to ignore warnings in debug mode. """ old_level = logger.level try: logger.setLevel(logging.CRITICAL+1) yield finally: logger.setLevel(old_level)
def main(): """Main loop""" LOGGER.setLevel(logging.DEBUG) # enable debug logging # read commandline flags and ensure they are valid args = parse_arguments() check_args(args) # load user's config file config_args = load_configs() # determine the type of tagger to use for the provided files tagger_type = TVTagger if args.TV else MovieTagger if args.Music: tagger_type = MusicTagger # create a task future for each file to be tagged, grab an event loop from # asyncio, and run the futures asynchronously tasks = get_tasks(args.files, tagger_type, config_args) loop = asyncio.get_event_loop() loop.run_until_complete(asyncio.wait(tasks))
import logging import re import sys from asyncio.log import logger as _asyncioLogger from datetime import timedelta from pathlib import Path from typing import TYPE_CHECKING from loguru import logger as _logger from .config import Config if TYPE_CHECKING: from loguru import Logger _asyncioLogger.setLevel(40) LOG_PATH = Path(".") / "data" / "logs" LOG_PATH.mkdir(parents=True, exist_ok=True) LOG_FORMAT = Config["log"]["format"].as_str().strip() LOG_LEVEL = Config["log"]["level"].as_str().upper() logger: "Logger" = _logger.opt(colors=True) logger.remove() logger.add( LOG_PATH / "{time}.log", level=LOG_LEVEL, encoding="utf-8", enqueue=True, compression="zip", rotation=timedelta(days=1),
# SPDX-License-Identifier: Apache-2.0 from asyncio.log import logger import re import os import subprocess from collections import OrderedDict import xml.etree.ElementTree as ET import logging logger = logging.getLogger('twister') logger.setLevel(logging.DEBUG) # pylint: disable=anomalous-backslash-in-string result_re = re.compile( ".*(PASS|FAIL|SKIP) - (test_)?(.*) in (\d*[.,]?\d*) seconds") class Harness: GCOV_START = "GCOV_COVERAGE_DUMP_START" GCOV_END = "GCOV_COVERAGE_DUMP_END" FAULT = "ZEPHYR FATAL ERROR" RUN_PASSED = "PROJECT EXECUTION SUCCESSFUL" RUN_FAILED = "PROJECT EXECUTION FAILED" run_id_pattern = r"RunID: (?P<run_id>.*)" ztest_to_status = { 'PASS': '******', 'SKIP': 'skipped', 'BLOCK': 'blocked', 'FAIL': 'failed' }