rename log::Server to log::Log
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
06f01d384f
commit
20fe84379c
4 changed files with 15 additions and 26 deletions
|
@ -2,17 +2,26 @@ pub mod capture;
|
||||||
pub mod color;
|
pub mod color;
|
||||||
pub mod fmt;
|
pub mod fmt;
|
||||||
mod reload;
|
mod reload;
|
||||||
mod server;
|
|
||||||
mod suppress;
|
mod suppress;
|
||||||
|
|
||||||
pub use capture::Capture;
|
pub use capture::Capture;
|
||||||
pub use reload::{LogLevelReloadHandles, ReloadHandle};
|
pub use reload::{LogLevelReloadHandles, ReloadHandle};
|
||||||
pub use server::Server;
|
|
||||||
pub use suppress::Suppress;
|
pub use suppress::Suppress;
|
||||||
pub use tracing::Level;
|
pub use tracing::Level;
|
||||||
pub use tracing_core::{Event, Metadata};
|
pub use tracing_core::{Event, Metadata};
|
||||||
pub use tracing_subscriber::EnvFilter;
|
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
|
// 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
|
// log:: crates in project code. ::log and ::tracing can still be used if
|
||||||
// necessary but discouraged. Remember debug_ log macros are also exported to
|
// necessary but discouraged. Remember debug_ log macros are also exported to
|
||||||
|
|
|
@ -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>,
|
|
||||||
}
|
|
|
@ -33,7 +33,7 @@ pub struct Server {
|
||||||
pub signal: broadcast::Sender<&'static str>,
|
pub signal: broadcast::Sender<&'static str>,
|
||||||
|
|
||||||
/// Logging subsystem state
|
/// Logging subsystem state
|
||||||
pub log: log::Server,
|
pub log: log::Log,
|
||||||
|
|
||||||
/// TODO: move stats
|
/// TODO: move stats
|
||||||
pub requests_spawn_active: AtomicU32,
|
pub requests_spawn_active: AtomicU32,
|
||||||
|
@ -45,7 +45,7 @@ pub struct Server {
|
||||||
|
|
||||||
impl Server {
|
impl Server {
|
||||||
#[must_use]
|
#[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 {
|
Self {
|
||||||
config,
|
config,
|
||||||
started: SystemTime::now(),
|
started: SystemTime::now(),
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use conduit::{
|
use conduit::{config::Config, info, log::Log, utils::sys, Error, Result};
|
||||||
config::Config,
|
|
||||||
info,
|
|
||||||
log::{self},
|
|
||||||
utils::sys,
|
|
||||||
Error, Result,
|
|
||||||
};
|
|
||||||
use tokio::runtime;
|
use tokio::runtime;
|
||||||
|
|
||||||
use crate::{clap::Args, tracing::TracingFlameGuard};
|
use crate::{clap::Args, tracing::TracingFlameGuard};
|
||||||
|
@ -52,7 +46,7 @@ impl Server {
|
||||||
server: Arc::new(conduit::Server::new(
|
server: Arc::new(conduit::Server::new(
|
||||||
config,
|
config,
|
||||||
runtime.cloned(),
|
runtime.cloned(),
|
||||||
log::Server {
|
Log {
|
||||||
reload: tracing_reload_handle,
|
reload: tracing_reload_handle,
|
||||||
capture,
|
capture,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue