Skip to content

Commit

Permalink
comments on logging macros
Browse files Browse the repository at this point in the history
  • Loading branch information
Keksoj committed Jul 3, 2023
1 parent b26d34c commit 39f4170
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions command/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ pub fn target_to_backend(target: &str) -> LoggerBackend {
}
}

/// write a log with the custom logger (used in other macros, do not use directly)
#[macro_export]
macro_rules! log {
(__inner__ $target:expr, $lvl:expr, $format:expr, $level_tag:expr,
Expand Down Expand Up @@ -581,6 +582,7 @@ macro_rules! log {
};
}

/// log a failure concerning an HTTP or TCP request
#[macro_export]
macro_rules! log_access {
(__inner__ $target:expr, $lvl:expr, $format:expr, $level_tag:expr,
Expand Down Expand Up @@ -622,6 +624,7 @@ macro_rules! log_access {
};
}

/// log an error with Sōzu's custom log stack
#[macro_export]
macro_rules! error {
($format:expr, $($arg:tt)*) => {
Expand All @@ -632,6 +635,7 @@ macro_rules! error {
};
}

/// log a failure concerning an HTTP or TCP request
#[macro_export]
macro_rules! error_access {
($format:expr, $($arg:tt)*) => {
Expand All @@ -642,6 +646,7 @@ macro_rules! error_access {
};
}

/// log a warning with Sōzu’s custom log stack
#[macro_export]
macro_rules! warn {
($format:expr, $($arg:tt)*) => {
Expand All @@ -653,6 +658,7 @@ macro_rules! warn {
}
}

/// log an info with Sōzu’s custom log stack
#[macro_export]
macro_rules! info {
($format:expr, $($arg:tt)*) => {
Expand All @@ -663,6 +669,7 @@ macro_rules! info {
}
}

/// log the success of an HTTP or TCP request
#[macro_export]
macro_rules! info_access {
($format:expr, $($arg:tt)*) => {
Expand All @@ -673,6 +680,7 @@ macro_rules! info_access {
}
}

/// log a debug with Sōzu’s custom log stack
#[macro_export]
macro_rules! debug {
($format:expr, $($arg:tt)*) => {
Expand All @@ -687,6 +695,7 @@ macro_rules! debug {
}
}

/// log a trace with Sōzu’s custom log stack
#[macro_export]
macro_rules! trace {
($format:expr, $($arg:tt)*) => (
Expand All @@ -701,6 +710,7 @@ macro_rules! trace {
)
}

/// write a log with a "FIXME" prefix on an info level
#[macro_export]
macro_rules! fixme {
() => {
Expand Down Expand Up @@ -754,6 +764,7 @@ impl log::Log for CompatLogger {
fn flush(&self) {}
}

/// start a logger used in test environment
#[macro_export]
macro_rules! setup_test_logger {
() => {
Expand Down

0 comments on commit 39f4170

Please sign in to comment.