Expand description
MTG Arena log file parser.
This library crate reads Arena’s Player.log, parses raw log entries
into typed game events, and distributes them via an async broadcast
channel. It is designed to run on the caller’s Tokio runtime — it does
not initialize its own runtime or logger.
§Quick start (async, desktop)
Requires the tailer feature (enabled by default):
ⓘ
use std::path::Path;
use manasight_parser::MtgaEventStream;
let (stream, mut subscriber) = MtgaEventStream::start(Path::new("Player.log")).await?;
while let Some(event) = subscriber.recv().await {
println!("got event: {event:?}");
}§Quick start (sync, WASM)
With --no-default-features --features brace_depth_flush (no tailer),
only the pure-sync subset of the crate is available:
use manasight_parser::parse_whole_log;
let input = ""; // replace with actual Player.log content
let events = parse_whole_log(input);
println!("parsed {} events", events.len());§Architecture
Player.log → File Tailer → Entry Buffer → Router → Parsers → Event Buslogmodule: file discovery, polling tailer, entry accumulation, timestampsrouter: dispatches raw entries to the correct category parserparsers: one sub-module per event categoryevents: public event type enums/structs (the parser’s output contract)event_bus:tokio::broadcastchannel for fan-out to subscribers (requirestailerfeature)stream: public entry point (MtgaEventStream) (requirestailerfeature)
Re-exports§
pub use event_bus::Subscriber;pub use events::ClientActionEvent;pub use events::DeckCollectionEvent;pub use events::DeckSubmissionEvent;pub use events::DetailedLoggingStatusEvent;pub use events::DraftBotEvent;pub use events::DraftCompleteEvent;pub use events::DraftHumanEvent;pub use events::EventLifecycleEvent;pub use events::EventMetadata;pub use events::GameEvent;pub use events::GameResultEvent;pub use events::GameStateEvent;pub use events::InventoryEvent;pub use events::LogFileRotatedEvent;pub use events::MatchStateEvent;pub use events::PerformanceClass;pub use events::RankEvent;pub use events::SessionEvent;pub use events::TruncationEvent;pub use sanitize::scrub_raw_log;pub use sanitize::scrub_raw_log_with;pub use sanitize::ScrubOptions;pub use stream::MtgaEventStream;pub use stream::StreamError;pub use util::compress_log;pub use util::content_hash;
Modules§
- event_
bus - Async broadcast channel for distributing parsed events to subscribers.
- events
- Public event type enums and structs for parsed MTG Arena log events.
- log
- Raw log file reading: discovery, tailing, entry parsing, and timestamps.
- parsers
- Category-specific parsers — one module per event category.
- router
- Raw log entry to parser dispatch routing.
- sanitize
- Privacy scrubber for raw MTGA log text.
- stream
- Public entry point for streaming typed events from an MTG Arena log file.
- util
- Shared utility functions for the parser crate.
Functions§
- parse_
whole_ log - Parses an entire MTG Arena
Player.logstring into aVecofGameEvents.