Skip to content
Snippets Groups Projects
Commit 20fe8437 authored by Jason Volk's avatar Jason Volk
Browse files

rename log::Server to log::Log


Signed-off-by: default avatarJason Volk <jason@zemos.net>
parent 06f01d38
No related branches found
No related tags found
3 merge requests!480Misc,!475Room Alias related,!476Misc Admin related
...@@ -2,17 +2,26 @@ ...@@ -2,17 +2,26 @@
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
......
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 { ...@@ -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 { ...@@ -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(),
......
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 @@ pub(crate) fn build(args: Args, runtime: Option<&runtime::Handle>) -> Result<Arc ...@@ -52,7 +46,7 @@ pub(crate) fn build(args: Args, runtime: Option<&runtime::Handle>) -> Result<Arc
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,
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment