mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-21 21:14:17 +02:00
fix: fix StructuredLoggingMiddleware payload serialization
This commit is contained in:
parent
953d3eb64b
commit
41d6b6fc15
1 changed files with 3 additions and 3 deletions
|
|
@ -152,7 +152,7 @@ class StructuredLoggingMiddleware(Middleware):
|
|||
if self.methods and context.method not in self.methods:
|
||||
return await call_next(context)
|
||||
|
||||
self.logger.log(self.log_level, json.dumps(start_entry))
|
||||
self.logger.log(self.log_level, json.dumps(start_entry, default=str))
|
||||
|
||||
try:
|
||||
result = await call_next(context)
|
||||
|
|
@ -162,7 +162,7 @@ class StructuredLoggingMiddleware(Middleware):
|
|||
"request_success",
|
||||
result_type=type(result).__name__ if result else None,
|
||||
)
|
||||
self.logger.log(self.log_level, json.dumps(success_entry))
|
||||
self.logger.log(self.log_level, json.dumps(success_entry, default=str))
|
||||
|
||||
return result
|
||||
except Exception as e:
|
||||
|
|
@ -172,5 +172,5 @@ class StructuredLoggingMiddleware(Middleware):
|
|||
error_type=type(e).__name__,
|
||||
error_message=str(e),
|
||||
)
|
||||
self.logger.log(logging.ERROR, json.dumps(error_entry))
|
||||
self.logger.log(logging.ERROR, json.dumps(error_entry, default=str))
|
||||
raise
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue