feat: load log levels from env RUST_LOG

This commit is contained in:
Paul Campbell 2024-06-30 20:12:47 +01:00
parent c85eee85e9
commit 77d35e8a09

View file

@ -5,7 +5,8 @@ use git_next_git::repository::RepositoryFactory;
use git_next_server_actor::Server; use git_next_server_actor::Server;
use kxio::{fs::FileSystem, network::Network}; use kxio::{fs::FileSystem, network::Network};
use std::path::PathBuf; use std::path::PathBuf;
use tracing::{error, info, level_filters::LevelFilter}; use tracing::{error, info};
use tracing_subscriber::EnvFilter;
pub fn init(fs: FileSystem) { pub fn init(fs: FileSystem) {
let file_name = "git-next-server.toml"; let file_name = "git-next-server.toml";
@ -64,7 +65,7 @@ pub fn init_logging() {
.with_target(false) .with_target(false)
.with_file(true) .with_file(true)
.with_line_number(true) .with_line_number(true)
.with_filter(LevelFilter::INFO); .with_filter(EnvFilter::from_default_env());
tracing_subscriber::registry() tracing_subscriber::registry()
.with(console_subscriber::ConsoleLayer::builder().spawn()) .with(console_subscriber::ConsoleLayer::builder().spawn())
.with(subscriber) .with(subscriber)