From 85a412c172044ae89d381f69ddb309ce8b3cea6e Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Tue, 16 Oct 2012 21:14:51 -0700 Subject: Move the recursive flushing to the log module. --- cloudinit/log.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'cloudinit/log.py') diff --git a/cloudinit/log.py b/cloudinit/log.py index 2333e5ee..da6c2851 100644 --- a/cloudinit/log.py +++ b/cloudinit/log.py @@ -53,6 +53,18 @@ def setupBasicLogging(): root.setLevel(DEBUG) +def flushLoggers(root): + if not root: + return + for h in root.handlers: + if isinstance(h, (logging.StreamHandler)): + try: + h.flush() + except IOError: + pass + flushLoggers(root.parent) + + def setupLogging(cfg=None): # See if the config provides any logging conf... if not cfg: -- cgit v1.2.3