[Misc] add structure logging, write to file and log tracing for SGL Router

This commit is contained in:
Simo Lin
2025-04-27 16:54:10 -07:00
committed by GitHub
parent 86317c09e9
commit f0365820e8
10 changed files with 433 additions and 33 deletions

View File

@@ -67,6 +67,20 @@ $ pip install -e .
**Note:** When modifying Rust code, you must rebuild the wheel for changes to take effect.
### Logging
The SGL Router includes structured logging with console output by default. To enable log files:
```python
# Enable file logging when creating a router
router = Router(
worker_urls=["http://worker1:8000", "http://worker2:8000"],
log_dir="./logs" # Daily log files will be created here
)
```
Use the `--verbose` flag with the CLI for more detailed logs.
### Troubleshooting
1. If rust analyzer is not working in VSCode, set `rust-analyzer.linkedProjects` to the absolute path of `Cargo.toml` in your repo. For example: