__init__: add null handler for 'west' logger
API modules like west.manifest are using the standard logging module. This module prints messages at warning severity or above to stderr by default. That prints messages twice when a west command configures its own logger, like this: $ west foo some warning message WARNING: some warning message The first line comes from the print to stderr done by the default handler. The second one is from a ProjectCommandLogHandler. Disable the first message, which we do not want, by registering a null handler for the top level. This results in just the ProjectCommandLogHandler output being shown, like this: $ west foo WARNING: some warning message Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
3eb1732b6a
commit
c90b4157e4
|
@ -1,3 +1,6 @@
|
|||
# Copyright (c) 2020, Nordic Semiconductor ASA
|
||||
# Copyright (c) 2021 Nordic Semiconductor ASA
|
||||
|
||||
# nothing here
|
||||
import logging
|
||||
|
||||
# https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library
|
||||
logging.getLogger('west').addHandler(logging.NullHandler())
|
||||
|
|
Loading…
Reference in New Issue