zephyrproject-rtos/west

log messages from west api modules are not being emitted as expected

mbolivar-nordic opened this issue · 0 comments

Commit 92c18ac did not achieve its purpose. We are loading the manifest long before we call the setup_logging() methods in each of the project.py classes, so any messages from the manifest class have long been discarded by the time that we enable them.

The 'west manifest' command happens to work because we deliberately load the manifest again.

This is wrong -- to reproduce, try adding a _logger.warning('test') line to Manifest.from_topdir, and observe that it is not emitted when you run west list manifest. The expected behavior would be that warnings and above are emitted by default, info and above emitted with west -v, debug and above with west -vv or higher.

Fixing this properly requires knowing the verbosity level before west loads the manifest. This in turn requires duplicating some work already done by argparse to handle the -v argument before we load the manifest itself. With that, we can decide what verbosity levels to apply to the west API's modules, and set up a common log handler and formatter for them. This in turn will make things work as expected for extension commands as well.