Skip to content
Snippets Groups Projects
Commit 838ae902 authored by Franz Knuth's avatar Franz Knuth
Browse files

simple_parser.py: Fixed error when empty regular expression occured and added...

simple_parser.py: Fixed error when empty regular expression occured and added explanation for --verbose
ActivateLogging.py: Adjusted standard logging levels
parent 7dfa27d4
No related branches found
No related tags found
No related merge requests found
......@@ -5,16 +5,18 @@ ch = logging.StreamHandler()
ch.setLevel(logging.INFO)
logger=logging.getLogger("nomadcore")
logger.setLevel(logging.DEBUG)
logger.setLevel(logging.WARNING)
logger.addHandler(ch)
logger2=logging.getLogger("nomad")
logger2.setLevel(logging.DEBUG)
logger2.setLevel(logging.WARNING)
logger2.addHandler(ch)
def debugToFile():
"makes a full log to a file named detailed.log"
fh = logging.FileHandler('detailed.log')
fh.setLevel(logging.DEBUG)
logger.setLevel(logging.DEBUG)
logger2.setLevel(logging.DEBUG)
logger.addHandler(fh)
logger2.addHandler(fh)
......@@ -674,6 +674,9 @@ class CompiledMatcher(object):
def findNextWithRe(self, regex, possible, parser):
# searching for match would be more efficient than doing line by line as here...
# catch empty regular expression
if regex.pattern == '':
return -3
while True:
line = parser.fIn.readline()
if not line:
......@@ -1026,7 +1029,7 @@ class SimpleParser(object):
cNames = self.contextDesc()
while self.context:
self.contextPop()
if nextI != -1:
if nextI != -1 and nextI != -3:
raise Exception("finished with error with parsing context %s" % (cNames))
else:
index = nextI / 2
......@@ -1092,12 +1095,13 @@ def mainFunction(mainFileDescription, metaInfoEnv, parserInfo,
defaultSectionCachingLevel = CachingLevel.Forward,
superContext = None,
onClose = {}):
usage = """{exeName} [--meta-info] [--help] [--specialize] [--stream] [--uri uri] [path/toFile]
usage = """{exeName} [--meta-info] [--help] [--specialize] [--stream] [--uri uri] [--verbose] [path/toFile]
--meta-info outputs the meta info supported by this parser
--help prints this message
--specialize expects inclusion and exclusion of meta info to parse via a json dictionary on stdin
--stream expects the files to parse via dictionary on stdin
--verbose writes metainfo to stderr and detailed debug info of parsing process to file detailed.log
If a path to a file is given this is parsed
""".format(exeName = os.path.basename(sys.argv[0] if len(sys.argv) > 0 else "simple_parser"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment