Skip to content

Commit

Permalink
works locally in packages/consensus dir only
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejka committed Sep 26, 2024
1 parent 3d75a6d commit 3bd5589
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
1 change: 0 additions & 1 deletion Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies = [
name = "consensus"
version = "0.1.0"
dependencies = [
"logging",
"logging_macros",
"utils",
]
Expand Down
2 changes: 1 addition & 1 deletion packages/consensus/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ log_level_debug = []

[dependencies]
utils = { path = "../utils" }
logging = { path = "../logging" }
# logging = { path = "../logging" }
logging_macros = { path = "../logging_macros" }

[dev-dependencies]
Expand Down
29 changes: 25 additions & 4 deletions packages/consensus/src/logging.cairo
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
#[cfg(feature: 'log_level_trace')]
mod log_levels {
pub const LOG_LEVEL_TRACE: bool = true;
pub const LOG_LEVEL_DEBUG: bool = true;
}

#[cfg(feature: 'log_level_debug')]
mod log_levels {
pub const LOG_LEVEL_TRACE: bool = false;
pub const LOG_LEVEL_DEBUG: bool = true;
}

#[cfg(feature: 'log_level_none')]
mod log_levels {
pub const LOG_LEVEL_TRACE: bool = false;
pub const LOG_LEVEL_DEBUG: bool = false;
}

pub use log_levels::LOG_LEVEL_TRACE;
pub use log_levels::LOG_LEVEL_DEBUG;

#[cfg(test)]
mod tests {
use logging::ABC;
use logging::LOG_LEVEL_DEBUG;
#[test]
fn test_log_level_debug() {// log!("DEBUG", "log! works");
fn test_log_level_debug() {
log!("DEBUG", "log! works");
}

#[test]
fn test_log_level_trace() {// log!("DEBUG", "log! works");
fn test_log_level_trace() {
log!("DEBUG", "log! works");
}
}

0 comments on commit 3bd5589

Please sign in to comment.