Skip to content

Commit

Permalink
fix uvicorn logs
Browse files Browse the repository at this point in the history
  • Loading branch information
BjarkeM committed Apr 23, 2024
1 parent 715ceb8 commit 6d9e4c3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
is_development = os.environ.get('QUART_ENV') == 'development'
TIME_FORMAT = '%d/%m/%Y %H:%M:%S'


class LogColors:
DEBUG = '\033[92m' # GREEN
INFO = '\033[94m' # BLUE
Expand Down Expand Up @@ -74,12 +75,9 @@ def format(self, record):
logger.setLevel(logging.INFO)

logging.basicConfig(level=logging.INFO, handlers=[console_handler])
LOGGING_CONFIG['formatters']['default']['()'] = 'app.app.ColoredFormatter'
LOGGING_CONFIG['formatters']['default']['fmt'] = log_format
LOGGING_CONFIG['formatters']['default']['datefmt'] = TIME_FORMAT
LOGGING_CONFIG['formatters']['access']['()'] = 'app.app.ColoredFormatter'
LOGGING_CONFIG['formatters']['access']['fmt'] = '%(levelname)s %(asctime)s %(client_addr)s - "%(request_line)s" %(status_code)s'
LOGGING_CONFIG['formatters']['access']['datefmt'] = TIME_FORMAT

logging.getLogger('uvicorn').handlers = [console_handler]
logging.getLogger('uvicorn.access').handlers = [console_handler]

app = Quart(__name__)
current_token_idx = 0
Expand Down

0 comments on commit 6d9e4c3

Please sign in to comment.