Jamie Pine 008d05414a Refactor file handling in Explorer component
- Updated file type checks from `file.kind.type` to `file.kind` for consistency across various components in the Explorer views.
- Enhanced the `Thumb` component to conditionally hide the icon based on thumbnail loading status.
- Adjusted the `HeroStats` component for improved readability and structure.
- Added a new `iconScale` prop to the `FileInspector` component's thumbnail for better visual scaling.
2025-11-21 08:01:37 -08:00

56 lines
1.8 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//! Simple example of using the log analyzer library.
use anyhow::Result;
use log_analyzer::LogAnalyzer;
fn main() -> Result<()> {
// Example log content
let log_content = r#"
2025-11-16T07:19:57.232531Z DEBUG ThreadId(02) sd_core::service::sync::peer: Recorded ACK from peer peer=1817e146 hlc=HLC(1763277539319,1,:1817e146)
2025-11-16T07:19:57.232532Z DEBUG ThreadId(02) sd_core::service::sync::peer: Recorded ACK from peer peer=1817e146 hlc=HLC(1763277539319,2,:1817e146)
2025-11-16T07:19:57.232533Z DEBUG ThreadId(02) sd_core::service::sync::peer: Recorded ACK from peer peer=1817e146 hlc=HLC(1763277539320,1,:1817e146)
2025-11-16T07:19:57.232534Z INFO sd_core::service::sync: Sync completed successfully
2025-11-16T07:19:57.232535Z DEBUG ThreadId(03) sd_core::service::sync::protocol_handler: Handling shared change content_identity
2025-11-16T07:19:57.232536Z DEBUG ThreadId(03) sd_core::service::sync::protocol_handler: Handling shared change content_identity
"#;
// Parse and analyze
let analyzer = LogAnalyzer::from_string(log_content)?;
println!("Analysis Results:");
println!(" Total logs: {}", analyzer.log_count());
println!(" Templates: {}", analyzer.template_count());
println!(" Groups: {}", analyzer.group_count());
println!(
" Compression: {:.1}%",
analyzer.compression_ratio() * 100.0
);
println!("\nTemplates:");
for template in analyzer.templates() {
println!(
" #{}: {} ({}×)",
template.id, template.example, template.total_count
);
}
println!("\nGroups:");
for group in analyzer.groups() {
println!(
" Template #{}: {} instances, {}ms duration",
group.template_id, group.count, group.duration_ms
);
}
// Generate markdown report
let report = analyzer.generate_markdown_report()?;
println!("\n--- Markdown Report ---\n{}", report);
Ok(())
}