master
Steve Nyemba 2 months ago
parent 71c0c4b1c9
commit 0a1ba3e50a

@ -1,6 +1,6 @@
import os import os
__app_name__= "smart-logger" __app_name__= "smart-logger"
__version__ = "1.8" __version__ = "1.10"
__author__ = "Steve L. Nyemba, info@the-phi.com" __author__ = "Steve L. Nyemba, info@the-phi.com"
__home__ = os.sep.join([os.environ['HOME'],'.smart-logger']) __home__ = os.sep.join([os.environ['HOME'],'.smart-logger'])
__database__='smart_logs' __database__='smart_logs'

@ -57,12 +57,18 @@ def read(**args) :
try: try:
_parser = args['parser'] if 'parser' in args else None _parser = args['parser'] if 'parser' in args else None
stream = None stream = None
cmd = None
if _parser and hasattr(_parser,'cmd'): if _parser and hasattr(_parser,'cmd'):
cmd = getattr(_parser,'cmd') cmd = getattr(_parser,'cmd')
elif 'cmd' in args :
cmd = args['cmd']
if cmd :
handler = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE) handler = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE)
stream = str(handler.communicate()[0]).replace("b'",'') stream = str(handler.communicate()[0]).replace("b'",'')
return _parser (stream)
return stream return _parser (stream) if _parser else stream
# return stream
# #
# At this point we need to load the parser or return the output as is # At this point we need to load the parser or return the output as is
# if 'parser' in args : # if 'parser' in args :

Loading…
Cancel
Save