Skip to content

Commit d8728b3

Browse files
authored
feat: logging in contract and non contract env (#39)
logging in contract and non contract env --------- Co-authored-by: plein <[email protected]> Co-authored-by: plein <[email protected]>
1 parent 9f071a9 commit d8728b3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

rust/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub(crate) mod common_generated {
2626
}
2727

2828
pub mod client_api;
29-
#[cfg(feature = "contract")]
3029
pub mod log;
3130
#[cfg(feature = "contract")]
3231
pub mod rand;

rust/src/log.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
#[macro_export]
2+
macro_rules! info {
3+
($($arg:tt)*) => {
4+
#[cfg(not(feature = "contract"))]
5+
tracing::info!($($arg)*);
6+
#[cfg(feature = "contract")]
7+
::freenet_stdlib::log::info(&format!($($arg)*));
8+
};
9+
}
10+
111
pub fn info(msg: &str) {
212
let ptr = msg.as_ptr() as _;
313
unsafe {

0 commit comments

Comments
 (0)