# Crate `kerf` Module Structure
```
kerf
└── src (9 mod)
├── config (2 struct: Config, Tab, 1 trait: IntoTracerTab)
├── dispatcher (1 struct: ResultSender, 1 type: TabCallback)
├── env_config (1 fn: parse_level, 2 struct: EnvConfig, TuiConfig, 1 enum: OutputFormat)
├── event (2 struct: Event, EventMessageVisitor, 2 type: ArcEvent, TraceEventId)
├── kerf (2 struct: Kerf, KerfBuilder, 3 type: DroppedEventCallback, EventCallback, SilencedEventCallback)
├── lib
├── matcher (1 fn: matches, 4 struct: Level, Match, MatcherSet, SerializableMatch, 1 enum: PatternMatcher, 1 trait: IntoMatcherSet)
├── stats (10 struct: AtomicCounter, Location, LocationStats, ModuleStats, StatEntry, StatEntrySnapshot, StatKey, StatsConfig, StatsSnapshot, StatsTracker, 1 enum: EventType)
└── tracing_subscriber (1 struct: TracingSubscriber)
```
# Root `kerf` Module
## [`type EventCallback`](src/kerf.rs#L17)
`type EventCallback = ...;`
## [`type SilencedEventCallback`](src/kerf.rs#L18)
`type SilencedEventCallback = ...;`
## [`type DroppedEventCallback`](src/kerf.rs#L19)
`type DroppedEventCallback = ...;`
## [`struct Kerf`](src/kerf.rs#L22)
### [`Kerf::init_default`](src/kerf.rs#L29)
Initialize tracing with default configuration
`fn() -> Result<Self>`
### [`Kerf::init`](src/kerf.rs#L34)
Initialize tracing with the provided config
`fn(config: Config) -> Result<Self>`
### [`Kerf::set_stdout_callback`](src/kerf.rs#L70)
`fn(self: &Self) -> Result<()>`
### [`Kerf::set_tmpfile_callback`](src/kerf.rs#L84)
`fn(self: &Self) -> Result<PathBuf>`
### [`Kerf::set_callback`](src/kerf.rs#L138)
Set a callback for handling captured trace events
`fn(self: &Self, callback: F) -> Result<oneshot::Receiver<Result<()>>>`
### [`Kerf::add_tab`](src/kerf.rs#L154)
Add a new tab
`fn(self: &Self, name: impl Into<String>, matcher_set: MatcherSet) -> Result<oneshot::Receiver<Result<()>>>`
### [`Kerf::set_silenced_callback`](src/kerf.rs#L173)
`fn(self: &Self, callback: F) -> Result<oneshot::Receiver<Result<()>>>`
### [`Kerf::set_dropped_callback`](src/kerf.rs#L191)
`fn(self: &Self, callback: F) -> Result<oneshot::Receiver<Result<()>>>`
### [`Kerf::update_tab`](src/kerf.rs#L210)
Update an existing tab's filter set
`fn(self: &Self, name: impl Into<String>, matcher_set: MatcherSet) -> Result<oneshot::Receiver<Result<()>>>`
### [`Kerf::remove_tab`](src/kerf.rs#L230)
Remove a tab by name
`fn(self: &Self, name: impl Into<String>) -> Result<oneshot::Receiver<Result<()>>>`
### [`Kerf::get_stats`](src/kerf.rs#L242)
Get stats snapshot if stats are enabled
`fn(self: &Self) -> Result<oneshot::Receiver<Option<StatsSnapshot>>>`
### [`Kerf::clear_stats`](src/kerf.rs#L253)
Clear stats if enabled
`fn(self: &Self) -> Result<oneshot::Receiver<Result<()>>>`
### [`Kerf::with_tab_callback`](src/kerf.rs#L265)
Set a callback for a specific tab (builder pattern)
`fn(self: Self, tab_name: impl Into<String>, callback: F) -> KerfBuilder`
### [`Kerf::set_tab_callback`](src/kerf.rs#L329)
Set a callback for a specific tab (direct method)
`async fn(self: &Self, tab_name: impl Into<String>, callback: F) -> Result<()>`
### [`Kerf::remove_tab_callback`](src/kerf.rs#L340)
Remove a callback for a specific tab
`async fn(self: &Self, tab_name: impl Into<String>) -> Result<()>`
## [`struct KerfBuilder`](src/kerf.rs#L275)
Builder for configuring per-tab callbacks
### [`KerfBuilder::with_tab_callback`](src/kerf.rs#L288)
Add a callback for a specific tab
`fn(self: Self, tab_name: impl Into<String>, callback: F) -> Self`
### [`KerfBuilder::build`](src/kerf.rs#L298)
Build and register all callbacks
`async fn(self: Self) -> Result<Kerf>`
## [`type TraceEventId`](src/event.rs#L14)
`type TraceEventId = ...;`
## [`struct Event`](src/event.rs#L17)
### [`Event::new`](src/event.rs#L34)
`fn(id: u64, tracing_event: &tracing::Event<'_>) -> Self`
### [`Event::into_shared`](src/event.rs#L57)
`fn(self: Self) -> Arc<Self>`
### [`Event::ref_count`](src/event.rs#L61)
`fn(self: &Arc<Self>) -> usize`
### [`Event::ptr_eq`](src/event.rs#L65)
`fn(self: &Arc<Self>, other: &Arc<Self>) -> bool`
### [`Event::format`](src/event.rs#L69)
`fn(self: &Self) -> String`
### [`Event::format_with_file`](src/event.rs#L90)
`fn(self: &Self) -> String`
### [`Event::format_with_span_hierarchy`](src/event.rs#L100)
`fn(self: &Self) -> String`
### [`Event::format_with_fields`](src/event.rs#L110)
`fn(self: &Self) -> String`
### [`Event::format_full`](src/event.rs#L128)
`fn(self: &Self) -> String`
### [`Event::format_colored`](src/event.rs#L215)
Format with colors using ANSI escape codes
`fn(self: &Self) -> String`
### [`Event::format_colored_with_file`](src/event.rs#L242)
Format with colors and file info
`fn(self: &Self) -> String`
### [`Event::format_colored_with_span_hierarchy`](src/event.rs#L259)
Format with colors, file info, and span hierarchy
`fn(self: &Self) -> String`
### [`Event::format_colored_with_fields`](src/event.rs#L273)
Format with colors and fields
`fn(self: &Self) -> String`
### [`Event::format_colored_full`](src/event.rs#L298)
Full colored format with all information
`fn(self: &Self) -> String`
### [`Event::format_colored_multiline`](src/event.rs#L348)
Advanced colored format with multiline support
`fn(self: &Self) -> Vec<String>`
## [`type ArcEvent`](src/event.rs#L32)
`type ArcEvent = ...;`
## [`struct EventMessageVisitor`](src/event.rs#L159)
## [`enum PatternMatcher`](src/matcher.rs#L18)
### [`PatternMatcher::new`](src/matcher.rs#L27)
`fn(pattern: &str) -> Self`
### [`PatternMatcher::matches`](src/matcher.rs#L76)
`fn(self: &Self, value: &str) -> bool`
## [`struct Level`](src/matcher.rs#L138)
### [`Level::is_trace`](src/matcher.rs#L160)
`fn(self: &Self) -> bool`
### [`Level::is_error`](src/matcher.rs#L163)
`fn(self: &Self) -> bool`
### [`Level::is_warn`](src/matcher.rs#L166)
`fn(self: &Self) -> bool`
### [`Level::is_info`](src/matcher.rs#L169)
`fn(self: &Self) -> bool`
### [`Level::is_debug`](src/matcher.rs#L172)
`fn(self: &Self) -> bool`
## [`struct Match`](src/matcher.rs#L257)
### [`Match::new`](src/matcher.rs#L384)
`fn(level: impl Into<Level>) -> Self`
### [`Match::trace`](src/matcher.rs#L399)
`fn() -> Self`
### [`Match::debug`](src/matcher.rs#L403)
`fn() -> Self`
### [`Match::info`](src/matcher.rs#L407)
`fn() -> Self`
### [`Match::warn`](src/matcher.rs#L411)
`fn() -> Self`
### [`Match::error`](src/matcher.rs#L415)
`fn() -> Self`
### [`Match::include`](src/matcher.rs#L420)
`fn(self: Self) -> Self`
### [`Match::exclude`](src/matcher.rs#L425)
`fn(self: Self) -> Self`
### [`Match::module_patterns`](src/matcher.rs#L430)
`fn(self: Self, patterns: impl IntoIterator<Item = impl Into<String>>) -> Self`
### [`Match::module_pattern`](src/matcher.rs#L443)
`fn(self: Self, pattern: impl Into<String>) -> Self`
### [`Match::extend_module_patterns`](src/matcher.rs#L450)
`fn(self: Self, patterns: impl IntoIterator<Item = impl Into<String>>) -> Self`
### [`Match::file_patterns`](src/matcher.rs#L462)
`fn(self: Self, patterns: impl IntoIterator<Item = impl Into<String>>) -> Self`
### [`Match::file_pattern`](src/matcher.rs#L472)
`fn(self: Self, pattern: impl Into<String>) -> Self`
### [`Match::extend_file_patterns`](src/matcher.rs#L479)
`fn(self: Self, patterns: impl IntoIterator<Item = impl Into<String>>) -> Self`
### [`Match::span_patterns`](src/matcher.rs#L491)
`fn(self: Self, patterns: impl IntoIterator<Item = impl Into<String>>) -> Self`
### [`Match::span_pattern`](src/matcher.rs#L501)
`fn(self: Self, pattern: impl Into<String>) -> Self`
### [`Match::extend_span_patterns`](src/matcher.rs#L508)
`fn(self: Self, patterns: impl IntoIterator<Item = impl Into<String>>) -> Self`
### [`Match::target_patterns`](src/matcher.rs#L520)
`fn(self: Self, patterns: impl IntoIterator<Item = impl Into<String>>) -> Self`
### [`Match::target_pattern`](src/matcher.rs#L533)
`fn(self: Self, pattern: impl Into<String>) -> Self`
### [`Match::extend_target_patterns`](src/matcher.rs#L540)
`fn(self: Self, patterns: impl IntoIterator<Item = impl Into<String>>) -> Self`
### [`Match::all_modules`](src/matcher.rs#L553)
`fn(self: Self) -> Self`
### [`Match::into_matcher_set`](src/matcher.rs#L560)
`fn(self: Self) -> MatcherSet`
### [`Match::matches`](src/matcher.rs#L564)
`fn(self: &Self, event: &Event) -> bool`
## [`struct SerializableMatch`](src/matcher.rs#L273)
## [`struct MatcherSet`](src/matcher.rs#L678)
### [`MatcherSet::empty`](src/matcher.rs#L722)
`fn() -> Self`
### [`MatcherSet::from_matcher`](src/matcher.rs#L728)
`fn(matcher: Match) -> Self`
### [`MatcherSet::from_matchers`](src/matcher.rs#L734)
`fn(matchers: impl IntoIterator<Item = Match>) -> Self`
### [`MatcherSet::with_matcher`](src/matcher.rs#L742)
`fn(self: Self, filter: Match) -> Self`
### [`MatcherSet::add_matcher`](src/matcher.rs#L747)
`fn(self: &mut Self, filter: Match)`
### [`MatcherSet::remove_matcher`](src/matcher.rs#L751)
`fn(self: &mut Self, filter: &Match) -> bool`
### [`MatcherSet::clear_matchers`](src/matcher.rs#L755)
`fn(self: &mut Self)`
### [`MatcherSet::is_empty`](src/matcher.rs#L759)
`fn(self: &Self) -> bool`
### [`MatcherSet::iter_matchers`](src/matcher.rs#L763)
`fn(self: &Self) -> Vec<&Match>`
## [`fn matches`](src/matcher.rs#L132)
`fn(pattern: &str, value: &str) -> bool`
## [`trait IntoMatcherSet`](src/matcher.rs#L683)
### [`IntoMatcherSet::into_matcher_set`](src/matcher.rs#L683)
`fn(self: Self) -> MatcherSet`
## [`type TabCallback`](src/dispatcher.rs#L11)
`type TabCallback = ...;`
## [`struct ResultSender`](src/dispatcher.rs#L304)
### [`ResultSender::new`](src/dispatcher.rs#L306)
`fn(sender: oneshot::Sender<Result<()>>) -> Self`
### [`ResultSender::success`](src/dispatcher.rs#L310)
`fn(self: Self)`
### [`ResultSender::error`](src/dispatcher.rs#L314)
`fn(self: Self, msg: impl Into<String>)`
## [`struct Config`](src/config.rs#L8)
### [`Config::empty`](src/config.rs#L19)
`fn() -> Self`
### [`Config::default_main`](src/config.rs#L26)
`fn() -> Self`
### [`Config::from_tab`](src/config.rs#L33)
`fn(tab: impl Into<Tab>) -> Self`
### [`Config::from_tabs`](src/config.rs#L41)
`fn(tabs: I) -> Self`
### [`Config::main_tab`](src/config.rs#L56)
Add a single tab to the config and return the modified config
`fn(self: Self, matcher_set: impl IntoMatcherSet) -> Self`
### [`Config::with_tab`](src/config.rs#L61)
Add a single tab to the config and return the modified config
`fn(self: Self, name: impl Into<String>, matcher_set: impl IntoMatcherSet) -> Self`
### [`Config::with_tabs`](src/config.rs#L68)
Add multiple tabs to the config and return the modified config
`fn(self: Self, tabs: impl IntoIterator<Item = (impl Into<String>, impl IntoMatcherSet)>) -> Self`
### [`Config::with_stats`](src/config.rs#L80)
Enable stats tracking
`fn(self: Self, config: StatsConfig) -> Self`
### [`Config::add_tab`](src/config.rs#L86)
Add a single tab to the config in-place
`fn(self: &mut Self, name: impl Into<String>, matcher_set: impl IntoMatcherSet)`
### [`Config::add_tabs`](src/config.rs#L92)
Add multiple tabs to the config in-place
`fn(self: &mut Self, tabs: impl IntoIterator<Item = (impl Into<String>, impl IntoMatcherSet)>)`
## [`struct Tab`](src/config.rs#L106)
### [`Tab::new`](src/config.rs#L171)
`fn(name: String) -> Self`
### [`Tab::with_matcher_set`](src/config.rs#L178)
`fn(self: Self, matcher_set: MatcherSet) -> Self`
### [`Tab::add_matcher`](src/config.rs#L183)
`fn(self: Self, matcher: Match) -> Self`
### [`Tab::from_name_and_matchers`](src/config.rs#L191)
`fn(name: S, matchers: M) -> Self`
## [`trait IntoTracerTab`](src/config.rs#L121)
### [`IntoTracerTab::into_tracer_tab`](src/config.rs#L121)
`fn(self: Self) -> Tab`
## [`struct TracingSubscriber`](src/tracing_subscriber.rs#L38)
### [`TracingSubscriber::new`](src/tracing_subscriber.rs#L44)
`fn(sender: mpsc::UnboundedSender<ArcEvent>, id_counter: Arc<AtomicU64>) -> Self`
## [`struct StatsSnapshot`](src/stats.rs#L12)
COMPLETE snapshot of ALL stats data - no fucking abbreviations
## [`struct StatEntrySnapshot`](src/stats.rs#L34)
Complete snapshot of a stat entry with all data
## [`struct StatsConfig`](src/stats.rs#L42)
Stats configuration
## [`struct Location`](src/stats.rs#L64)
Location identifier (file:line)
### [`Location::from_trace_data`](src/stats.rs#L69)
`fn(data: &Event) -> Option<Self>`
## [`enum EventType`](src/stats.rs#L90)
Event type for stats
## [`struct AtomicCounter`](src/stats.rs#L108)
Thread-safe atomic counter
### [`AtomicCounter::new`](src/stats.rs#L112)
`fn() -> Self`
### [`AtomicCounter::increment`](src/stats.rs#L118)
`fn(self: &Self) -> u64`
### [`AtomicCounter::get`](src/stats.rs#L122)
`fn(self: &Self) -> u64`
### [`AtomicCounter::reset`](src/stats.rs#L126)
`fn(self: &Self)`
## [`struct StatEntry`](src/stats.rs#L140)
Stats for a specific combination of location/module/level/event_type
### [`StatEntry::new`](src/stats.rs#L145)
`fn() -> Self`
### [`StatEntry::record_event`](src/stats.rs#L157)
`fn(self: &Self)`
### [`StatEntry::get_count`](src/stats.rs#L168)
`fn(self: &Self) -> u64`
### [`StatEntry::get_last_seen`](src/stats.rs#L172)
`fn(self: &Self) -> SystemTime`
## [`struct StatKey`](src/stats.rs#L187)
Composite key for stats tracking
## [`struct StatsTracker`](src/stats.rs#L196)
High-performance stats tracker
### [`StatsTracker::new`](src/stats.rs#L204)
`fn(config: StatsConfig) -> Self`
### [`StatsTracker::record_event`](src/stats.rs#L228)
`fn(self: &Self, event_type: EventType, trace_data: &Event)`
### [`StatsTracker::get_total_count`](src/stats.rs#L294)
`fn(self: &Self, event_type: EventType, level: Level) -> u64`
### [`StatsTracker::get_total_count_by_type`](src/stats.rs#L301)
`fn(self: &Self, event_type: EventType) -> u64`
### [`StatsTracker::get_snapshot`](src/stats.rs#L310)
Get COMPLETE snapshot with ALL fucking data
`fn(self: &Self) -> StatsSnapshot`
### [`StatsTracker::clear`](src/stats.rs#L377)
`fn(self: &Self)`
## [`struct LocationStats`](src/stats.rs#L393)
Complete stats for a specific location with ALL data
### [`LocationStats::get_total_for_type`](src/stats.rs#L423)
`fn(self: &Self, event_type: EventType) -> u64`
### [`LocationStats::get_total_events`](src/stats.rs#L431)
`fn(self: &Self) -> u64`
## [`struct ModuleStats`](src/stats.rs#L439)
Complete stats for a specific module with ALL data
### [`ModuleStats::get_total_for_type`](src/stats.rs#L469)
`fn(self: &Self, event_type: EventType) -> u64`
### [`ModuleStats::get_total_events`](src/stats.rs#L477)
`fn(self: &Self) -> u64`
## [`enum OutputFormat`](src/env_config.rs#L10)
Output format options for trace events
## [`struct EnvConfig`](src/env_config.rs#L42)
Configuration parsed from environment variables
### [`EnvConfig::from_env`](src/env_config.rs#L83)
Parse configuration from environment variables
`fn() -> Result<Self>`
### [`EnvConfig::has_env_config`](src/env_config.rs#L127)
Check if any environment variables are set
`fn() -> bool`
## [`struct TuiConfig`](src/env_config.rs#L61)
TUI-specific debugging configuration
## [`fn parse_level`](src/env_config.rs#L257)
Convert string level to tracing::Level
`fn(level: &str) -> anyhow::Result<tracing::Level>`