Struct BaseLogEntry

Source
pub struct BaseLogEntry {
Show 16 fields pub queue_id: Option<String>, pub message_id: Option<String>, pub from_email: Option<EmailAddress>, pub to_email: Option<EmailAddress>, pub orig_to_email: Option<EmailAddress>, pub client_info: Option<ClientInfo>, pub relay_info: Option<RelayInfo>, pub delay_info: Option<DelayInfo>, pub status_info: Option<StatusInfo>, pub size: Option<u64>, pub nrcpt: Option<u32>, pub protocol: Option<String>, pub helo: Option<String>, pub sasl_method: Option<String>, pub sasl_username: Option<String>, pub raw_message: String,
}
Expand description

Postfix日志基础结构体 包含所有组件通用的字段,避免重复解析

Fields§

§queue_id: Option<String>

队列ID(如果有)

§message_id: Option<String>

Message-ID(如果有)

§from_email: Option<EmailAddress>

发件人地址

§to_email: Option<EmailAddress>

收件人地址

§orig_to_email: Option<EmailAddress>

原始收件人地址(alias/forward前)

§client_info: Option<ClientInfo>

客户端连接信息

§relay_info: Option<RelayInfo>

中继主机信息

§delay_info: Option<DelayInfo>

延迟信息

§status_info: Option<StatusInfo>

状态信息

§size: Option<u64>

邮件大小(字节)

§nrcpt: Option<u32>

收件人数量

§protocol: Option<String>

协议类型(SMTP/ESMTP)

§helo: Option<String>

HELO/EHLO信息

§sasl_method: Option<String>

SASL认证方法

§sasl_username: Option<String>

SASL用户名

§raw_message: String

原始日志消息(去除时间戳和组件名)

Implementations§

Source§

impl BaseLogEntry

Source

pub fn from_message(raw_message: &str, queue_id: Option<String>) -> Self

从原始日志消息创建基础日志条目

§参数
  • raw_message - 原始日志消息(去除时间戳和组件名)
  • queue_id - 预先提取的队列ID(如果有)
§返回

填充了公共字段的基础日志条目

Source

pub fn empty(raw_message: &str) -> Self

创建空白的基础日志条目

Source

pub fn has_delivery_info(&self) -> bool

检查是否包含邮件传输相关的字段

Source

pub fn has_client_info(&self) -> bool

检查是否包含客户端连接信息

Source

pub fn has_auth_info(&self) -> bool

检查是否包含认证信息

Source

pub fn formatted_from(&self) -> String

获取格式化的发件人地址字符串

Source

pub fn formatted_to(&self) -> String

获取格式化的收件人地址字符串

Source

pub fn formatted_client(&self) -> String

获取格式化的客户端信息字符串

Source

pub fn formatted_relay(&self) -> String

获取格式化的中继信息字符串

Source

pub fn formatted_status(&self) -> String

获取格式化的状态信息字符串

Trait Implementations§

Source§

impl Clone for BaseLogEntry

Source§

fn clone(&self) -> BaseLogEntry

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 BaseLogEntry

Source§

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

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

impl<'de> Deserialize<'de> for BaseLogEntry

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 BaseLogEntry

Source§

fn eq(&self, other: &BaseLogEntry) -> 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 BaseLogEntry

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 StructuralPartialEq for BaseLogEntry

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<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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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>,