mazzaroth_rs/external/
log.rs

1#[cfg(not(feature = "host-mock"))]
2use super::externs::_log;
3
4/// Write a message to the host defined log location.
5#[cfg(not(feature = "host-mock"))]
6pub fn log(msg: String) {
7    let val = msg.into_bytes();
8    unsafe { _log(val.as_ptr(), val.len()) }
9}
10
11#[cfg(feature = "host-mock")]
12pub fn log(msg: String) {
13    println!("log {}", msg);
14}
15
16#[cfg(test)]
17#[cfg(feature = "host-mock")]
18mod tests {
19    use super::*;
20
21    #[test]
22    fn test_log() {
23        log("asdf".to_string());
24    }
25}