Skip to content

Commit dc694ac

Browse files
committed
Add list logs in CLI
1 parent f245985 commit dc694ac

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

quotientai/cli/entrypoint.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,5 +204,28 @@ def list_metrics():
204204
raise
205205

206206

207+
MAX_LOGS = 10
208+
209+
@list_app.command(name="logs")
210+
def list_logs(limit: int = MAX_LOGS):
211+
"""Command to get all logs.
212+
213+
Args:
214+
limit: Maximum number of logs to return (default: `MAX_LOGS`)
215+
"""
216+
try:
217+
quotient = QuotientAI()
218+
response = quotient.logs.list(limit=limit)
219+
220+
if len(response) > MAX_LOGS: # Always show max 10 in CLI
221+
console.print(response[:MAX_LOGS])
222+
remaining = len(response) - MAX_LOGS
223+
console.print(f"[yellow]\n... {remaining} more logs available. Use --limit <number> or the SDK to view more.[/yellow]")
224+
else:
225+
console.print(response)
226+
except QuotientAIError as e:
227+
raise
228+
229+
207230
if __name__ == "__main__":
208231
typer.run(app)

0 commit comments

Comments
 (0)