Skip to main content

LogEntry

Struct LogEntry 

Source
pub struct LogEntry {
    pub timestamp: Option<String>,
    pub level: Option<String>,
    pub message: Option<String>,
    pub tag: Option<String>,
    pub fields: Map<String, Value>,
    pub raw: String,
}
Expand description

A single structured log entry.

All four known fields are Option<String> because a JSON line may omit any of them and still be worth indexing — the parser’s contract per the milestone 1 spec is “missing optional fields use None not panic”.

fields holds only keys that are not among the known four. The parser is responsible for lifting known keys out of the JSON object and into their dedicated fields before populating this map.

Fields§

§timestamp: Option<String>

The entry’s timestamp as it appeared in the source line. Stored as a string rather than a parsed DateTime so unusual formats survive ingestion; time-range filtering is applied at query time.

§level: Option<String>

Log severity (“error”, “warn”, “info”, …). Indexed column.

§message: Option<String>

The human-readable message body.

§tag: Option<String>

Optional source tag supplied at ingestion time (the --tag CLI flag, per the “Decisions log” entry on optional tags). None means “untagged” and such entries match queries without a tag filter.

§fields: Map<String, Value>

Arbitrary additional keys from the JSON object. Serialized to the fields TEXT column and queried via SQLite’s json_extract().

§raw: String

The original, unmodified source line. Feeds both the raw column and the blake3-based dedup hash.

Implementations§

Source§

impl LogEntry

Source

pub const KNOWN_KEYS: &'static [&'static str]

The set of top-level JSON keys that are promoted to first-class struct fields during parsing. Any key not in this set is preserved in LogEntry::fields.

Kept in a single place so the parser and any future schema-related code agree on which keys are “known”.

Source

pub fn new(raw: impl Into<String>) -> Self

Construct a new entry from the raw source line, with all optional fields unset and an empty fields map. The parser uses this as a starting point and fills in the pieces it finds.

Source

pub fn with_tag(self, tag: Option<String>) -> Self

Override the tag. Used by the indexer to apply the --tag flag supplied at ingestion time: if the source JSON did not carry its own tag, the CLI-provided one is substituted here.

Trait Implementations§

Source§

impl Clone for LogEntry

Source§

fn clone(&self) -> LogEntry

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LogEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for LogEntry

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for LogEntry

Source§

fn eq(&self, other: &LogEntry) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for LogEntry

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for LogEntry

Source§

impl StructuralPartialEq for LogEntry

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,