Skip to content

Add structured logging with loguru#3

Merged
vpadman1 merged 1 commit intomainfrom
vignesh/structured-logging
Apr 16, 2026
Merged

Add structured logging with loguru#3
vpadman1 merged 1 commit intomainfrom
vignesh/structured-logging

Conversation

@vpadman1
Copy link
Copy Markdown
Owner

Summary

Adds observability so router/driver issues are debuggable without reproducing them in real time.

  • logging_config.py (new) — centralized logger with console + rotating file sinks. Console defaults to WARNING (quiet), INFO with `--verbose`. File is always DEBUG at `~/.config/wifi-channel-optimizer/wifi-monitor.log` (1 MB rotation, 3 generations kept).
  • main.py — wires in `configure_logging()` and a `--verbose / -v` flag. User-facing messages still go through `click.echo`; the logger handles file-level diagnostics and error paths.
  • drivers/tplink_oid.py — logs login attempts (username only, never password), channel-change requests, and logout failures at appropriate levels. No sensitive data in logs.
  • README.md — documents the `--verbose` flag and log file location.

Test plan

  • `uv run pytest -v` — 28/28 passing
  • `uvx ruff check .` — clean
  • CI green

- logging_config.py: centralized logger with console + rotating file output.
  Console level WARNING by default, INFO with --verbose. File always DEBUG at
  ~/.config/wifi-channel-optimizer/wifi-monitor.log (1 MB rotation, keep 3).
- main.py: wire in configure_logging() + --verbose flag. Log connection,
  authentication, and shutdown at INFO; errors at ERROR; startup path at DEBUG.
- drivers/tplink_oid.py: log login attempts (username only, never password),
  channel-change requests, and HTTP errors. No sensitive data is logged.
- README.md: document --verbose flag and log file location.
@vpadman1 vpadman1 force-pushed the vignesh/structured-logging branch from 6d8f3cf to d21ee71 Compare April 16, 2026 18:33
@vpadman1 vpadman1 merged commit 10f0429 into main Apr 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant