mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
rkyv-test-client: dynamically generate log message string
By dynamically generating the log message string, we ensure dynamic buffer adjustments are accepted. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
e27db818ef
commit
22b50d080b
1 changed files with 8 additions and 1 deletions
|
|
@ -1,6 +1,8 @@
|
|||
#![cfg_attr(target_os = "none", no_std)]
|
||||
#![cfg_attr(target_os = "none", no_main)]
|
||||
|
||||
use core::fmt::Write;
|
||||
|
||||
fn print_log_messages(log_message: &str, prefix: &str) {
|
||||
log::info!(
|
||||
"Got a message hook! Message: [{}], prefix: [{}]",
|
||||
|
|
@ -23,10 +25,15 @@ fn rkyv_test_client() -> ! {
|
|||
|
||||
let mut idx = 0;
|
||||
let double_src = xous::String::<256>::from_str("12345678");
|
||||
|
||||
let mut message_string = xous::String::<64>::new();
|
||||
loop {
|
||||
log::info!("2 + {} = {}", idx, rkyv_test_server::add(2, idx).unwrap());
|
||||
ticktimer_server::sleep_ms(ticktimer_conn, 500).ok();
|
||||
rkyv_test_server::log_message("prefix", "Hi there");
|
||||
|
||||
message_string.clear();
|
||||
write!(message_string, "I'm at loop # {:^4}", idx);
|
||||
rkyv_test_server::log_message("prefix", message_string);
|
||||
log::info!("Doubling string {}", double_src);
|
||||
log::info!("Doubled string: {}", rkyv_test_server::double_string(&double_src));
|
||||
idx += 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue