monitoringplugin.py: Enhance verbose output function
- one space per verbose level at the begining - optional prefix (for list output) - output lists one item per line
This commit is contained in:
parent
925cbb2297
commit
e59b1a8c6e
|
@ -357,9 +357,17 @@ class MonitoringPlugin(object):
|
|||
return ''
|
||||
|
||||
|
||||
def verbose(self, level, output):
|
||||
def verbose(self, level, output, prefix=None):
|
||||
if level <= self.options.verbose:
|
||||
print 'V' + str(level) + ': ' + output
|
||||
bol = 'V' + str(level) + ':' + ' ' * level
|
||||
if prefix:
|
||||
bol += '%s' % prefix
|
||||
if type(output) in [str, unicode, ]:
|
||||
print(bol + output)
|
||||
elif type(output) in [list, ]:
|
||||
print('\n'.join( ['%s%s' % (bol, l) for l in output] ) )
|
||||
else:
|
||||
print('%s%s' % (bol, output) )
|
||||
|
||||
|
||||
def max_returncode(self, returncodes):
|
||||
|
|
Loading…
Reference in a new issue