Add base44 logs command for fetching function runtime logs#225
Add base44 logs command for fetching function runtime logs#225
base44 logs command for fetching function runtime logs#225Conversation
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/cli@0.0.30-pr.225.09b17d9Prefer not to change any import paths? Install using npm alias so your code still imports npm i "base44@npm:@base44-preview/cli@0.0.30-pr.225.09b17d9"Or add it to your {
"dependencies": {
"base44": "npm:@base44-preview/cli@0.0.30-pr.225.09b17d9"
}
}
Preview published to npm registry — try new features instantly! |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
|
Found 2 issues:
See full details in review comment. |
Code Review - Detailed FindingsIssue 1: FunctionNotFoundError location violates CLAUDE.mdFile: src/core/resources/function/api.ts (lines 11-38) Problem: The PR defines References:
Solution: Move FunctionNotFoundError to src/core/errors.ts and import it from @/core/errors.js Issue 2: Regex bug in normalizeDatetimeFile: src/cli/commands/logs/index.ts (lines 88-91) Problem: The regex /Z|[+-]\d{2}:\d{2}$/ matches Z anywhere (not just at end) due to alternation precedence. Current: Fixed: Impact: Minimal in practice, but technically incorrect. Otherwise excellent work! Well-structured implementation with comprehensive tests. |
…alizeDatetime - Move FunctionNotFoundError class to core/errors.ts per project conventions - Fix regex alternation bug: anchor Z to end-of-string in normalizeDatetime Co-authored-by: Cursor <cursoragent@cursor.com>
Note
Description
Adds a new
base44 logscommand that fetches and displays runtime logs from deployed functions. Users can filter by function name, time range, log level, and control output format. Logs are displayed in a plain log-file format suitable for piping to other tools.Related Issue
None
Type of Change
Changes Made
getLogsCommand()factory insrc/cli/commands/logs/index.tswith filtering options (function, since, until, level, limit, order, json)fetchFunctionLogs()API client insrc/core/resources/function/api.tsto retrieve logs from Deno Deploy via/functions-mgmt/{functionName}/logsendpointFunctionNotFoundErrorto core errors for clear function-not-found handling with hints listing available functionsFunctionLogsResponseand related Zod schemas tosrc/core/resources/function/schema.tsfor log entry validationrunCommand()utility withskipIntroandskipOutrooptions to support pipe-friendly output (no @clack/prompts UI elements)tests/cli/logs.spec.ts(11 test cases covering success, filters, errors, edge cases)Base44APIMocktest utility withmockFunctionLogs()andmockFunctionLogsError()helpersTesting
npm test)Checklist
Additional Notes
The command supports both interactive use (
base44 logs --function my-fn) and piping to other tools (base44 logs --json | jq). When no--functionis specified, it fetches logs for all functions defined in the project. TheskipIntro/skipOutrooptions ensure clean output for pipe-friendly commands by bypassing @clack/prompts UI elements.🤖 Generated by Claude | 2026-02-10 02:15 UTC