DinoPLayZ commited on
Commit
736baa8
·
verified ·
1 Parent(s): 9a1e731

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +8 -13
main.py CHANGED
@@ -26,19 +26,14 @@ load_dotenv()
26
  # LOGGING (Task 5)
27
  # ==============================================================================
28
  IST = timezone(timedelta(hours=5, minutes=30))
29
-
30
- class PrintLogger:
31
- """A brute-force custom logger that completely bypasses Uvicorn's logging module handlers."""
32
- def info(self, msg):
33
- print(f"[{datetime.now(IST).strftime('%I:%M:%S %p')}] INFO: {msg}", flush=True)
34
- def warning(self, msg):
35
- print(f"[{datetime.now(IST).strftime('%I:%M:%S %p')}] WARNING: {msg}", flush=True)
36
- def error(self, msg):
37
- print(f"[{datetime.now(IST).strftime('%I:%M:%S %p')}] ERROR: {msg}", flush=True)
38
- def debug(self, msg):
39
- pass # Suppress debug logs by default to keep console clean
40
-
41
- logger = PrintLogger()
42
 
43
  # ==============================================================================
44
  # CONFIGURATION
 
26
  # LOGGING (Task 5)
27
  # ==============================================================================
28
  IST = timezone(timedelta(hours=5, minutes=30))
29
+ logging.Formatter.converter = lambda *args: datetime.fromtimestamp(args[-1], tz=IST).timetuple()
30
+
31
+ logging.basicConfig(
32
+ level=logging.INFO,
33
+ format='[%(asctime)s] %(levelname)s: %(message)s',
34
+ datefmt='%I:%M:%S %p'
35
+ )
36
+ logger = logging.getLogger(__name__)
 
 
 
 
 
37
 
38
  # ==============================================================================
39
  # CONFIGURATION