diff --git a/ica-rs/src/ica.rs b/ica-rs/src/ica.rs index 9d8e9d5..beacab3 100644 --- a/ica-rs/src/ica.rs +++ b/ica-rs/src/ica.rs @@ -101,12 +101,12 @@ pub async fn start_ica(config: &IcaConfig, stop_reciver: StopGetter) -> ClientRe } } // 等待停止信号 - event!(Level::INFO, "ica client waiting for stop signal"); + event!(Level::INFO, "{}", "ica client waiting for stop signal".purple()); stop_reciver.await.ok(); - event!(Level::INFO, "socketio client stopping"); + event!(Level::INFO, "{}", "socketio client stopping".yellow()); match socket.disconnect().await { Ok(_) => { - event!(Level::INFO, "socketio client stopped"); + event!(Level::INFO, "{}", "socketio client stopped".green()); Ok(()) } Err(e) => { @@ -114,7 +114,7 @@ pub async fn start_ica(config: &IcaConfig, stop_reciver: StopGetter) -> ClientRe match e { rust_socketio::Error::IncompleteResponseFromEngineIo(inner_e) => { if inner_e.to_string().contains("AlreadyClosed") { - event!(Level::INFO, "socketio client stopped"); + event!(Level::INFO, "{}", "socketio client stopped".green()); Ok(()) } else { event!(Level::ERROR, "socketio 客户端出现了 Error: {:?}", inner_e); diff --git a/ica-rs/src/main.rs b/ica-rs/src/main.rs index 5fc4e6a..49e5641 100644 --- a/ica-rs/src/main.rs +++ b/ica-rs/src/main.rs @@ -16,6 +16,7 @@ mod ica; #[cfg(feature = "tailchat")] mod tailchat; +use colored::Colorize; use config::BotConfig; use error::PyPluginError; use tracing::{event, span, Level}; @@ -167,7 +168,7 @@ fn main() -> anyhow::Result<()> { } async fn inner_main() -> anyhow::Result<()> { - let span = span!(Level::INFO, "Shenbot Main"); + let span = span!(Level::INFO, "bot-main"); let _enter = span.enter(); event!(Level::INFO, "shenbot-rs v{} starting", VERSION); @@ -184,28 +185,28 @@ async fn inner_main() -> anyhow::Result<()> { } // 准备一个用于停止 socket 的变量 - event!(Level::INFO, "启动 ICA"); let (ica_send, ica_recv) = tokio::sync::oneshot::channel::<()>(); if bot_config.check_ica() { + event!(Level::INFO, "{}", "开始启动 ICA".green()); let config = bot_config.ica(); tokio::spawn(async move { ica::start_ica(&config, ica_recv).await.unwrap(); }); } else { - event!(Level::INFO, "未启用 ica"); + event!(Level::INFO, "{}", "ica 未启用, 不管他".cyan()); } let (tailchat_send, tailchat_recv) = tokio::sync::oneshot::channel::<()>(); if bot_config.check_tailchat() { - event!(Level::INFO, "启动 Tailchat"); + event!(Level::INFO, "{}", "开始启动 tailchat".green()); let config = bot_config.tailchat(); tokio::spawn(async move { tailchat::start_tailchat(config, tailchat_recv).await.unwrap(); }); } else { - event!(Level::INFO, "未启用 Tailchat"); + event!(Level::INFO, "{}", "tailchat 未启用, 不管他".bright_magenta()); } tokio::time::sleep(Duration::from_secs(1)).await; diff --git a/news/0-9.md b/news/0-9.md index ed48a52..0f338a2 100644 --- a/news/0-9.md +++ b/news/0-9.md @@ -5,6 +5,7 @@ - 修复了 Python 插件停不下来就真的停不下来的问题 - 让初始化的时候 插件启/禁状态显示更明显了 - 有颜色啦! +- 加了不少颜色 ### ica 2.0.1