2019-08-14 02:52:43 +00:00
|
|
|
#![recursion_limit = "512"]
|
2021-03-25 19:30:15 +00:00
|
|
|
pub mod api_routes;
|
2020-07-10 18:15:41 +00:00
|
|
|
pub mod code_migrations;
|
2021-12-06 14:54:47 +00:00
|
|
|
pub mod root_span_builder;
|
2021-01-29 16:38:27 +00:00
|
|
|
pub mod scheduled_tasks;
|
2021-11-23 12:16:47 +00:00
|
|
|
|
|
|
|
use lemmy_utils::LemmyError;
|
|
|
|
use tracing::subscriber::set_global_default;
|
|
|
|
use tracing_error::ErrorLayer;
|
|
|
|
use tracing_log::LogTracer;
|
2021-12-06 14:54:47 +00:00
|
|
|
use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Registry};
|
2021-11-23 12:16:47 +00:00
|
|
|
|
|
|
|
pub fn init_tracing() -> Result<(), LemmyError> {
|
|
|
|
LogTracer::init()?;
|
|
|
|
|
|
|
|
let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"));
|
2021-12-06 14:54:47 +00:00
|
|
|
let format_layer = tracing_subscriber::fmt::layer();
|
2021-11-23 12:16:47 +00:00
|
|
|
|
|
|
|
let subscriber = Registry::default()
|
|
|
|
.with(env_filter)
|
|
|
|
.with(format_layer)
|
|
|
|
.with(ErrorLayer::default());
|
|
|
|
|
|
|
|
set_global_default(subscriber)?;
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|