Skip to content

Commit

Permalink
Add formatter to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
YushiOMOTE committed Jul 13, 2024
1 parent b7a07d5 commit e949ed2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ fn main() {
com_logger::builder()
.base(0x2f8) // Use COM2 port
.filter(LevelFilter::Debug) // Print debug log
.formatter(|buf, record| writeln!(buf, "{}", record.args())) // Define own format
.setup();
debug!("Hello");
Expand Down
1 change: 1 addition & 0 deletions src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ impl Builder {
/// com_logger::builder()
/// .base(0x2f8) // Use COM2 port
/// .filter(LevelFilter::Debug) // Print debug log
/// .formatter(|buf, record| writeln!(buf, "{}", record.args())) // Define own format
/// .setup();
///
/// debug!("Hello");
Expand Down
3 changes: 2 additions & 1 deletion src/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use uart_16550::SerialPort;
///
/// ```rust,no_run
/// use com_logger::Serial;
/// use core::fmt::Write;
///
/// fn main() {
/// // Setup COM1 serial port.
Expand All @@ -15,7 +16,7 @@ use uart_16550::SerialPort;
/// s.write(b'P');
///
/// // Write the string to the serial port.
/// core::fmt::write(&mut s, format_args!("Hello {}", 0xdead));
/// writeln!(&mut s, "Hello {}", 0xdead);
/// }
/// ```
pub struct Serial(SerialPort);
Expand Down

0 comments on commit e949ed2

Please sign in to comment.