Skip to content

Commit

Permalink
Removed util module by moving location macro to bp3d-logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuri6037 committed Jul 18, 2024
1 parent 4b98436 commit c1ff8e5
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 40 deletions.
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ categories = ["development-tools", "development-tools::debugging", "development-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bp3d-logger = "2.0.0-rc.2.0.0"
bp3d-logger = "2.0.0-rc.2.1.0"

[build-dependencies]
semver = "1.0.7"
1 change: 0 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

mod util;
pub mod engine;
pub mod profiler;
pub mod field;
Expand Down
4 changes: 2 additions & 2 deletions core/src/logger/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
macro_rules! log {
($level: expr, $({$($field: tt)*})*, $msg: literal $(,$($args: tt)*)?) => {
{
static _CALLSITE: $crate::logger::Callsite = $crate::logger::Callsite::new(bp3d_logger::Location::new(module_path!(), file!(), line!()), $level);
static _CALLSITE: $crate::logger::Callsite = $crate::logger::Callsite::new(bp3d_logger::location!(), $level);
$crate::engine::get().log(&_CALLSITE, format_args!($msg $(, $($args),*)?), &[$($crate::field!($($field)*),)*]);
}
};
($level: expr, $msg: literal $(,$($args: tt)*)?) => {
{
static _CALLSITE: $crate::logger::Callsite = $crate::logger::Callsite::new(bp3d_logger::Location::new(module_path!(), file!(), line!()), $level);
static _CALLSITE: $crate::logger::Callsite = $crate::logger::Callsite::new(bp3d_logger::location!(), $level);
$crate::engine::get().log(&_CALLSITE, format_args!($msg $(, $($args),*)?), &[]);
}
};
Expand Down
4 changes: 2 additions & 2 deletions core/src/profiler/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
#[macro_export]
macro_rules! profiler_section_start {
($name: ident $(: $parent: ident)?, $level: expr, $({$($field: tt)*})*) => {
static $name: $crate::profiler::section::Section = $crate::profiler::section::Section::new(stringify!($name), bp3d_logger::Location::new(module_path!(), file!(), line!()), $level)
static $name: $crate::profiler::section::Section = $crate::profiler::section::Section::new(stringify!($name), bp3d_logger::location!(), $level)
$(.set_parent(&$parent))?;
let _section = $name.enter($crate::field::FieldSet::new([$($crate::field!($($field)*),)*]));
};
($name: ident $(: $parent: ident)?, $level: expr) => {
static $name: $crate::profiler::section::Section = $crate::profiler::section::Section::new(stringify!($name), bp3d_logger::Location::new(module_path!(), file!(), line!()), $level)
static $name: $crate::profiler::section::Section = $crate::profiler::section::Section::new(stringify!($name), bp3d_logger::location!(), $level)
$(.set_parent(&$parent))?;
let _section = $name.enter($crate::field::FieldSet::new([]));
};
Expand Down
3 changes: 2 additions & 1 deletion core/src/profiler/section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ impl Section {

#[cfg(test)]
mod tests {
use crate::{fields, location, profiler_section_start};
use bp3d_logger::location;
use crate::{fields, profiler_section_start};
use crate::field::FieldSet;
use crate::profiler::section::{Level, Section};

Expand Down
2 changes: 1 addition & 1 deletion core/src/trace/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
#[macro_export]
macro_rules! span {
($name: ident) => {
static $name: $crate::trace::span::Callsite = $crate::trace::span::Callsite::new(stringify!($name), bp3d_logger::Location::new(module_path!(), file!(), line!()));
static $name: $crate::trace::span::Callsite = $crate::trace::span::Callsite::new(stringify!($name), bp3d_logger::location!());
};
}
32 changes: 0 additions & 32 deletions core/src/util.rs

This file was deleted.

0 comments on commit c1ff8e5

Please sign in to comment.