- update: logging system to only show logs from the app and not any 3rd party dependencies

This commit is contained in:
2025-03-19 02:13:02 -04:00
parent 03cef8e526
commit 98b8d412e7
16 changed files with 57 additions and 61 deletions

View File

@@ -9,7 +9,7 @@ dotenv = "0.15"
tokio = { version = "1.41.1", features = ["full"] }
serde = { version = "1.0", features = ["derive"] }
tracing = "0.1"
tracing-subscriber = "0.3.18"
tracing-subscriber = { version = "0.3.19", features = ["env-filter", "chrono"] }
tonic = "0.12.3"
prost = "0.13.4"
warp = "0.3.7"

View File

@@ -10,7 +10,8 @@ use std::sync::Arc;
use tokio::sync::Mutex;
use tonic::transport::Server;
use tracing::Level;
use utils::consul_registration;
use tracing_subscriber::{fmt, EnvFilter};
use utils::{consul_registration, logging};
use utils::redis_cache::RedisCache;
pub mod common {
@@ -24,12 +25,8 @@ pub mod api {
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
dotenv().ok();
tracing_subscriber::fmt()
.with_max_level(
Level::from_str(&env::var("LOG_LEVEL").unwrap_or_else(|_| "info".to_string()))
.unwrap_or_else(|_| Level::INFO),
)
.init();
let app_name = env!("CARGO_PKG_NAME");
logging::setup_logging(app_name);
// Set the gRPC server address
let addr = env::var("LISTEN_ADDR").unwrap_or_else(|_| "0.0.0.0".to_string());