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