fix the 'logging' command
This commit is contained in:
parent
9e77ea236f
commit
2b55ab7340
1 changed files with 9 additions and 2 deletions
|
|
@ -396,6 +396,9 @@ class ReplApplication(Cmd, BaseApplication):
|
||||||
else:
|
else:
|
||||||
ask_debug_mode = True
|
ask_debug_mode = True
|
||||||
if ask_debug_mode:
|
if ask_debug_mode:
|
||||||
|
if self.interactive:
|
||||||
|
print >>sys.stderr, 'Use "logging debug" option to print backtraces.'
|
||||||
|
else:
|
||||||
print >>sys.stderr, 'Use --debug option to print backtraces.'
|
print >>sys.stderr, 'Use --debug option to print backtraces.'
|
||||||
except NotEnoughArguments, e:
|
except NotEnoughArguments, e:
|
||||||
print >>sys.stderr, 'Error: no enough arguments.'
|
print >>sys.stderr, 'Error: no enough arguments.'
|
||||||
|
|
@ -714,10 +717,14 @@ class ReplApplication(Cmd, BaseApplication):
|
||||||
|
|
||||||
levels = dict(levels)
|
levels = dict(levels)
|
||||||
try:
|
try:
|
||||||
logging.root.setLevel(levels[args[0]])
|
level = levels[args[0]]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print >>sys.stderr, 'Level "%s" does not exist.' % args[0]
|
print >>sys.stderr, 'Level "%s" does not exist.' % args[0]
|
||||||
print >>sys.stderr, 'Availables: %s' % ' '.join(levels.iterkeys())
|
print >>sys.stderr, 'Availables: %s' % ' '.join(levels.iterkeys())
|
||||||
|
else:
|
||||||
|
logging.root.setLevel(level)
|
||||||
|
for handler in logging.root.handlers:
|
||||||
|
handler.setLevel(level)
|
||||||
|
|
||||||
def complete_logging(self, text, line, begidx, endidx):
|
def complete_logging(self, text, line, begidx, endidx):
|
||||||
levels = ('debug', 'info', 'warning', 'error', 'quiet', 'default')
|
levels = ('debug', 'info', 'warning', 'error', 'quiet', 'default')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue