mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-02 00:34:44 +00:00
disable fastapi access logs
This commit is contained in:
parent
208cded50e
commit
83de0c7995
2 changed files with 8 additions and 6 deletions
|
@ -347,7 +347,7 @@ def main():
|
|||
|
||||
listen_host = ["::", "0.0.0.0"] if not args.disable_ipv6 else "0.0.0.0"
|
||||
print(f"Listening on {listen_host}:{args.port}")
|
||||
uvicorn.run(app, host=listen_host, port=args.port)
|
||||
uvicorn.run(app, host=listen_host, port=args.port, access_log=False)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -39,7 +39,9 @@ class ConsoleSpanProcessor(SpanProcessor):
|
|||
)[:-3]
|
||||
|
||||
print(
|
||||
f"{COLORS['dim']}{timestamp} " f"[START] " f"{span.name}{COLORS['reset']}"
|
||||
f"{timestamp} "
|
||||
f"{COLORS['bold']}[START]{COLORS['reset']} "
|
||||
f"{COLORS['dim']}{span.name}{COLORS['reset']}"
|
||||
)
|
||||
|
||||
def on_end(self, span: ReadableSpan) -> None:
|
||||
|
@ -50,15 +52,15 @@ class ConsoleSpanProcessor(SpanProcessor):
|
|||
"%H:%M:%S.%f"
|
||||
)[:-3]
|
||||
|
||||
span_context = f"{COLORS['dim']}{timestamp} [END] {span.name}"
|
||||
span_context = f"{timestamp} {COLORS['bold']}[END]{COLORS['reset']} {COLORS['dim']}{span.name}"
|
||||
|
||||
if span.status.status_code == 2: # ERROR
|
||||
span_context += f" {COLORS['red']}[ERROR]{COLORS['reset']}"
|
||||
span_context += f"{COLORS['reset']} {COLORS['red']}[ERROR]{COLORS['reset']}"
|
||||
elif span.status.status_code != 0: # UNSET
|
||||
span_context += f" {COLORS['dim']}[{span.status.status_code}]"
|
||||
span_context += f"{COLORS['reset']} [{span.status.status_code}]"
|
||||
|
||||
duration_ms = (span.end_time - span.start_time) / 1e6
|
||||
span_context += f" ({duration_ms:.2f}ms){COLORS['reset']}"
|
||||
span_context += f"{COLORS['reset']} ({duration_ms:.2f}ms)"
|
||||
|
||||
print(span_context)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue