diff --git a/src/core/log/mod.rs b/src/core/log/mod.rs index 49efe56d..daa6b8e8 100644 --- a/src/core/log/mod.rs +++ b/src/core/log/mod.rs @@ -2,17 +2,26 @@ pub mod capture; pub mod color; pub mod fmt; mod reload; -mod server; mod suppress; pub use capture::Capture; pub use reload::{LogLevelReloadHandles, ReloadHandle}; -pub use server::Server; pub use suppress::Suppress; pub use tracing::Level; pub use tracing_core::{Event, Metadata}; pub use tracing_subscriber::EnvFilter; +/// Logging subsystem. This is a singleton member of super::Server which holds +/// all logging and tracing related state rather than shoving it all in +/// super::Server directly. +pub struct Log { + /// General log level reload handles. + pub reload: LogLevelReloadHandles, + + /// Tracing capture state for ephemeral/oneshot uses. + pub capture: std::sync::Arc, +} + // Wraps for logging macros. Use these macros rather than extern tracing:: or // log:: crates in project code. ::log and ::tracing can still be used if // necessary but discouraged. Remember debug_ log macros are also exported to diff --git a/src/core/log/server.rs b/src/core/log/server.rs deleted file mode 100644 index 644cecd1..00000000 --- a/src/core/log/server.rs +++ /dev/null @@ -1,14 +0,0 @@ -use std::sync::Arc; - -use super::{capture, reload::LogLevelReloadHandles}; - -/// Logging subsystem. This is a singleton member of super::Server which holds -/// all logging and tracing related state rather than shoving it all in -/// super::Server directly. -pub struct Server { - /// General log level reload handles. - pub reload: LogLevelReloadHandles, - - /// Tracing capture state for ephemeral/oneshot uses. - pub capture: Arc, -} diff --git a/src/core/server.rs b/src/core/server.rs index 2aa821fa..e76e4d57 100644 --- a/src/core/server.rs +++ b/src/core/server.rs @@ -33,7 +33,7 @@ pub struct Server { pub signal: broadcast::Sender<&'static str>, /// Logging subsystem state - pub log: log::Server, + pub log: log::Log, /// TODO: move stats pub requests_spawn_active: AtomicU32, @@ -45,7 +45,7 @@ pub struct Server { impl Server { #[must_use] - pub fn new(config: Config, runtime: Option, log: log::Server) -> Self { + pub fn new(config: Config, runtime: Option, log: log::Log) -> Self { Self { config, started: SystemTime::now(), diff --git a/src/main/server.rs b/src/main/server.rs index dfe75541..f72b3ef3 100644 --- a/src/main/server.rs +++ b/src/main/server.rs @@ -1,12 +1,6 @@ use std::sync::Arc; -use conduit::{ - config::Config, - info, - log::{self}, - utils::sys, - Error, Result, -}; +use conduit::{config::Config, info, log::Log, utils::sys, Error, Result}; use tokio::runtime; use crate::{clap::Args, tracing::TracingFlameGuard}; @@ -52,7 +46,7 @@ impl Server { server: Arc::new(conduit::Server::new( config, runtime.cloned(), - log::Server { + Log { reload: tracing_reload_handle, capture, },