diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-10-16 21:14:51 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-10-16 21:14:51 -0700 |
commit | 85a412c172044ae89d381f69ddb309ce8b3cea6e (patch) | |
tree | 843796507c470c9017afeeda2aa778041486ba00 /cloudinit/log.py | |
parent | 7029732d496181233f2115dbfd65b13d20aceca7 (diff) | |
download | vyos-cloud-init-85a412c172044ae89d381f69ddb309ce8b3cea6e.tar.gz vyos-cloud-init-85a412c172044ae89d381f69ddb309ce8b3cea6e.zip |
Move the recursive flushing to the log module.
Diffstat (limited to 'cloudinit/log.py')
-rw-r--r-- | cloudinit/log.py | 12 |
1 files changed, 12 insertions, 0 deletions
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: |