Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editoast: change from 'env_logger' to 'tracing-subscriber' #6650

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 83 additions & 52 deletions editoast/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion editoast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ actix-files = "0.6.5"
actix-web = "4.4.1"
actix-http = "3.5.1"
actix-cors = "0.7.0"
env_logger = "0.10.1"
tracing-subscriber = { version = "0.3.18", features = [ "env-filter" ] }
tracing = { version = "0.1.40", features = [ "log" ] }
redis = { version = "0.24.0", features = [
"tokio-comp",
Expand Down
16 changes: 14 additions & 2 deletions editoast/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,29 @@ use std::process::exit;
use std::{env, fs};
use thiserror::Error;
use tracing::{error, info, warn};
use tracing_subscriber::{layer::SubscriberExt as _, util::SubscriberInitExt as _};
use url::Url;
use validator::{Validate, ValidationErrorsKind};
use views::infra::InfraApiError;
use views::search::{SearchConfig, SearchConfigFinder, SearchConfigStore};

type DbPool = Pool<PgConnection>;

fn init_tracing() {
tracing_subscriber::registry()
.with(
tracing_subscriber::EnvFilter::builder()
// Set the default log level to 'info'
.with_default_directive(tracing_subscriber::filter::LevelFilter::INFO.into())
.from_env_lossy(),
)
.with(tracing_subscriber::fmt::layer().compact())
.init();
}

#[actix_web::main]
async fn main() {
// Set the default log level to 'info'
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
init_tracing();

match run().await {
Ok(_) => (),
Expand Down
Loading