Format log history for fallback server
This commit is contained in:
parent
66e3e23812
commit
bfa5183c30
2 changed files with 13 additions and 3 deletions
|
|
@ -207,6 +207,18 @@ class OFMHandler(logging.Handler):
|
|||
"""
|
||||
return list(reversed(self._log))
|
||||
|
||||
@property
|
||||
def get_formatted_log_history(self) -> str:
|
||||
"""Return the log history as a formatted string.
|
||||
|
||||
This is to be used for the fallback server, the formatting does not contain invocation
|
||||
IDs as no actions should have started.
|
||||
"""
|
||||
output = ""
|
||||
for entry in self._log:
|
||||
output += f"[{entry['timestamp']} [{entry['level']}] <{entry['logger']}> {entry['message']}\n"
|
||||
return output
|
||||
|
||||
|
||||
class UvicornAccessFilter(logging.Filter):
|
||||
"""A logging filter to filter out "uvicorn.access" messages."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue