Tracing_subscriber targets based on an enum

I have an enum:

pub enum LogLevel {
        #[default]
        Minimal,
        Application,
        ApplicationAndDatabase,
    }

and I am trying to enable different log levels on the basis of value of LogLevel provided:


fn init_tracing(log_level: LogLevel) -> Result<()> {
    use tracing_subscriber::{filter::Targets, fmt, layer::SubscriberExt};
    let tmp_dir = PathBuf::new().join(TEMP_DIR);
    create_dir_all(&tmp_dir)?;
    let writer = LogFileInitializer {
        directory: tmp_dir,
        filename: PROJECT_NAME,
        max_n_old_files: 2,
        preferred_max_file_size_mib: 1,
    }
    .init()?;

    static SEA_ORM_TARGET: &str = "sea_orm";

    let default_targets = Targets::new()
        .with_target(PROJECT_NAME, LevelFilter::INFO)
        .with_target(SEA_ORM_TARGET, LevelFilter::INFO);

    let filter = match log_level {
        LogLevel::Minimal => default_targets,
        LogLevel::Application => default_targets.with_target(PROJECT_NAME, LevelFilter::DEBUG),
        LogLevel::ApplicationAndDatabase => default_targets
            .with_target(PROJECT_NAME, LevelFilter::DEBUG)
            .with_target(SEA_ORM_TARGET, LevelFilter::DEBUG),
    };

    dbg!(&filter);

    tracing::subscriber::set_global_default(
        fmt::Subscriber::builder()
            .finish()
            .with(filter)
            .with(fmt::Layer::default().with_writer(writer).with_ansi(false)),
    )
    .expect("Unable to set global tracing subscriber");

    Ok(())
}

But regardless of what I do, it only shows info logs of PROJECT_NAME (ryot), i.e. the equivalent of RUST_LOG=ryot=info,sea_orm=info.