Add dependencies, set up tracing

This commit is contained in:
Xiretza 2024-02-10 09:53:28 +00:00
parent 0adbf28b5c
commit bde8d3da15
3 changed files with 2636 additions and 2 deletions

2597
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -10,4 +10,14 @@ license = "AGPL-3.0-or-later"
keywords = ["offline"] keywords = ["offline"]
categories = ["authentication", "games"] categories = ["authentication", "games"]
[profile.dev.package.backtrace]
opt-level = 3
[dependencies] [dependencies]
axum = "0.7.4"
color-eyre = { version = "0.6.2" }
ldap3 = { version = "0.11.3", default-features = false, features = ["tls-rustls"] }
sqlx = { version = "0.7.3", features = ["runtime-tokio", "tls-rustls"] }
tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }

View file

@ -19,6 +19,33 @@
#![warn(clippy::pedantic, clippy::as_conversions)] #![warn(clippy::pedantic, clippy::as_conversions)]
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
fn main() { use color_eyre::Result;
println!("Hello, world!"); use tracing::{event, instrument, Level};
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
#[instrument]
fn init() -> Result<()> {
color_eyre::install()?;
let filter_layer = EnvFilter::try_from_default_env()
.or_else(|_| EnvFilter::try_new("info"))
.unwrap();
let fmt_layer = tracing_subscriber::fmt::layer().with_target(true);
tracing_subscriber::registry()
.with(filter_layer)
.with(fmt_layer)
.init();
Ok(())
}
#[tokio::main]
#[instrument]
async fn main() -> Result<()> {
init()?;
event!(Level::INFO, "Hello, world!");
Ok(())
} }