logdive_core/lib.rs
1//! # logdive-core
2//!
3//! Core library for `logdive` — structured log parsing, SQLite-backed
4//! indexing, and a hand-written query engine.
5//!
6//! This crate is pure library code with no I/O side effects at the module
7//! level. It is consumed by the `logdive` CLI binary and the `logdive-api`
8//! HTTP server binary.
9//!
10//! v0.2.0 introduced multi-format ingestion: JSON, logfmt, and plain text.
11//! See [`parsers`] for the format-specific parsers and the format-aware
12//! [`parse_line`] dispatcher.
13//!
14//! v0.2.0 also introduces [`follow`] (Unix-only), which provides
15//! [`FileTailer`] for tracking a growing file and detecting log rotation
16//! and truncation. Used by the CLI's `--follow` flag.
17
18pub mod entry;
19pub mod error;
20pub mod executor;
21pub mod indexer;
22pub mod parsers;
23pub mod query;
24
25#[cfg(unix)]
26pub mod follow;
27
28pub use entry::LogEntry;
29pub use error::{LogdiveError, Result};
30pub use executor::{execute, execute_at};
31pub use indexer::{BATCH_SIZE, Indexer, InsertStats, Stats, db_path};
32pub use parsers::{LogFormat, parse_line};
33pub use query::{
34 AndGroup, Clause, CompareOp, Duration, DurationUnit, QueryNode, QueryParseError, QueryValue,
35 parse as parse_query,
36};
37
38#[cfg(unix)]
39pub use follow::FileTailer;