|
@@ -16,7 +16,7 @@ macro_rules! log {
|
|
|
($pool:expr, $( $arg:expr ),*) => {
|
|
|
log!($pool;(), $( $arg ),*);
|
|
|
};
|
|
|
- ($bk:expr;$cur:expr, $( $arg:expr ),*) => {{
|
|
|
+ ($bk:expr;$cur:expr, $( $arg:expr ),*) => {
|
|
|
#[cfg(feature = "log")]
|
|
|
{
|
|
|
use core::fmt::Write;
|
|
@@ -24,6 +24,9 @@ macro_rules! log {
|
|
|
use {write, log};
|
|
|
use log::internal::IntoCursor;
|
|
|
|
|
|
+ // To avoid cluttering the lines, we acquire a lock.
|
|
|
+ let _lock = log::internal::LINE_LOCK.lock();
|
|
|
+
|
|
|
// Print the pool state.
|
|
|
let mut stderr = write::Writer::stderr();
|
|
|
let _ = write!(stderr, "({:2}) {:10?} : ", $bk.id, log::internal::BlockLogger {
|
|
@@ -35,7 +38,7 @@ macro_rules! log {
|
|
|
let _ = write!(stderr, $( $arg ),*);
|
|
|
let _ = writeln!(stderr, " (at {}:{})", file!(), line!());
|
|
|
}
|
|
|
- }};
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
/// Top secret place-holding module.
|
|
@@ -49,6 +52,11 @@ pub mod internal {
|
|
|
use core::cell::Cell;
|
|
|
use core::ops::Range;
|
|
|
|
|
|
+ /// The line lock.
|
|
|
+ ///
|
|
|
+ /// This lock is used to avoid bungling and intertwining lines.
|
|
|
+ pub static LINE_LOCK: Mutex<()> = Mutex::new(());
|
|
|
+
|
|
|
/// A "cursor".
|
|
|
///
|
|
|
/// Cursors represents a block or an interval in the log output. This trait is implemented for
|