summaryrefslogtreecommitdiffstats
path: root/layman/output.py
diff options
context:
space:
mode:
authordol-sen <brian.dolbec@gmail.com>2011-08-06 11:24:51 -0700
committerdol-sen <brian.dolbec@gmail.com>2011-08-06 11:24:51 -0700
commit53db3cb076054b41e5479299526c67f7cd4d0871 (patch)
tree16ca5008e7eda32db57b894b4a1e619af0ffeb4e /layman/output.py
parent6bfa7e9204b4af2ee0fc816c87ea2bffcce61ccb (diff)
downloadlayman-53db3cb076054b41e5479299526c67f7cd4d0871.tar.gz
layman-53db3cb076054b41e5479299526c67f7cd4d0871.tar.bz2
layman-53db3cb076054b41e5479299526c67f7cd4d0871.zip
add --debug-level to cli options and code Message.debug()
Diffstat (limited to 'layman/output.py')
-rw-r--r--layman/output.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/layman/output.py b/layman/output.py
index 06161ca..6751b59 100644
--- a/layman/output.py
+++ b/layman/output.py
@@ -110,7 +110,14 @@ class Message(MessageBase):
"""empty debug function, does nothing,
declared here for compatibility with DebugMessage
"""
- pass
+ if type(info) not in types.StringTypes:
+ info = str(info)
+
+ if level > self.debug_lev:
+ return
+
+ for i in info.split('\n'):
+ print(self.color_func('yellow', 'DEBUG: ') + i, file=self.std_out)
def notice (self, note):
@@ -180,8 +187,9 @@ class Message(MessageBase):
# stay in nice order. This is a workaround for calls like
# "layman -L |& less".
sys.stdout.flush()
- print(self.color_func('red', '* ') + i, file=self.std_out)
self.error_out.flush()
+ print(self.color_func('red', '* ') + i, file=self.std_out)
+ sys.stdout.flush()
self.do_error_callback(error)