rename log::Server to log::Log

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-06-26 00:19:35 +00:00
parent 06f01d384f
commit 20fe84379c
4 changed files with 15 additions and 26 deletions

View file

@ -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<capture::State>,
}
// 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

View file

@ -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<capture::State>,
}

View file

@ -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<runtime::Handle>, log: log::Server) -> Self {
pub fn new(config: Config, runtime: Option<runtime::Handle>, log: log::Log) -> Self {
Self {
config,
started: SystemTime::now(),

View file

@ -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,
},