aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/debug.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-05-03 01:31:04 +0800
committer魏曹先生 <1992414357@qq.com>2026-05-03 01:31:04 +0800
commit8422e0ada52d8036c32257d84f069776e520079e (patch)
treeb3d3c1aabc40d1c4ab35467fef6f68b6100779a4 /mingling_core/src/debug.rs
parent8f44a3e779fb8ee66c8f51b49d6c77e5a80e3821 (diff)
Add missing articles and improve documentation
Diffstat (limited to 'mingling_core/src/debug.rs')
-rw-r--r--mingling_core/src/debug.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/mingling_core/src/debug.rs b/mingling_core/src/debug.rs
index 9fd553c..f92cd3d 100644
--- a/mingling_core/src/debug.rs
+++ b/mingling_core/src/debug.rs
@@ -1,4 +1,6 @@
#[macro_export]
+/// A macro that only executes the given expressions when the `debug` feature is enabled.
+/// If the feature is not enabled, the expressions are compiled away.
macro_rules! only_debug {
($($expr:expr);* $(;)?) => {
#[cfg(feature = "debug")]
@@ -9,6 +11,8 @@ macro_rules! only_debug {
}
#[macro_export]
+/// Logs a message at the trace level, but only if the `debug` feature is enabled.
+/// Delegates to `log::trace!` internally.
macro_rules! trace {
($($arg:tt)*) => {
$crate::only_debug! {
@@ -18,6 +22,8 @@ macro_rules! trace {
}
#[macro_export]
+/// Logs a message at the debug level, but only if the `debug` feature is enabled.
+/// Delegates to `log::debug!` internally.
macro_rules! debug {
($($arg:tt)*) => {
$crate::only_debug! {
@@ -27,6 +33,8 @@ macro_rules! debug {
}
#[macro_export]
+/// Logs a message at the info level, but only if the `debug` feature is enabled.
+/// Delegates to `log::info!` internally.
macro_rules! info {
($($arg:tt)*) => {
$crate::only_debug! {
@@ -36,6 +44,8 @@ macro_rules! info {
}
#[macro_export]
+/// Logs a message at the warn level, but only if the `debug` feature is enabled.
+/// Delegates to `log::warn!` internally.
macro_rules! warn {
($($arg:tt)*) => {
$crate::only_debug! {
@@ -45,6 +55,8 @@ macro_rules! warn {
}
#[macro_export]
+/// Logs a message at the error level, but only if the `debug` feature is enabled.
+/// Delegates to `log::error!` internally.
macro_rules! error {
($($arg:tt)*) => {
$crate::only_debug! {