diff options
author | Brian Dolbec <brian.dolbec@gmail.com> | 2011-01-16 22:46:38 -0800 |
---|---|---|
committer | Brian Dolbec <brian.dolbec@gmail.com> | 2011-02-11 02:49:14 -0800 |
commit | b214cd3e79ee70aec597262f5bb9bbaf6fdc74e5 (patch) | |
tree | 19ca6b58807489c8f329330fff5797eb1dc1571d /layman/debug.py | |
parent | add optional repo list limiter to the list function (diff) | |
download | layman-b214cd3e79ee70aec597262f5bb9bbaf6fdc74e5.tar.gz layman-b214cd3e79ee70aec597262f5bb9bbaf6fdc74e5.tar.bz2 layman-b214cd3e79ee70aec597262f5bb9bbaf6fdc74e5.zip |
Move color codes to a new file.
Add some message string constants
Diffstat (limited to 'layman/debug.py')
-rw-r--r-- | layman/debug.py | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/layman/debug.py b/layman/debug.py index e5a5d61..7c42974 100644 --- a/layman/debug.py +++ b/layman/debug.py @@ -18,20 +18,8 @@ import sys, inspect, types from optparse import OptionGroup -################################################################################# -## -## Color codes (taken from portage) -## -################################################################################# +from layman.constants import codes -esc_seq = '\x1b[' - -codes = {} -codes['reset'] = esc_seq + '39;49;00m' -codes['red'] = esc_seq + '31;01m' -codes['green'] = esc_seq + '32;01m' -codes['yellow'] = esc_seq + '33;01m' -codes['turquoise'] = esc_seq + '36;01m' ################################################################################# ## @@ -112,6 +100,8 @@ class Message: def cli_opts(self, parser): + #print "Parsing debug opts" + group = OptionGroup(parser, '<Debugging options>', 'Control the debugging features of ' @@ -307,6 +297,8 @@ class Message: def info (self, info, level = 4): + #print "info =", info + if type(info) not in types.StringTypes: info = str(info) @@ -346,6 +338,8 @@ class Message: def warn (self, warn, level = 4): + #print "DEBUG.warn()" + if type(warn) not in types.StringTypes: warn = str(warn) @@ -453,7 +447,7 @@ class Message: ## Remove printed characters from output x = x[60:] ## Print final line - print >> self.debug_out, ls + '// ' + x + print >> self.debug_out, ls + '// ' + x if self.debug_vrb == 1: # Top line indicates class and method |