Struct anylog::LogEntry

source ·
pub struct LogEntry<'a> { /* private fields */ }
Expand description

Represents a parsed log entry.

Implementations§

source§

impl<'a> LogEntry<'a>

source

pub fn parse(bytes: &[u8]) -> LogEntry<'_>

Parses a well known log line into a log entry.

source

pub fn parse_with_local_timezone( bytes: &[u8], offset: Option<FixedOffset> ) -> LogEntry<'_>

Similar to parse but uses the given timezone for local time.

source

pub fn from_utc_time(ts: DateTime<Utc>, message: &'a [u8]) -> LogEntry<'a>

Constructs a log entry from a UTC timestamp and message.

source

pub fn from_local_time(ts: DateTime<Local>, message: &'a [u8]) -> LogEntry<'a>

Constructs a log entry from a local timestamp and message.

source

pub fn from_fixed_time( ts: DateTime<FixedOffset>, message: &'a [u8] ) -> LogEntry<'a>

Constructs a log entry from a timestamp in a specific timezone and message.

source

pub fn from_message_only(message: &'a [u8]) -> LogEntry<'a>

Creates a log entry from only a message.

source

pub fn local_timestamp(&self) -> Option<DateTime<Local>>

Returns the timestamp in local timezone.

source

pub fn utc_timestamp(&self) -> Option<DateTime<Utc>>

Returns the timestamp in UTC timezone.

source

pub fn message(&'a self) -> &str

Returns the message.

source

pub fn component_and_message(&'a self) -> (Option<&str>, &str)

Like message but chops off a leading component.

Trait Implementations§

source§

impl<'a> Debug for LogEntry<'a>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for LogEntry<'a>

§

impl<'a> Send for LogEntry<'a>

§

impl<'a> Sync for LogEntry<'a>

§

impl<'a> Unpin for LogEntry<'a>

§

impl<'a> UnwindSafe for LogEntry<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.