freenet_stdlib/
log.rs

1#[macro_export]
2macro_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
11pub fn info(msg: &str) {
12    let ptr = msg.as_ptr() as _;
13    unsafe {
14        __frnt__logger__info(crate::global::INSTANCE_ID, ptr, msg.len() as _);
15    }
16}
17
18#[cfg(target_family = "wasm")]
19#[link(wasm_import_module = "freenet_log")]
20extern "C" {
21    #[doc(hidden)]
22    fn __frnt__logger__info(id: i64, ptr: i64, len: i32);
23}
24
25#[cfg(not(target_family = "wasm"))]
26#[allow(non_snake_case)]
27unsafe fn __frnt__logger__info(_id: i64, _ptr: i64, _len: i32) {
28    // Stub implementation for non-WASM targets (e.g., Windows native compilation)
29    // These contracts are meant to run only in WASM runtime
30}