fix: Enable console logging
This commit is contained in:
@@ -19,6 +19,7 @@ CleverSwarm - text to knowledge graph extraction benchmark client.
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, Set
|
||||
@@ -282,13 +283,12 @@ class BenchmarkCLI(object):
|
||||
def main():
|
||||
"""Main entry point for the benchmark client console script."""
|
||||
|
||||
handler = logging.StreamHandler(sys.stdout)
|
||||
handler.setLevel(logging.DEBUG)
|
||||
formatter = logging.Formatter(
|
||||
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
||||
logging.basicConfig(
|
||||
level=os.environ.get("PYTHON_LOGGING_LEVEL", logging.INFO),
|
||||
stream=sys.stderr,
|
||||
datefmt="%Y-%m-%dT%H:%M:%S",
|
||||
format=("%(asctime)s - %(name)s - %(levelname)s - %(message)s"),
|
||||
)
|
||||
handler.setFormatter(formatter)
|
||||
logger.addHandler(handler)
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="CleverSwarm benchmark client for REST API."
|
||||
|
||||
@@ -19,6 +19,7 @@ CleverSwarm - unstructured text to knowledge graph triplets extractor client.
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict
|
||||
@@ -89,7 +90,11 @@ class TextoToKGCLI(object):
|
||||
)
|
||||
|
||||
# If ontology_json was provided, validate that the file exists
|
||||
if ontology_json and ontology_json_path and (not ontology_json_path.exists() or not ontology_json_path.is_file()):
|
||||
if (
|
||||
ontology_json
|
||||
and ontology_json_path
|
||||
and (not ontology_json_path.exists() or not ontology_json_path.is_file())
|
||||
):
|
||||
raise ClientException(
|
||||
f"Specified optional Ontology JSON file does not exist or is not a file: {str(ontology_json_path)}"
|
||||
)
|
||||
@@ -218,13 +223,12 @@ class TextoToKGCLI(object):
|
||||
def main():
|
||||
"""Main entry point for the text-to-KG client console script."""
|
||||
|
||||
handler = logging.StreamHandler(sys.stdout)
|
||||
handler.setLevel(logging.DEBUG)
|
||||
formatter = logging.Formatter(
|
||||
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
||||
logging.basicConfig(
|
||||
level=os.environ.get("PYTHON_LOGGING_LEVEL", logging.INFO),
|
||||
stream=sys.stderr,
|
||||
datefmt="%Y-%m-%dT%H:%M:%S",
|
||||
format=("%(asctime)s - %(name)s - %(levelname)s - %(message)s"),
|
||||
)
|
||||
handler.setFormatter(formatter)
|
||||
logger.addHandler(handler)
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="CleverSwarm unstructured text to Knowledge Graph triplets client for REST API."
|
||||
|
||||
Reference in New Issue
Block a user