feat: add color eyre

This commit is contained in:
Zynh Ludwig 2025-01-12 15:10:56 -08:00
parent 720b9857a9
commit f23b24bcb4
3 changed files with 74 additions and 12 deletions

78
Cargo.lock generated
View file

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "addr2line"
version = "0.22.0"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678"
checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
dependencies = [
"gimli",
]
@ -234,9 +234,9 @@ dependencies = [
[[package]]
name = "backtrace"
version = "0.3.73"
version = "0.3.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a"
checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d"
dependencies = [
"addr2line",
"cc",
@ -349,6 +349,33 @@ dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "color-eyre"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55146f5e46f237f7423d74111267d4597b59b0dad0ffaf7303bce9945d843ad5"
dependencies = [
"backtrace",
"color-spantrace",
"eyre",
"indenter",
"once_cell",
"owo-colors",
"tracing-error",
]
[[package]]
name = "color-spantrace"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd6be1b2a7e382e2b98b43b2adcca6bb0e465af0bdd38123873ae61eb17a72c2"
dependencies = [
"once_cell",
"owo-colors",
"tracing-core",
"tracing-error",
]
[[package]]
name = "concurrent-queue"
version = "2.5.0"
@ -543,6 +570,16 @@ dependencies = [
"pin-project-lite",
]
[[package]]
name = "eyre"
version = "0.6.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec"
dependencies = [
"indenter",
"once_cell",
]
[[package]]
name = "fastrand"
version = "2.1.1"
@ -736,9 +773,9 @@ dependencies = [
[[package]]
name = "gimli"
version = "0.29.0"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
[[package]]
name = "h2"
@ -1021,6 +1058,12 @@ dependencies = [
"unicode-normalization",
]
[[package]]
name = "indenter"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
[[package]]
name = "indexmap"
version = "2.4.0"
@ -1292,7 +1335,7 @@ dependencies = [
[[package]]
name = "nyazoom"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"async-bincode",
"async-trait",
@ -1301,6 +1344,7 @@ dependencies = [
"axum-extra",
"bincode",
"chrono",
"color-eyre",
"futures",
"headers",
"http-body-util",
@ -1322,9 +1366,9 @@ dependencies = [
[[package]]
name = "object"
version = "0.36.3"
version = "0.32.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9"
checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
dependencies = [
"memchr",
]
@ -1385,6 +1429,12 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]]
name = "owo-colors"
version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
[[package]]
name = "parking"
version = "2.2.0"
@ -2521,6 +2571,16 @@ dependencies = [
"valuable",
]
[[package]]
name = "tracing-error"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db"
dependencies = [
"tracing",
"tracing-subscriber",
]
[[package]]
name = "tracing-log"
version = "0.2.0"

View file

@ -1,6 +1,6 @@
[package]
name = "nyazoom"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
authors = ["Zynh Ludwig <Zynh0722@gmail.com>"]
readme = "README.md"
@ -43,6 +43,7 @@ tower = { version = "0.5.0", features = ["util"] }
tower-http = { version = "0.5.0", features = ["fs", "trace", "limit"] }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
color-eyre = "0.6.3"
# I want to use askama's block feature, this requires unreleased 0.13
[dependencies.sqlx]

View file

@ -9,14 +9,15 @@ use axum_extra::TypedHeader;
use tower_http::{services::ServeDir, trace::TraceLayer};
use views::templates::WelcomeTemplate;
use std::{io, net::SocketAddr};
use std::net::SocketAddr;
use nyazoom::*;
use util::{headers::ForwardedFor, logging, sweeper};
#[tokio::main]
async fn main() -> io::Result<()> {
async fn main() -> color_eyre::Result<()> {
color_eyre::install()?;
logging::init_tracing();
// uses create_dir_all to create both .cache and serve inside it in one go