[APIP + AIWS] Enhance logging and configuration in platform API#2477
Conversation
- Integrated a custom logger into the configuration loading process to ensure consistent log formatting across the application. - Updated the configuration file to enable SQLite database by default. - Improved source file path handling in the logger for better clarity in log messages. - Changed log output format for server startup to provide clearer information on the running mode.
📝 WalkthroughWalkthroughThis PR installs the configured logger as the process-wide slog default in platform-api's config loading, replaces server startup banner logic in both the Platform API server and the AI Workspace BFF with structured slog logging plus a shared printStartedMarker console banner, and activates SQLite database settings in config.toml. ChangesLogging Setup and Startup Output
Database Configuration
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: Poem: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@platform-api/src/internal/server/server.go`:
- Around line 807-812: The Platform API startup log is using the wrong slog
attribute key, with `server.go`’s startup message in the `Info` call passing
`"mode="` instead of `"mode"`. Update the `s.logger.Info("Platform API started",
...)` call in `server.go` to use the standard key/value pair format with the
`mode` key so the log renders correctly in both text and JSON output.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e383d0a0-7378-42f2-ad4d-046f1f001119
📒 Files selected for processing (4)
platform-api/src/config/config.goplatform-api/src/config/config.tomlplatform-api/src/internal/logger/logger.goplatform-api/src/internal/server/server.go
- Replaced the console output for server startup with a new function `printStartedMarker` to provide a consistent and decorative banner style. - Updated the logging to include the mode of operation (PRODUCTION or DEMO) for better clarity during startup. - Removed the previous `printBanner` function in favor of the new implementation.
- Introduced a new logger package to standardize logging across the application. - Updated configuration to include log level and format options. - Modified main application to utilize the new logger and load logging settings from the configuration. - Adjusted TOML mapping to support logging configuration from environment variables.
|
|
||
| // Logging | ||
| LogLevel string // "debug" | "info" | "warn" | "error" (default "info") | ||
| LogFormat string // "text" | "json" (default "text") |
There was a problem hiding this comment.
note: new configs for ai workspace
#2345
Platform API - text logs
Platform API - json logs
AI Workspace - text logs
AI Workspace - json logs