Split console logging between stdout and stderr
This commit is contained in:
parent
bf2adbd49e
commit
cd0bac368a
16
bin/addpkg
16
bin/addpkg
@ -31,11 +31,17 @@ console_formatter = logging.Formatter(LOGFORMAT)
|
||||
syslog = logging.getLogger('packaging_scripts')
|
||||
syslog.setLevel(logging.DEBUG)
|
||||
|
||||
console_handler = logging.StreamHandler()
|
||||
console_handler.setLevel(logging.INFO)
|
||||
console_handler.setFormatter(console_formatter)
|
||||
stdout_handler = logging.StreamHandler(sys.stdout)
|
||||
stdout_handler.setLevel(logging.INFO)
|
||||
stdout_handler.setFormatter(console_formatter)
|
||||
stdout_handler.addFilter(lambda record: record.levelno <= logging.INFO)
|
||||
|
||||
syslog.addHandler(console_handler)
|
||||
stderr_handler = logging.StreamHandler(sys.stderr)
|
||||
stderr_handler.setLevel(logging.WARNING)
|
||||
stderr_handler.setFormatter(console_formatter)
|
||||
|
||||
syslog.addHandler(stdout_handler)
|
||||
syslog.addHandler(stderr_handler)
|
||||
|
||||
|
||||
# ========== Functions ==========
|
||||
@ -84,7 +90,7 @@ if __name__ == '__main__':
|
||||
db = f"{cachedir}/{repo}.{DB_EXT}"
|
||||
|
||||
if args.verbose:
|
||||
console_handler.setLevel(logging.DEBUG)
|
||||
stdout_handler.setLevel(logging.DEBUG)
|
||||
|
||||
if pkgs:
|
||||
pkg_tarballs = pkgs
|
||||
|
16
bin/delpkg
16
bin/delpkg
@ -26,11 +26,17 @@ console_formatter = logging.Formatter('==> %(levelname)s %(message)s')
|
||||
syslog = logging.getLogger('packaging_scripts')
|
||||
syslog.setLevel(logging.DEBUG)
|
||||
|
||||
console_handler = logging.StreamHandler()
|
||||
console_handler.setLevel(logging.INFO)
|
||||
console_handler.setFormatter(console_formatter)
|
||||
stdout_handler = logging.StreamHandler(sys.stdout)
|
||||
stdout_handler.setLevel(logging.INFO)
|
||||
stdout_handler.setFormatter(console_formatter)
|
||||
stdout_handler.addFilter(lambda record: record.levelno <= logging.INFO)
|
||||
|
||||
syslog.addHandler(console_handler)
|
||||
stderr_handler = logging.StreamHandler(sys.stderr)
|
||||
stderr_handler.setLevel(logging.WARNING)
|
||||
stderr_handler.setFormatter(console_formatter)
|
||||
|
||||
syslog.addHandler(stdout_handler)
|
||||
syslog.addHandler(stderr_handler)
|
||||
|
||||
|
||||
# ========== Functions ==========
|
||||
@ -73,7 +79,7 @@ if __name__ == '__main__':
|
||||
db = f"{cachedir}/{repo}.{DB_EXT}"
|
||||
|
||||
if args.verbose:
|
||||
console_handler.setLevel(logging.DEBUG)
|
||||
stdout_handler.setLevel(logging.DEBUG)
|
||||
|
||||
for pkg in pkgs:
|
||||
pkg_tarballs = pkgfiles.get_pkgfiles(query=pkg,
|
||||
|
Loading…
x
Reference in New Issue
Block a user