How to use the stm32pio.util.Verbosity.VERBOSE function in stm32pio

To help you get started, we’ve selected a few stm32pio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ussserrr / stm32pio / stm32pio_gui / app.py View on Github external
def verbose_setter(value):
        """Use this to toggle the verbosity of all loggers at once"""
        module_logger.setLevel(logging.DEBUG if value else logging.INFO)
        qml_logger.setLevel(logging.DEBUG if value else logging.INFO)
        projects_logger.setLevel(logging.DEBUG if value else logging.INFO)
        formatter.verbosity = stm32pio.util.Verbosity.VERBOSE if value else stm32pio.util.Verbosity.NORMAL
github ussserrr / stm32pio / stm32pio / app.py View on Github external
Returns:
        logging.Logger instance
    """
    if dummy:
        logger = logging.getLogger(__name__)
        logger.addHandler(logging.NullHandler())
    else:
        logger = logging.getLogger('stm32pio')
        logger.setLevel(logging.DEBUG if args_verbose_counter else logging.INFO)
        handler = logging.StreamHandler()
        formatter = stm32pio.util.DispatchingFormatter(
            verbosity=stm32pio.util.Verbosity.VERBOSE if args_verbose_counter else stm32pio.util.Verbosity.NORMAL,
            general={
                stm32pio.util.Verbosity.NORMAL: logging.Formatter("%(levelname)-8s %(message)s"),
                stm32pio.util.Verbosity.VERBOSE: logging.Formatter(
                    f"%(levelname)-8s %(funcName)-{stm32pio.settings.log_fieldwidth_function}s %(message)s")
            })
        handler.setFormatter(formatter)
        logger.addHandler(handler)
        logger.debug("debug logging enabled")
    return logger
github ussserrr / stm32pio / stm32pio_gui / app.py View on Github external
"""Use this to toggle the verbosity of all loggers at once"""
        module_logger.setLevel(logging.DEBUG if value else logging.INFO)
        qml_logger.setLevel(logging.DEBUG if value else logging.INFO)
        projects_logger.setLevel(logging.DEBUG if value else logging.INFO)
        formatter.verbosity = stm32pio.util.Verbosity.VERBOSE if value else stm32pio.util.Verbosity.NORMAL

    settings = Settings(prefix='app/settings/', qs_kwargs={ 'parent': app },
                        external_triggers={ 'verbose': verbose_setter })

    # Use "singleton" real logger for all projects just wrapping it into the LoggingAdapter for every project
    projects_logger = logging.getLogger('stm32pio_gui.projects')
    projects_logger.setLevel(logging.DEBUG if settings.get('verbose') else logging.INFO)
    formatter = stm32pio.util.DispatchingFormatter(
        general={
            stm32pio.util.Verbosity.NORMAL: logging.Formatter("%(levelname)-8s %(message)s"),
            stm32pio.util.Verbosity.VERBOSE: logging.Formatter(
                f"%(levelname)-8s %(funcName)-{stm32pio.settings.log_fieldwidth_function}s %(message)s")
        })
    projects_logger_handler.setFormatter(formatter)
    projects_logger.addHandler(projects_logger_handler)

    verbose_setter(settings.get('verbose'))  # set initial verbosity settings based on the saved state

    settings.beginGroup('app')
    restored_projects_paths: List[str] = []
    for index in range(settings.beginReadArray('projects')):
        settings.setArrayIndex(index)
        restored_projects_paths.append(settings.value('path'))
    settings.endArray()
    settings.endGroup()

stm32pio

Small cross-platform Python app that can create and update PlatformIO projects from STM32CubeMX .ioc files. It uses STM32CubeMX to generate a HAL-framework-based code and alongside creates PlatformIO project with compatible parameters to stick them both together. Both CLI and GUI editions are available

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Similar packages