Merge pull request #7742 from frezcirno/fix-log-forwarder-loop

runtime-rs: check peer close in log_forwarder
This commit is contained in:
Zhongtao Hu 2023-08-26 10:44:09 +08:00 committed by GitHub
commit f0440a9cfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,16 +64,14 @@ impl LogForwarder {
Ok(stream) => {
let stream = BufReader::new(stream);
let mut lines = stream.lines();
while let Ok(line) = lines.next_line().await {
if let Some(l) = line {
match parse_agent_log_level(&l) {
LOG_LEVEL_TRACE => trace!(sl!(), "{}", l),
LOG_LEVEL_DEBUG => debug!(sl!(), "{}", l),
LOG_LEVEL_WARNING => warn!(sl!(), "{}", l),
LOG_LEVEL_ERROR => error!(sl!(), "{}", l),
LOG_LEVEL_CRITICAL => crit!(sl!(), "{}", l),
_ => info!(sl!(), "{}", l),
}
while let Ok(Some(l)) = lines.next_line().await {
match parse_agent_log_level(&l) {
LOG_LEVEL_TRACE => trace!(sl!(), "{}", l),
LOG_LEVEL_DEBUG => debug!(sl!(), "{}", l),
LOG_LEVEL_WARNING => warn!(sl!(), "{}", l),
LOG_LEVEL_ERROR => error!(sl!(), "{}", l),
LOG_LEVEL_CRITICAL => crit!(sl!(), "{}", l),
_ => info!(sl!(), "{}", l),
}
}
}