Update main.py
Browse files
main.py
CHANGED
|
@@ -7,24 +7,12 @@ from sklearn.metrics.pairwise import cosine_similarity
|
|
| 7 |
import joblib
|
| 8 |
import asyncio
|
| 9 |
import logging
|
| 10 |
-
from logging.handlers import RotatingFileHandler
|
| 11 |
import os
|
| 12 |
from datetime import datetime
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
log_directory = os.environ.get('LOG_DIR', 'logs')
|
| 16 |
-
if not os.path.exists(log_directory):
|
| 17 |
-
os.makedirs(log_directory, exist_ok=True)
|
| 18 |
-
|
| 19 |
-
log_file = os.path.join(log_directory, f"app_{datetime.now().strftime('%Y%m%d')}.log")
|
| 20 |
-
|
| 21 |
-
# Configure logging to write to both file and console
|
| 22 |
logging.basicConfig(level=logging.INFO,
|
| 23 |
-
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
| 24 |
-
handlers=[
|
| 25 |
-
RotatingFileHandler(log_file, maxBytes=10000000, backupCount=5),
|
| 26 |
-
logging.StreamHandler()
|
| 27 |
-
])
|
| 28 |
|
| 29 |
logger = logging.getLogger(__name__)
|
| 30 |
|
|
|
|
| 7 |
import joblib
|
| 8 |
import asyncio
|
| 9 |
import logging
|
|
|
|
| 10 |
import os
|
| 11 |
from datetime import datetime
|
| 12 |
|
| 13 |
+
# Configure logging to write only to console
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
logging.basicConfig(level=logging.INFO,
|
| 15 |
+
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
logger = logging.getLogger(__name__)
|
| 18 |
|