Commit cbfcfab
committed
UN-2813 [FIX] Remove unsupported log_level from structlog.configure
Fix critical bug causing CLI to crash with TypeError on startup.
**Problem:**
structlog.configure() does not accept a `log_level` keyword argument.
Passing it raises TypeError, causing the CLI to fail immediately:
```
TypeError: configure() got an unexpected keyword argument 'log_level'
```
**Root Cause:**
Line 35 in cli/main.py incorrectly passed log_level to structlog.configure:
```python
structlog.configure(
...,
log_level=log_level.upper(), # ❌ Not a valid parameter
)
```
**Solution:**
1. Added `import logging`
2. Configure log level via standard library before structlog:
```python
logging.basicConfig(level=log_level.upper())
```
3. Removed unsupported `log_level` parameter from structlog.configure()
**Impact:**
- ✅ CLI now starts without TypeError
- ✅ Log level control preserved via logging.basicConfig
- ✅ Structured logging configuration intact
- ✅ All CLI commands work correctly
**Testing:**
Before: CLI crashes on any invocation
After: CLI starts and respects --log-level flag
Resolves: CodeRabbit comment #2386596263
Related: #15551 parent 9819f80 commit cbfcfab
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| |||
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
35 | | - | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| |||
0 commit comments