summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ecs/Cargo.toml5
-rw-r--r--ecs/src/component/storage.rs4
-rw-r--r--ecs/src/lib.rs11
-rw-r--r--ecs/src/lock.rs6
-rw-r--r--ecs/src/query.rs3
5 files changed, 4 insertions, 25 deletions
diff --git a/ecs/Cargo.toml b/ecs/Cargo.toml
index 5e1abac..738998f 100644
--- a/ecs/Cargo.toml
+++ b/ecs/Cargo.toml
@@ -3,14 +3,11 @@ name = "ecs"
version = "0.1.0"
edition = "2021"
-[features]
-debug = ["dep:tracing"]
-
[dependencies]
seq-macro = "0.3.5"
paste = "1.0.14"
thiserror = "1.0.49"
-tracing = { version = "0.1.39", optional = true }
+tracing = "0.1.39"
linkme = "0.3.29"
hashbrown = "0.15.2"
ecs-macros = { path = "../ecs-macros" }
diff --git a/ecs/src/component/storage.rs b/ecs/src/component/storage.rs
index 5ce587f..590d84d 100644
--- a/ecs/src/component/storage.rs
+++ b/ecs/src/component/storage.rs
@@ -75,7 +75,7 @@ impl Storage
self.entity_archetype_lookup.remove(&entity_uid);
}
- #[cfg_attr(feature = "debug", tracing::instrument(skip_all))]
+ #[tracing::instrument(skip_all)]
pub fn push_entity(
&mut self,
entity_uid: Uid,
@@ -87,8 +87,6 @@ impl Storage
}
components.sort_by_key(|component| component.self_id());
-
- #[cfg(feature = "debug")]
tracing::debug!(
"Pushing entity with components: ({})",
&components.iter().fold(
diff --git a/ecs/src/lib.rs b/ecs/src/lib.rs
index 1fb755f..efdb6d5 100644
--- a/ecs/src/lib.rs
+++ b/ecs/src/lib.rs
@@ -102,7 +102,7 @@ impl World
entity_uid
}
- #[cfg_attr(feature = "debug", tracing::instrument(skip_all))]
+ #[tracing::instrument(skip_all)]
#[doc(hidden)]
pub fn create_entity_with_uid<Comps>(&self, components: Comps, entity_uid: Uid)
where
@@ -118,7 +118,6 @@ impl World
.expect("Failed to acquire read-write component storage lock")
.push_entity(entity_uid, components.into_vec())
{
- #[cfg(feature = "debug")]
tracing::error!("Failed to create entity: {err}");
return;
@@ -297,7 +296,7 @@ impl World
}
}
- #[cfg_attr(feature = "debug", tracing::instrument(skip_all))]
+ #[tracing::instrument(skip_all)]
fn perform_queued_actions(&self)
{
let mut active_action_queue = match *self.data.action_queue.active_queue.borrow()
@@ -324,7 +323,6 @@ impl World
if let Err(err) = component_storage_lock
.push_entity(Uid::new_unique(UidKind::Entity), components)
{
- #[cfg(feature = "debug")]
tracing::error!("Failed to create entity: {err}");
continue;
@@ -400,7 +398,6 @@ impl World
let Some(archetype) = component_storage_lock.get_entity_archetype(entity_uid)
else {
- #[cfg(feature = "debug")]
tracing::error!("No archetype for entity {entity_uid:?} was found");
return;
@@ -629,7 +626,6 @@ impl Drop for SoleStorage
for sole in self.storage.values_mut() {
if sole.drop_last {
- #[cfg(feature = "debug")]
tracing::debug!(
"Sole {} pushed to dropping last queue",
sole.sole.read_nonblock().unwrap().type_name()
@@ -638,8 +634,6 @@ impl Drop for SoleStorage
soles_to_drop_last.push(sole);
continue;
}
-
- #[cfg(feature = "debug")]
tracing::debug!(
"Dropping sole {}",
sole.sole.read_nonblock().unwrap().type_name()
@@ -651,7 +645,6 @@ impl Drop for SoleStorage
}
for sole in &mut soles_to_drop_last {
- #[cfg(feature = "debug")]
tracing::debug!(
"Dropping sole {} last",
sole.sole.read_nonblock().unwrap().type_name()
diff --git a/ecs/src/lock.rs b/ecs/src/lock.rs
index 135f654..bc5351f 100644
--- a/ecs/src/lock.rs
+++ b/ecs/src/lock.rs
@@ -31,8 +31,6 @@ where
TryLockError::WouldBlock => Err(Error::ReadUnavailable),
TryLockError::Poisoned(poison_err) => Ok(poison_err.into_inner()),
})?;
-
- #[cfg(feature = "debug")]
tracing::trace!("Acquired lock to value of type {}", guard.type_name());
Ok(ReadGuard { inner: guard })
@@ -48,8 +46,6 @@ where
TryLockError::WouldBlock => Err(Error::WriteUnavailable),
TryLockError::Poisoned(poison_err) => Ok(poison_err.into_inner()),
})?;
-
- #[cfg(feature = "debug")]
tracing::trace!(
"Acquired mutable lock to value of type {}",
guard.type_name()
@@ -118,7 +114,6 @@ where
{
fn drop(&mut self)
{
- #[cfg(feature = "debug")]
tracing::trace!("Dropped lock to value of type {}", self.type_name());
}
}
@@ -159,7 +154,6 @@ where
{
fn drop(&mut self)
{
- #[cfg(feature = "debug")]
tracing::trace!("Dropped mutable lock to value of type {}", self.type_name());
}
}
diff --git a/ecs/src/query.rs b/ecs/src/query.rs
index 3ee7e5b..bc9308a 100644
--- a/ecs/src/query.rs
+++ b/ecs/src/query.rs
@@ -36,7 +36,6 @@ where
&'query self,
) -> ComponentIter<'query, 'world, Comps, FlexibleQueryIter<'query>>
{
- #[cfg(feature = "debug")]
tracing::debug!("Searching for {}", std::any::type_name::<Comps>());
ComponentIter {
@@ -53,7 +52,6 @@ where
&'query self,
) -> ComponentAndEuidIter<'query, 'world, Comps, FlexibleQueryIter<'query>>
{
- #[cfg(feature = "debug")]
tracing::debug!("Searching for {}", std::any::type_name::<Comps>());
ComponentAndEuidIter {
@@ -76,7 +74,6 @@ where
where
OutIter: Iterator<Item = EntityHandle<'query>>,
{
- #[cfg(feature = "debug")]
tracing::debug!("Searching for {}", std::any::type_name::<Comps>());
ComponentIter {