Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions codewiki/src/fe/web_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

import argparse
import logging
from fastapi import FastAPI, Request, Form
from fastapi.responses import HTMLResponse

Expand All @@ -19,6 +20,7 @@
from .routes import WebRoutes
from .config import WebAppConfig

logger = logging.getLogger(__name__)

# Initialize FastAPI app
app = FastAPI(
Expand Down Expand Up @@ -110,11 +112,11 @@ def main():
# Start background worker
background_worker.start()

print(f"🚀 CodeWiki Web Application starting...")

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 web_app.py has no module-level logger; relies entirely on print()

Added import logging and module-level logger = logging.getLogger(__name__) in codewiki/src/fe/web_app.py, and replaced all diagnostic print() calls in main() (startup banner, host/port, cache/temp directory paths, "Press Ctrl+C" message, and "Server stopped" on KeyboardInterrupt) with corresponding logger.info() calls, satisfying CODEWIKI-007-2's requirement for module-level logger-based diagnostics instead of print().

🤖 Prompt for AI agents
In codewiki/src/fe/web_app.py around line 113, review and complete this code-review fix: web_app.py has no module-level logger; relies entirely on print().
What the draft fix changed: Added `import logging` and module-level `logger = logging.getLogger(__name__)` in codewiki/src/fe/web_app.py, and replaced all diagnostic `print()` calls in `main()` (startup banner, host/port, cache/temp directory paths, "Press Ctrl+C" message, and "Server stopped" on KeyboardInterrupt) with corresponding `logger.info()` calls, satisfying CODEWIKI-007-2's requirement for module-level logger-based diagnostics instead of print().
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 90 high — react 👍/👎 to teach the reviewer

print(f"🌐 Server running at: http://{args.host}:{args.port}")
print(f"📁 Cache directory: {WebAppConfig.get_absolute_path(WebAppConfig.CACHE_DIR)}")
print(f"🗂️ Temp directory: {WebAppConfig.get_absolute_path(WebAppConfig.TEMP_DIR)}")
print("\nPress Ctrl+C to stop the server")
logger.info(f"🚀 CodeWiki Web Application starting...")
logger.info(f"🌐 Server running at: http://{args.host}:{args.port}")
logger.info(f"📁 Cache directory: {WebAppConfig.get_absolute_path(WebAppConfig.CACHE_DIR)}")
logger.info(f"🗂️ Temp directory: {WebAppConfig.get_absolute_path(WebAppConfig.TEMP_DIR)}")
logger.info("Press Ctrl+C to stop the server")

try:
uvicorn.run(
Expand All @@ -125,9 +127,9 @@ def main():
log_level="debug" if args.debug else "info"
)
except KeyboardInterrupt:
print("\n👋 Server stopped")
logger.info("👋 Server stopped")
background_worker.stop()


if __name__ == "__main__":
main()
main()