Update logging

This commit is contained in:
2025-02-28 19:28:59 +01:00
parent 82f5cb4513
commit eccceef663
3 changed files with 11 additions and 3 deletions

View File

@@ -27,6 +27,6 @@ async fn main() {
);
if let Err(e) = webhook_result {
eprintln!("Error in webhook: {:?}", e);
tracing::error!("Error starting Twitch webhook: {}", e);
}
}

View File

@@ -14,10 +14,12 @@ impl SubscriptionManager {
}
pub async fn init(&self) {
println!("SubscriptionManager initialized");
tracing::debug!("Initializing subscription manager");
}
pub async fn subscribe(&self, telegram_user_id: u64, username: String) {
tracing::debug!("Subscribing {} to {}", telegram_user_id, username);
self.subscriptions
.write()
.await
@@ -27,6 +29,8 @@ impl SubscriptionManager {
}
pub async fn unsubscribe(&self, telegram_user_id: u64, username: String) {
tracing::debug!("Unsubscribing {} from {}", telegram_user_id, username);
self.subscriptions
.write()
.await

View File

@@ -130,6 +130,8 @@ pub async fn twitch_eventsub(
}
use twitch_api::eventsub::{Message as M, Payload as P};
tracing::info!("Event: {:?}", event);
match event {
Event::StreamOnlineV1(P {
message:
@@ -197,6 +199,8 @@ impl TwitchWebhookServer {
}
pub async fn subscribe(&self, streamer: String) -> bool {
tracing::info!("Subscribing to {}", streamer);
match eventsub_register(
self.app_access_token.clone(),
streamer.clone(),
@@ -206,7 +210,7 @@ impl TwitchWebhookServer {
{
Ok(_) => true,
Err(err) => {
eprintln!("Error subscribing to {}: {}", streamer, err);
tracing::error!("Failed to subscribe to {}: {:?}", streamer, err);
false
}
}