Adding in logging
This commit is contained in:
27
app/main.py
27
app/main.py
@@ -15,8 +15,15 @@ from sqlalchemy.exc import IntegrityError, OperationalError
|
||||
|
||||
from . import config
|
||||
from .lib_general import *
|
||||
from .log import *
|
||||
from .routers import items, users, websockets
|
||||
|
||||
#log = logging.getLogger('root')
|
||||
#log.setLevel(logging.ERROR) # DEBUG > INFO > WARNING > ERROR > CRITICAL
|
||||
#logging.basicConfig(
|
||||
#format='[%(asctime)s] %(levelname)s @ %(module)s.%(funcName)s()#%(lineno)d: %(message)s'
|
||||
#)
|
||||
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@@ -90,4 +97,24 @@ async def add_process_time_header(request: Request, call_next):
|
||||
async def get_root():
|
||||
print(config.settings.APP_NAME)
|
||||
|
||||
log.setLevel(logging.DEBUG)
|
||||
|
||||
print('***')
|
||||
log.debug('This is debug') # 10 DEBUG
|
||||
log.info('This is info') # 20 INFO
|
||||
log.warn('This is warn') # 30 WARNING
|
||||
log.warning('This is a warning') # 30 WARNING
|
||||
log.error('This is an error') # 40 ERROR
|
||||
log.exception('This is an exception') # 40 ERROR
|
||||
log.critical('This is critical') # 50 CRITICAL
|
||||
#print('----')
|
||||
#logging.debug('This is debug') # 10 DEBUG
|
||||
#logging.info('This is info') # 20 INFO
|
||||
#logging.warn('This is warn') # 30 WARNING
|
||||
#logging.warning('This is a warning') # 30 WARNING
|
||||
#logging.error('This is an error') # 40 ERROR
|
||||
#logging.exception('This is an exception') # 40 ERROR
|
||||
#logging.critical('This is critical') # 50 CRITICAL
|
||||
print('^^^')
|
||||
|
||||
return {'hello': 'This is the Aether API using FastAPI.'}
|
||||
|
||||
Reference in New Issue
Block a user