Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow saving log to file #98

Merged
merged 2 commits into from
Aug 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions swagger_server/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
from swagger_server.messaging.topic_queue_consumer import *
from swagger_server.utils.db_utils import *

logger = logging.getLogger(__name__)
logging.getLogger("pika").setLevel(logging.WARNING)
LOG_FILE = os.environ.get("LOG_FILE")


def is_json(myjson):
try:
Expand All @@ -24,9 +28,6 @@ def is_json(myjson):


def start_consumer(thread_queue, db_instance):
logger = logging.getLogger(__name__)
logging.getLogger("pika").setLevel(logging.WARNING)

MESSAGE_ID = 0
HEARTBEAT_ID = 0

Expand All @@ -42,7 +43,10 @@ def start_pull_topology_change():


def main():
logging.basicConfig(level=logging.INFO)
if LOG_FILE:
logging.basicConfig(filename=LOG_FILE, level=logging.INFO)
else:
logging.basicConfig(level=logging.INFO)

# Run swagger service
app = connexion.App(__name__, specification_dir="./swagger/")
Expand Down