huskies: merge 927
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
//! Human-readable formatting of raw agent log entries.
|
||||
|
||||
use crate::chat::util::truncate_at_char_boundary;
|
||||
|
||||
/// Format a single log entry as a human-readable text line.
|
||||
///
|
||||
/// `timestamp` is an ISO 8601 string; `event` is the flattened `AgentEvent`
|
||||
@@ -7,6 +9,7 @@
|
||||
///
|
||||
/// Returns `None` for entries that should be skipped (raw streaming noise,
|
||||
/// trivial status changes, empty output, etc.).
|
||||
#[allow(clippy::string_slice)] // timestamp[11..19]: ISO 8601 is ASCII-only, these byte offsets are always valid
|
||||
pub fn format_log_entry_as_text(timestamp: &str, event: &serde_json::Value) -> Option<String> {
|
||||
let agent_name = event
|
||||
.get("agent_name")
|
||||
@@ -75,7 +78,7 @@ pub fn format_log_entry_as_text(timestamp: &str, event: &serde_json::Value) -> O
|
||||
.map(|v| serde_json::to_string(v).unwrap_or_default())
|
||||
.unwrap_or_default();
|
||||
let display = if input.len() > 200 {
|
||||
format!("{}...", &input[..200])
|
||||
format!("{}...", truncate_at_char_boundary(&input, 200))
|
||||
} else {
|
||||
input
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user