Update logging
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user