keep-starknet-strange / raito

Bitcoin ZK client written in Cairo.
https://raito.wtf
MIT License
40 stars 34 forks source link

feat: add logging macro #196

Closed TropicalDog17 closed 1 month ago

TropicalDog17 commented 1 month ago

Guide to be added in README.md of the logging package

Prequiste for using log! macro for a package:

# packages/consensus/src/logging.cairo
#[cfg(feature: 'log_level_trace')]
pub const LOG_LEVEL_TRACE: bool = true;

#[cfg(feature: 'log_level_trace')]
pub const LOG_LEVEL_DEBUG: bool = true;

#[cfg(feature: 'log_level_debug')]
pub const LOG_LEVEL_TRACE: bool = false;

#[cfg(feature: 'log_level_debug')]
pub const LOG_LEVEL_DEBUG: bool = true;

#[cfg(feature: 'log_level_none')]
pub const LOG_LEVEL_TRACE: bool = false;

#[cfg(feature: 'log_level_none')]
pub const LOG_LEVEL_DEBUG: bool = false;
pub mod logging;
vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
raito ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 25, 2024 2:36pm
maciejka commented 1 month ago

How is it going @TropicalDog17? It seems like this one is close to be finished.

TropicalDog17 commented 1 month ago

How is it going @TropicalDog17? It seems like this one is close to be finished.

Yeah @maciejka I think these feature-based constants cannot be imported from an external package, I tried some workaround but it's no luck, maybe the language hasn't supported that feature yet. It appears that for the logging feature to work correctly, the constant file needs to be placed within the specific package where we want to enable logging.

maciejka commented 1 month ago

Please check: https://github.com/keep-starknet-strange/raito/pull/224. I had to try it myself. Indeed there is a problem with conditional compilation in a multipackage project. Waiting for scarb developers response.

maciejka commented 1 month ago

Please check: #224. I had to try it myself. Indeed there is a problem with conditional compilation in a multipackage project. Waiting for scarb developers response.

image

maciejka commented 1 month ago

Please check: #224. I had to try it myself. Indeed there is a problem with conditional compilation in a multipackage project. Waiting for scarb developers response.

image

Which means we might need to wait until they implement it.

TropicalDog17 commented 1 month ago

Please check: #224. I had to try it myself. Indeed there is a problem with conditional compilation in a multipackage project. Waiting for scarb developers response.

image

Which means we might need to wait until they implement it.

yeah I see, and very weird that the language server still recognize that feature.

maciejka commented 1 month ago

yeah I see, and very weird that the language server still recognize that feature.

true

maciejka commented 1 month ago

I am closing it for now. We will need to revisit this issue once feature support in Scarb is more mature. The work with my small fixes is parked in branch: feat/logging-macro

maciejka commented 1 month ago

@TropicalDog17 please contact me on tg: @aundumla