diff options
Diffstat (limited to '')
-rw-r--r-- | portato/log.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/portato/log.py b/portato/log.py index 486aa51..1e0eb1a 100644 --- a/portato/log.py +++ b/portato/log.py @@ -100,3 +100,13 @@ def start(file = True): def set_log_level (lvl): for h in streamhandlers: h.setLevel(lvl) + +# embed warnings in our logging functionality +import warnings +def showwarnings(msg, cat, filename, lineno, file = None, line = None): + msg = warnings.formatwarning(msg, cat, filename, lineno, line) + + record = logging.LogRecord("portatoLogger", logging.WARNING, filename, lineno, "Portage Warning: %s", (msg,), None) + logging.getLogger("portatoLogger").handle(record) + +warnings.showwarning = showwarnings |