Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def nf_core_cli(verbose):
stderr = rich.console.Console(file=sys.stderr)
logging.basicConfig(
level=logging.DEBUG if verbose else logging.INFO,
format="%(message)s",
datefmt=".",
handlers=[rich.logging.RichHandler(console=stderr)],
)
if any(multi_match(name, scope) for scope in scopes):
if getattr(logger, "handlers", None) is not None:
level = logger.level
replace_handler = False
for hdlr in logger.handlers:
if isinstance(hdlr, logging.StreamHandler) and hdlr.stream.isatty():
if getattr(hdlr, "level", None) is not None:
level = hdlr.level
# remove old handler
logger.removeHandler(hdlr)
replace_handler = True
if replace_handler:
# create and add new handler
new_hdlr = rich_logging.RichHandler(level)
logger.addHandler(new_hdlr)