From: Michael Tremer Date: Thu, 13 May 2021 12:55:40 +0000 (+0000) Subject: cli: execute: Log output to console X-Git-Tag: 0.9.28~1285^2~141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59b9d1c212cdee5584e9befe0b83ca2614c77f04;p=pakfire.git cli: execute: Log output to console Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/cli.py b/src/pakfire/cli.py index cb2ad6ec9..0b2bb1766 100644 --- a/src/pakfire/cli.py +++ b/src/pakfire/cli.py @@ -222,7 +222,14 @@ class Cli(object): for bind in ns.binds: pakfire.bind(bind) - return pakfire.execute(ns.command) + # Log everything to the console + def logging_callback(level, line): + if level >= logging.ERROR: + sys.stderr.write("%s\n" % line) + else: + sys.stdout.write("%s\n" % line) + + return pakfire.execute(ns.command, logging_callback=logging_callback) def run(self): args = self.parse_cli()