Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move once from bevy_log to bevy_utils, to allow for it's use in bevy_ecs #11419

Merged
merged 3 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions crates/bevy_log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
//! For more fine-tuned control over logging behavior, set up the [`LogPlugin`] or
//! `DefaultPlugins` during app initialization.

mod once;

#[cfg(feature = "trace")]
use std::panic;

Expand All @@ -31,12 +29,17 @@ pub mod prelude {
debug, debug_span, error, error_span, info, info_span, trace, trace_span, warn, warn_span,
};

pub use crate::{debug_once, error_once, info_once, trace_once, warn_once};
#[doc(hidden)]
pub use bevy_utils::{debug_once, error_once, info_once, once, trace_once, warn_once};
}

pub use bevy_utils::tracing::{
debug, debug_span, error, error_span, info, info_span, trace, trace_span, warn, warn_span,
Level,
pub use bevy_utils::{
debug_once, error_once, info_once, once, trace_once,
tracing::{
debug, debug_span, error, error_span, info, info_span, trace, trace_span, warn, warn_span,
Level,
},
warn_once,
};
pub use tracing_subscriber;

Expand Down
1 change: 1 addition & 0 deletions crates/bevy_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ mod cow_arc;
mod default;
mod float_ord;
pub mod intern;
mod once;

pub use crate::uuid::Uuid;
pub use ahash::{AHasher, RandomState};
Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_log/src/once.rs → crates/bevy_utils/src/once.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ macro_rules! once {
#[macro_export]
macro_rules! trace_once {
($($arg:tt)+) => ({
$crate::once!($crate::trace!($($arg)+))
$crate::once!($crate::tracing::trace!($($arg)+))
});
}

Expand All @@ -27,7 +27,7 @@ macro_rules! trace_once {
#[macro_export]
macro_rules! debug_once {
($($arg:tt)+) => ({
$crate::once!($crate::debug!($($arg)+))
$crate::once!($crate::tracing::debug!($($arg)+))
});
}

Expand All @@ -37,7 +37,7 @@ macro_rules! debug_once {
#[macro_export]
macro_rules! info_once {
($($arg:tt)+) => ({
$crate::once!($crate::info!($($arg)+))
$crate::once!($crate::tracing::info!($($arg)+))
});
}

Expand All @@ -47,7 +47,7 @@ macro_rules! info_once {
#[macro_export]
macro_rules! warn_once {
($($arg:tt)+) => ({
$crate::once!($crate::warn!($($arg)+))
$crate::once!($crate::tracing::warn!($($arg)+))
});
}

Expand All @@ -57,6 +57,6 @@ macro_rules! warn_once {
#[macro_export]
macro_rules! error_once {
($($arg:tt)+) => ({
$crate::once!($crate::error!($($arg)+))
$crate::once!($crate::tracing::error!($($arg)+))
});
}
Loading