Skip to content

Commit

Permalink
Add logging utility and refactor app structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Sfayson1 committed Nov 21, 2024
1 parent 620e6a5 commit d721371
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
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

0 comments on commit d721371

Please sign in to comment.