diff --git a/src/main.rs b/src/main.rs index 9916606..a0cdfb0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ use crates_io_api::AsyncClient; use rustina::{ handler, - utils::{github::GitHub, groups::Groups, resources::Resources}, + utils::{github::GitHub, groups::Groups, resources::Resources, cargo_like_log}, }; use std::error::Error; use teloxide::{prelude::*, update_listeners::webhooks}; @@ -38,7 +38,7 @@ async fn main() -> Result<(), Box> { match std::env::var("WEBHOOK_URL") { Ok(v) => { - println!("Starting webhook on {}", v); + cargo_like_log("Mode", &format!("Starting webhook on {}", v)); let addr = ([0, 0, 0, 0], 8443).into(); // port 8443 let listener = webhooks::axum(bot, webhooks::Options::new(addr, v.parse().unwrap())) .await @@ -54,7 +54,7 @@ async fn main() -> Result<(), Box> { .await; } Err(_) => { - println!("Starting polling..."); + cargo_like_log("Mode", "Starting polling on localhost"); dispatcher.dispatch().await; } } diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 9679e1f..e9b6636 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -4,3 +4,14 @@ pub mod inlines; pub mod keyboard; pub mod message; pub mod resources; + +pub fn cargo_like_log(title: &str, message: &str) { + println!("{}{}{}{} {} {}", + " ".repeat(12 - title.len()), + "\x1b[1;32m", + title, + "\x1b[0m", + message, + " ".repeat(8) + ); +} \ No newline at end of file