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
464dcc5479
commit
06a1a10a91
|
@ -357,9 +357,17 @@ class MonitoringPlugin(object):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def verbose(self, level, output):
|
def verbose(self, level, output, prefix=None):
|
||||||
if level <= self.options.verbose:
|
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):
|
def max_returncode(self, returncodes):
|
||||||
|
|
Loading…
Reference in a new issue