Skip to main content

zond_engine/core/
logging.rs

1// Copyright (c) 2026 Erik Lening (hollowpointer) and Contributors
2//
3// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4// If a copy of the MPL was not distributed with this file, You can obtain one at
5// https://mozilla.org/MPL/2.0/.
6
7//! This module is currently a wrapper for the 'tracing' crate.
8//! The goal is to provide an abstraction so that other modules
9//! do not depend on tracing directrly, making it easy to swap
10//! our way of logging more easily in the future if needed.
11
12#[macro_export]
13macro_rules! info {
14    (incoming, $($arg:tt)+) => {
15        tracing::info!(status = "incoming", $($arg)+)
16    };
17    (outgoing, $($arg:tt)+) => {
18        tracing::info!(status = "outgoing", $($arg)+)
19    };
20    ($($arg:tt)+) => {
21        tracing::info!(status = "info", $($arg)+)
22    };
23}
24
25#[macro_export]
26macro_rules! success {
27    ($($arg:tt)+) => {
28        tracing::info!(status = "success", $($arg)+)
29    };
30}
31
32#[macro_export]
33macro_rules! debug {
34    ($($arg:tt)+) => {
35        tracing::debug!(status = "debug", $($arg)+)
36    };
37}
38
39#[macro_export]
40macro_rules! error {
41    ($($arg:tt)+) => {
42        tracing::error!(status = "error", $($arg)+)
43    };
44}
45
46#[macro_export]
47macro_rules! warn {
48    ($($arg:tt)+) => {
49        tracing::warn!(status = "warn", $($arg)+)
50    };
51}