diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-07-01 00:19:49 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-07-01 00:19:49 -0700 |
commit | aa9189e89ec101fba8ca36919a7c800f8b28d5c0 (patch) | |
tree | e81d2709f813c8c48b3c0994496dce06c2c78047 /cloudinit/util.py | |
parent | 342ffe553574c7662d143d3da76f8f4fb6587983 (diff) | |
download | vyos-cloud-init-aa9189e89ec101fba8ca36919a7c800f8b28d5c0.tar.gz vyos-cloud-init-aa9189e89ec101fba8ca36919a7c800f8b28d5c0.zip |
Add a multi log function that can write to stderr, console and a log debug, useful in certain cases
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r-- | cloudinit/util.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py index 0c592656..e6219d66 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -271,6 +271,17 @@ def find_modules(root_dir): return entries +def multi_log(text, console=True, stderr=True, log=None): + if stderr: + sys.stderr.write(text) + if console: + with open('/dev/console', 'wb') as wfh: + wfh.write(text) + wfh.flush() + if log: + log.debug(text) + + def is_ipv4(instr): """ determine if input string is a ipv4 address. return boolean""" toks = instr.split('.') |