Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
fix: use CString instead of rust stings
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin-Niederman committed Dec 8, 2023
1 parent 01dc7f9 commit 3cdcc3a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pros/src/logger.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::time::Duration;

use alloc::{format, string::ToString};
use alloc::{format, string::ToString, ffi::CString};

use log::{Log, Metadata, Record};

Expand Down Expand Up @@ -41,9 +41,10 @@ impl Log for ProsLogger {
let message = format!("{}{} [{}] {}", now, level_string, target, record.args());

println!("{}", message);
// Print to the debug
// Print to the debug teminal
let c_output = CString::new(message).unwrap();
unsafe {
pros_sys::puts(message.as_ptr() as _);
pros_sys::puts(c_output.as_ptr() as _);
}
}

Expand Down

0 comments on commit 3cdcc3a

Please sign in to comment.