ishaq101 commited on
Commit
6eb38ac
·
1 Parent(s): 4be6d55

update logger

Browse files
Files changed (1) hide show
  1. main.py +22 -2
main.py CHANGED
@@ -1,5 +1,6 @@
1
  import json
2
  import logging
 
3
  import uvicorn
4
  from fastapi import FastAPI, WebSocket, WebSocketDisconnect, File, Form, UploadFile, HTTPException, Query
5
  from fastapi.middleware.cors import CORSMiddleware
@@ -17,7 +18,26 @@ from src.stt.chirp3_client import transcribe_audio as chirp3_transcribe
17
  from src.tts.cartesia_client import synthesize_stream as cartesia_synthesize
18
  from src.tts.gemini_client import synthesize_stream as gemini_synthesize, GEMINI_SAMPLE_RATE
19
 
20
- logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(name)s: %(message)s")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  logger = logging.getLogger(__name__)
22
 
23
  VERSION = "1.2.0"
@@ -190,4 +210,4 @@ async def voice_ws(
190
 
191
 
192
  if __name__ == "__main__":
193
- uvicorn.run("main:app", host="0.0.0.0", port=7860, reload=False)
 
1
  import json
2
  import logging
3
+ import logging.config
4
  import uvicorn
5
  from fastapi import FastAPI, WebSocket, WebSocketDisconnect, File, Form, UploadFile, HTTPException, Query
6
  from fastapi.middleware.cors import CORSMiddleware
 
18
  from src.tts.cartesia_client import synthesize_stream as cartesia_synthesize
19
  from src.tts.gemini_client import synthesize_stream as gemini_synthesize, GEMINI_SAMPLE_RATE
20
 
21
+ LOG_CONFIG = {
22
+ "version": 1,
23
+ "disable_existing_loggers": False,
24
+ "formatters": {
25
+ "default": {
26
+ "format": "%(asctime)s [%(levelname)s] %(name)s: %(message)s",
27
+ },
28
+ },
29
+ "handlers": {
30
+ "default": {
31
+ "class": "logging.StreamHandler",
32
+ "formatter": "default",
33
+ },
34
+ },
35
+ "root": {
36
+ "level": "INFO",
37
+ "handlers": ["default"],
38
+ },
39
+ }
40
+ logging.config.dictConfig(LOG_CONFIG)
41
  logger = logging.getLogger(__name__)
42
 
43
  VERSION = "1.2.0"
 
210
 
211
 
212
  if __name__ == "__main__":
213
+ uvicorn.run("main:app", host="0.0.0.0", port=7860, reload=False, log_config=LOG_CONFIG)