diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 7931284..72a2e2a 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -7,7 +7,7 @@ on: env: SHORT_NAME: tg - CRATE_NAME: telegram-message-source + CRATE_NAME: msgist-tg jobs: prepare: @@ -142,13 +142,6 @@ jobs: - name: Compress run: bash ./.github/compress.sh - - uses: dev-drprasad/delete-older-releases@v0.2.0 - with: - keep_latest: 2 - delete_tag_pattern: beta - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Github release uses: "marvinpinto/action-automatic-releases@latest" with: @@ -159,3 +152,11 @@ jobs: files: | packages/* LICENSE + + - name: Delete older releases + uses: dev-drprasad/delete-older-releases@v0.2.0 + with: + keep_latest: 1 + delete_tag_pattern: beta + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a9a9415..d147474 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ on: env: SHORT_NAME: tg - CRATE_NAME: telegram-message-source + CRATE_NAME: msgist-tg jobs: compile: diff --git a/Cargo.toml b/Cargo.toml index de27a49..53d7c93 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "telegram-message-source" +name = "msgist-tg" version = "1.7.0-rc1" authors = ["Itsusinn "] edition = "2021" diff --git a/src/handlers/receive.rs b/src/handlers/receive.rs index 916a495..2dc170a 100644 --- a/src/handlers/receive.rs +++ b/src/handlers/receive.rs @@ -23,8 +23,6 @@ use crate::{ static CHANNEL: LateInit> = LateInit::new(); -const TARGET: &str = "msgist::handlers"; - pub fn recover() -> Result<()> { let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel::<(i64, ArcStr)>(); tokio::spawn(async move { @@ -67,10 +65,7 @@ pub async fn nats_handler(message: nats::Message, target: ArcStr) -> Result<()> Ok(v) => v, Err(_e) => { // todo logging - tracing::warn!( - target: TARGET, - "未知的数据包类型,请更新本消息源,若已是最新请等待适配" - ); + tracing::warn!("未知的数据包类型,请更新本消息源,若已是最新请等待适配"); return Ok(()); } }; @@ -95,7 +90,7 @@ async fn msg_handler(mut message: Message, target: i64) -> Result<()> { let mut reunite_text = String::new(); for single in message.chain { - trace!(target:TARGET,element = ?single,"正在处理消息链中的元素"); + trace!(element = ?single,"正在处理消息链中的元素"); match single { MessageType::Text { content } => { reunite_text.write_str(&html::escape(content.as_str()))?; diff --git a/src/handlers/send.rs b/src/handlers/send.rs index e04a9a9..a8b7a29 100644 --- a/src/handlers/send.rs +++ b/src/handlers/send.rs @@ -19,7 +19,6 @@ use crate::{ config::CONFIG, ext::db::DbExt, }; -const TARGET: &str = "mesagisto::handlers"; #[instrument(skip(msg))] pub async fn answer_common(msg: Message) -> Result<()> { diff --git a/src/log.rs b/src/log.rs index a919a60..abf66e0 100644 --- a/src/log.rs +++ b/src/log.rs @@ -11,7 +11,6 @@ pub(crate) async fn init() -> Result<()> { // TODO EnvFilter; #[cfg(feature = "polylith")] let filter = tracing_subscriber::filter::Targets::new() - .with_target("teloxide", Level::TRACE) .with_target("telegram_message_source", Level::TRACE) .with_target("mesagisto_client", Level::TRACE) .with_target("msgist", Level::TRACE) @@ -20,7 +19,7 @@ pub(crate) async fn init() -> Result<()> { #[cfg(not(feature = "polylith"))] let filter = tracing_subscriber::filter::Targets::new() - .with_target("telegram_message_source", Level::DEBUG) + .with_target("msgist_tg", Level::DEBUG) .with_target("mesagisto_client", Level::DEBUG) .with_target("teloxide", Level::INFO) .with_default(Level::WARN); diff --git a/src/main.rs b/src/main.rs index b9900ab..5534b74 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,8 +34,6 @@ mod net; mod update; mod webhook; -const TARGET: &str = "msgist"; - #[tokio::main] async fn main() -> Result<()> { if cfg!(feature = "color") { @@ -61,14 +59,13 @@ async fn run() -> Result<()> { .replace('_', "-"); rust_i18n::set_locale(&locale); info!( - target: TARGET, "{}", t!("log.locale-not-configured", locale_ = &locale) ); } if !CONFIG.enable { - warn!(target: TARGET, "{}", t!("log.not-enable")); - warn!(target: TARGET, "{}", t!("log.not-enable-helper")); + warn!("{}", t!("log.not-enable")); + warn!("{}", t!("log.not-enable-helper")); return Ok(()); } CONFIG.migrate(); @@ -82,14 +79,14 @@ async fn run() -> Result<()> { tokio::task::spawn_blocking(|| { match update::update() { Ok(Status::UpToDate(_)) => { - info!(target: TARGET, "{}", t!("log.update-check-success")); + info!("{}", t!("log.update-check-success")); } Ok(Status::Updated(_)) => { - info!(target: TARGET, "{}", t!("log.upgrade-success")); + info!("{}", t!("log.upgrade-success")); std::process::exit(0); } Err(e) => { - error!(target: TARGET, "{}", e); + error!("{}", e); } }; }) @@ -116,7 +113,6 @@ async fn run() -> Result<()> { .apply() .await?; info!( - target: TARGET, "{}", t!("log.boot-start", version = env!("CARGO_PKG_VERSION")) ); @@ -132,7 +128,7 @@ async fn run() -> Result<()> { }); tokio::signal::ctrl_c().await?; CONFIG.save().await.expect("保存配置文件失败"); - info!(target: TARGET, "{}", t!("log.shutdown")); + info!("{}", t!("log.shutdown")); #[cfg(feature = "polylith")] opentelemetry::global::shutdown_tracer_provider();