mirror of
https://github.com/supleed2/nanobot.git
synced 2024-12-22 14:15:51 +00:00
Add custom tracing_subscriber
This commit is contained in:
parent
f8eee82843
commit
f3929a7885
26
Cargo.lock
generated
26
Cargo.lock
generated
|
@ -287,17 +287,6 @@ dependencies = [
|
||||||
"windows-targets",
|
"windows-targets",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "colored"
|
|
||||||
version = "2.0.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6"
|
|
||||||
dependencies = [
|
|
||||||
"is-terminal",
|
|
||||||
"lazy_static",
|
|
||||||
"windows-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "comfy-table"
|
name = "comfy-table"
|
||||||
version = "6.2.0"
|
version = "6.2.0"
|
||||||
|
@ -1106,17 +1095,6 @@ version = "2.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6"
|
checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "is-terminal"
|
|
||||||
version = "0.4.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
|
|
||||||
dependencies = [
|
|
||||||
"hermit-abi",
|
|
||||||
"rustix",
|
|
||||||
"windows-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itertools"
|
name = "itertools"
|
||||||
version = "0.10.5"
|
version = "0.10.5"
|
||||||
|
@ -1313,6 +1291,7 @@ dependencies = [
|
||||||
"sqlx",
|
"sqlx",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
"tracing-subscriber",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2363,7 +2342,6 @@ dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"chrono",
|
"chrono",
|
||||||
"colored",
|
|
||||||
"prost-types",
|
"prost-types",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
@ -2377,7 +2355,6 @@ dependencies = [
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"tonic",
|
"tonic",
|
||||||
"tower",
|
"tower",
|
||||||
"tracing-subscriber",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -3162,6 +3139,7 @@ dependencies = [
|
||||||
"sharded-slab",
|
"sharded-slab",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"thread_local",
|
"thread_local",
|
||||||
|
"time",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-core",
|
"tracing-core",
|
||||||
"tracing-log",
|
"tracing-log",
|
||||||
|
|
|
@ -17,7 +17,7 @@ indoc = "2.0.4"
|
||||||
poise = "0.5.6"
|
poise = "0.5.6"
|
||||||
reqwest = { version = "0.11.20", features = ["json"] }
|
reqwest = { version = "0.11.20", features = ["json"] }
|
||||||
serde = { version = "1.0.188", features = ["derive"] }
|
serde = { version = "1.0.188", features = ["derive"] }
|
||||||
shuttle-runtime = "0.27.0"
|
shuttle-runtime = { version = "0.27.0", default-features = false }
|
||||||
shuttle-secrets = "0.27.0"
|
shuttle-secrets = "0.27.0"
|
||||||
shuttle-shared-db = { version = "0.27.0", features = ["postgres"] }
|
shuttle-shared-db = { version = "0.27.0", features = ["postgres"] }
|
||||||
sqlx = { version = "0.7.2", features = [
|
sqlx = { version = "0.7.2", features = [
|
||||||
|
@ -27,4 +27,5 @@ sqlx = { version = "0.7.2", features = [
|
||||||
] }
|
] }
|
||||||
tokio = "1.32.0"
|
tokio = "1.32.0"
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
|
tracing-subscriber = { version = "0.3.17", features = ["time"] }
|
||||||
url = "2.4.1"
|
url = "2.4.1"
|
||||||
|
|
13
src/main.rs
13
src/main.rs
|
@ -54,6 +54,19 @@ async fn poise(
|
||||||
#[shuttle_secrets::Secrets] secret_store: shuttle_secrets::SecretStore,
|
#[shuttle_secrets::Secrets] secret_store: shuttle_secrets::SecretStore,
|
||||||
#[shuttle_shared_db::Postgres] pool: sqlx::PgPool,
|
#[shuttle_shared_db::Postgres] pool: sqlx::PgPool,
|
||||||
) -> Result<service::NanoBot, shuttle_runtime::Error> {
|
) -> Result<service::NanoBot, shuttle_runtime::Error> {
|
||||||
|
// Set Up Tracing Subscriber
|
||||||
|
use tracing_subscriber as ts;
|
||||||
|
use ts::prelude::*;
|
||||||
|
ts::registry()
|
||||||
|
.with(ts::fmt::layer().without_time())
|
||||||
|
.with(
|
||||||
|
tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| {
|
||||||
|
tracing_subscriber::EnvFilter::new("info,nano=info,shuttle=trace,serenity=warn")
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.init();
|
||||||
|
tracing::info!("Tracing Subscriber Set Up");
|
||||||
|
|
||||||
// Run SQLx Migrations
|
// Run SQLx Migrations
|
||||||
sqlx::migrate!()
|
sqlx::migrate!()
|
||||||
.run(&pool)
|
.run(&pool)
|
||||||
|
|
Loading…
Reference in a new issue