Format entries for JSON output. # Arguments `entries` - History entries to format # Returns Formatted JSON string.
(&self, entries: &[HistoryEntry])
| 392 | /// |
| 393 | /// Formatted JSON string. |
| 394 | pub(crate) fn format_json(&self, entries: &[HistoryEntry]) -> String { |
| 395 | let json_entries: Vec<JsonLogEntry> = |
| 396 | entries.iter().map(JsonLogEntry::from_entry).collect(); |
| 397 | |
| 398 | serde_json::to_string_pretty(&json_entries) |
| 399 | .unwrap_or_else(|e| format!("{{\"error\": \"Failed to serialize: {}\"}}", e)) |
| 400 | } |
| 401 | |
| 402 | /// Print entries in the configured format. |
| 403 | /// |