diff --git a/api/log-server/Cargo.toml b/api/log-server/Cargo.toml index 11218f7c8..a877a8b46 100644 --- a/api/log-server/Cargo.toml +++ b/api/log-server/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Sean Cross "] description = "Log server API" edition = "2018" name = "xous-api-log" -version = "0.1.2" +version = "0.1.3" license = "MIT OR Apache-2.0" repository = "https://github.com/betrusted-io/xous-core/" homepage = "https://betrusted.io/xous-book/" diff --git a/api/log-server/README.md b/api/log-server/README.md new file mode 100644 index 000000000..3c99683f8 --- /dev/null +++ b/api/log-server/README.md @@ -0,0 +1,23 @@ +# Xous API: Log + +API calls to access the Xous logging service. Provides glue between the `log` crate, the Xous kernel and the hardware. + +Every process that relies on the logging service should call `xous_api_log::init_wait()` before using any `log` calls. + +Below is a minimal example of how to use the logging service. + +```rust +fn main() -> ! { + xous_api_log::init_wait().unwrap(); + log::set_max_level(log::LevelFilter::Info); + log::info!("my PID is {}", xous::process::id()); + + let timeout = std::time::Duration::from_millis(1000); + let mut count = 0; + loop { + log::info!("test loop {}", count); + count += 1; + std::thread::sleep(timeout); + } +} +```