Format entries for JSON output. # Arguments `entries` - History entries to format # Returns Formatted JSON string.
(&self, entries: &[HistoryEntry])
| 413 | /// |
| 414 | /// Formatted JSON string. |
| 415 | pub(crate) fn format_json(&self, entries: &[HistoryEntry]) -> String { |
| 416 | let json_entries: Vec<JsonLogEntry> = |
| 417 | entries.iter().map(JsonLogEntry::from_entry).collect(); |
| 418 | |
| 419 | serde_json::to_string_pretty(&json_entries) |
| 420 | .unwrap_or_else(|e| format!("{{\"error\": \"Failed to serialize: {}\"}}", e)) |
| 421 | } |
| 422 | |
| 423 | /// Print entries in the configured format. |
| 424 | /// |