mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
add a README to the log api
This commit is contained in:
parent
523361e138
commit
c37200c4dc
2 changed files with 24 additions and 1 deletions
|
|
@ -3,7 +3,7 @@ authors = ["Sean Cross <sean@xobs.io>"]
|
||||||
description = "Log server API"
|
description = "Log server API"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
name = "xous-api-log"
|
name = "xous-api-log"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
repository = "https://github.com/betrusted-io/xous-core/"
|
repository = "https://github.com/betrusted-io/xous-core/"
|
||||||
homepage = "https://betrusted.io/xous-book/"
|
homepage = "https://betrusted.io/xous-book/"
|
||||||
|
|
|
||||||
23
api/log-server/README.md
Normal file
23
api/log-server/README.md
Normal file
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
Loading…
Reference in a new issue