update operation log
This commit is contained in:
@@ -50,6 +50,7 @@ class LoggingMiddleware(BaseHTTPMiddleware):
|
|||||||
db = request.state.db
|
db = request.state.db
|
||||||
if db:
|
if db:
|
||||||
await self.write_log_to_db(db_operation,db)
|
await self.write_log_to_db(db_operation,db)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Logging failed: {str(e)}")
|
print(f"Logging failed: {str(e)}")
|
||||||
|
|
||||||
@@ -64,5 +65,6 @@ class LoggingMiddleware(BaseHTTPMiddleware):
|
|||||||
|
|
||||||
async def write_log_to_db(self, db_operation,db):
|
async def write_log_to_db(self, db_operation,db):
|
||||||
db.add(db_operation)
|
db.add(db_operation)
|
||||||
db.commit()
|
await db.commit()
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user