taskr/src/main.rs

38 lines
878 B
Rust
Raw Normal View History

2024-03-18 22:46:41 -05:00
use tasks::Tasks;
use tracing::{info, instrument};
use tracing_subscriber::{filter::LevelFilter, EnvFilter};
const ANSI_CLEAR: &'static str = "\x1b[2J\x1b[1;1H";
mod config;
mod gitlab;
mod jira;
mod tasks;
#[instrument]
pub fn init() {
color_eyre::install().expect("Failed to install color_eyre");
setup_trace_logger();
info!("Instrumentation initialized.");
}
#[instrument]
pub fn setup_trace_logger() {
let filter = EnvFilter::builder()
.with_default_directive(LevelFilter::TRACE.into())
.parse_lossy("trace,tasks=trace");
tracing_subscriber::fmt().with_env_filter(filter).init();
}
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
init();
tracing::info!("{ANSI_CLEAR}Hallo, mate!");
let tasks = Tasks::try_new()?;
let gitlab_user = tasks.gitlab.me().await?;
info!("{gitlab_user:#?}");
Ok(())
}