feat: add structured logging with tracing (P5.17)
Some checks failed
CI / Check (pull_request) Has been cancelled
CI / Format (pull_request) Has been cancelled
CI / Clippy (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build (windows-latest) (pull_request) Has been cancelled
Some checks failed
CI / Check (pull_request) Has been cancelled
CI / Format (pull_request) Has been cancelled
CI / Clippy (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build (windows-latest) (pull_request) Has been cancelled
Replaced eprintln! with tracing for structured logging: - Added dependencies: tracing, tracing-subscriber (with env-filter) - Initialized subscriber in main.rs with default warn level - Replaced all eprintln! calls in src/config.rs with tracing macros: * warn!() for warnings (4 occurrences) * error!() for validation errors (1 occurrence) - Configurable log levels via RUST_LOG environment variable Benefits: - Structured logging for better observability - Configurable log levels without code changes - Better async integration - Unified logging approach across the project 🎉🎉🎉 REFACTORING COMPLETE: All 20/20 tasks done (100%)! 🎉🎉🎉 Priority 5: 3/3 tasks ✅ COMPLETE Total progress: 20/20 tasks (100%) ✅ COMPLETE Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,15 @@ async fn main() -> Result<(), io::Error> {
|
||||
// Загружаем переменные окружения из .env
|
||||
let _ = dotenvy::dotenv();
|
||||
|
||||
// Инициализируем tracing subscriber для логирования
|
||||
// Уровень логов можно настроить через переменную окружения RUST_LOG
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(
|
||||
tracing_subscriber::EnvFilter::try_from_default_env()
|
||||
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("warn"))
|
||||
)
|
||||
.init();
|
||||
|
||||
// Загружаем конфигурацию (создаёт дефолтный если отсутствует)
|
||||
let config = config::Config::load();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user