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

Add logging utility and refactor app structure #22

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
13 changes: 2 additions & 11 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import streamlit as st
import os
import logging
from utils.logging_utils import setup_logging
from typing import Dict, List
from datetime import datetime
from dotenv import load_dotenv
Expand Down Expand Up @@ -93,16 +93,7 @@ def get_svg_base64(svg_content):
</style>
""", unsafe_allow_html=True)

# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[
logging.FileHandler('vetsai.log'),
logging.StreamHandler()
]
)
logger = logging.getLogger(__name__)
logger = setup_logging()

# Load environment variables
load_dotenv()
Expand Down
Empty file added utils/__init__.py
Empty file.
15 changes: 15 additions & 0 deletions utils/logging_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import logging

def setup_logging():

# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[
logging.FileHandler('vetsai.log'),
logging.StreamHandler()
]
)
logger = logging.getLogger(__name__)
return logger
Loading