Logger is now an attribute of the execution context

This commit is contained in:
2020-02-18 16:31:55 +01:00
parent 86c2ff58d4
commit 87f232b527
27 changed files with 213 additions and 243 deletions
+4 -5
View File
@@ -24,17 +24,17 @@ class ExactConceptParser(BaseParser):
:return:
"""
context.log(self.verbose_log, f"Parsing '{text}'", self.name)
context.log(f"Parsing '{text}'", self.name)
res = []
sheerka = context.sheerka
try:
words = self.get_words(text)
except LexerError as e:
context.log(self.verbose_log, f"Error found in tokenizer {e}", self.name)
context.log(f"Error found in tokenizer {e}", self.name)
return sheerka.ret(self.name, False, sheerka.new(BuiltinConcepts.ERROR, body=e))
if len(words) > self.MAX_WORDS_SIZE:
context.log(self.verbose_log, f"Max words reached. Stopping.", self.name)
context.log(f"Max words reached. Stopping.", self.name)
return sheerka.ret(self.name, False, sheerka.new(BuiltinConcepts.CONCEPT_TOO_LONG, body=text))
recognized = False
@@ -50,7 +50,7 @@ class ExactConceptParser(BaseParser):
concepts = result if isinstance(result, list) else [result]
for concept in concepts:
context.log(self.verbose_log, f"Recognized concept {concept}.", self.name)
context.log(f"Recognized concept {concept}.", self.name)
# update the properties if needed
for i, token in enumerate(combination):
if token.startswith(VARIABLE_PREFIX):
@@ -59,7 +59,6 @@ class ExactConceptParser(BaseParser):
if self.verbose_log.isEnabledFor(logging.DEBUG):
prop_name = list(concept.props.keys())[index]
context.log(
self.verbose_log,
f"Added property {index}: {prop_name}='{words[i]}'.",
self.name)