- update: logging system to only show logs from the app and not any 3rd party dependencies
This commit is contained in:
@@ -15,7 +15,7 @@ argon2 = "0.5.3"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
dotenv = "0.15"
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "chrono"] }
|
||||
tracing-subscriber = { version = "0.3.19", features = ["env-filter", "chrono"] }
|
||||
prost = "0.13.4"
|
||||
prost-types = "0.13.3"
|
||||
chrono = { version = "0.4.38", features = ["serde"] }
|
||||
|
||||
@@ -4,14 +4,12 @@ use auth_service::database_client::DatabaseClientTrait;
|
||||
use auth_service::grpc::MyAuthService;
|
||||
use auth_service::session::session_service_client::SessionServiceClient;
|
||||
use dotenv::dotenv;
|
||||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
use tonic::transport::Server;
|
||||
use tracing::{debug, info, Level};
|
||||
use utils::consul_registration;
|
||||
use utils::multi_service_load_balancer::{LoadBalancingStrategy, MultiServiceLoadBalancer};
|
||||
use tracing::info;
|
||||
use tracing_subscriber::{fmt, EnvFilter};
|
||||
use utils::logging;
|
||||
use utils::service_discovery::{get_kube_service_endpoints_by_dns};
|
||||
|
||||
#[tokio::main]
|
||||
@@ -19,13 +17,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Load environment variables from .env
|
||||
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());
|
||||
let port = env::var("SERVICE_PORT").unwrap_or_else(|_| "50051".to_string());
|
||||
@@ -45,7 +39,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let (mut health_reporter, health_service) = tonic_health::server::health_reporter();
|
||||
health_reporter.set_serving::<AuthServiceServer<MyAuthService>>().await;
|
||||
|
||||
println!("Authentication Service running on {}", addr);
|
||||
info!("Authentication Service running on {}", addr);
|
||||
|
||||
// Start the gRPC server
|
||||
tokio::spawn(
|
||||
|
||||
Reference in New Issue
Block a user