mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-16 14:52:31 +00:00
use logger
This commit is contained in:
1 parent
697942b137
commit
c0538a2a50
1 file changed
+7
-8
+7
-8
@@ -8,14 +8,11 @@ use twitchchat::{
|
||||
UserConfig,
|
||||
};
|
||||
|
||||
use anyhow::{Context, Error};
|
||||
use anyhow::anyhow;
|
||||
|
||||
use anyhow::{Context, Error};
|
||||
use log::{info, warn};
|
||||
use redis::aio::Connection;
|
||||
use redis::{AsyncCommands, RedisResult};
|
||||
|
||||
pub type AnyhowResult<T> = anyhow::Result<T>;
|
||||
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -28,6 +25,8 @@ use crate::twitch_client::TwitchClient;
|
||||
use crate::secrets::Secrets;
|
||||
use crate::redis_client::RedisClient;
|
||||
|
||||
pub type AnyhowResult<T> = anyhow::Result<T>;
|
||||
|
||||
const ENV_PUBLISH_TOPIC : &'static str = "PUBLISH_TOPIC";
|
||||
const ENV_PUBLISH_TOPIC_DEFAULT : &'static str = "twitch";
|
||||
|
||||
@@ -52,13 +51,13 @@ async fn main() -> anyhow::Result<()> {
|
||||
loop {
|
||||
match twitch_client.main_loop().await {
|
||||
Ok(_) => {
|
||||
println!("Early exit? Restarting...");
|
||||
warn!("Twitch early exit? Restarting...");
|
||||
thread::sleep(Duration::from_secs(5));
|
||||
},
|
||||
Err(e) => {
|
||||
println!("There was an error: {:?}", e);
|
||||
warn!("There was an error with Twitch: {:?}", e);
|
||||
thread::sleep(Duration::from_secs(5));
|
||||
println!("Restarting client...");
|
||||
warn!("Restarting Twitch client...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user