blob: 98223f01d5a10a93a687bf602123c106fce63b97 (
plain)
1
2
3
4
5
6
7
8
9
|
use tokio::io::{AsyncBufReadExt, AsyncRead, BufReader};
pub async fn forward_logs<T: AsyncRead + Unpin>(prefix: &str, stdio: T, level: log::Level) {
let reader = BufReader::new(stdio);
let mut lines = reader.lines();
while let Ok(Some(line)) = lines.next_line().await {
log::log!(level, "{prefix}{line}");
}
}
|