pub struct LogEntry {
pub timestamp: DateTime<Utc>,
pub process_id: String,
pub user: Option<String>,
pub database: Option<String>,
pub client_host: Option<String>,
pub application_name: Option<String>,
pub message_type: LogLevel,
pub message: String,
pub queries: Option<Vec<Query>>,
pub duration: Option<f64>,
}Expand description
Represents a single parsed PostgreSQL log entry
Fields§
§timestamp: DateTime<Utc>Timestamp when the log entry was generated
process_id: StringPostgreSQL process ID
user: Option<String>Database user (if available)
database: Option<String>Database name (if available)
client_host: Option<String>Client host address (if available)
application_name: Option<String>Application name (if available)
message_type: LogLevelType/level of the log message
message: StringThe main log message content
queries: Option<Vec<Query>>SQL query (if this is a statement log)
duration: Option<f64>Query duration in milliseconds (if available)
Implementations§
Source§impl LogEntry
impl LogEntry
Sourcepub fn new(
timestamp: DateTime<Utc>,
process_id: String,
message_type: LogLevel,
message: String,
) -> Self
pub fn new( timestamp: DateTime<Utc>, process_id: String, message_type: LogLevel, message: String, ) -> Self
Create a new LogEntry with required fields
Sourcepub fn is_duration(&self) -> bool
pub fn is_duration(&self) -> bool
Check if this log entry represents a duration measurement
Sourcepub fn normalized_query(&self) -> Option<String>
pub fn normalized_query(&self) -> Option<String>
Get the normalized query (for deduplication)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for LogEntry
impl<'de> Deserialize<'de> for LogEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for LogEntry
impl RefUnwindSafe for LogEntry
impl Send for LogEntry
impl Sync for LogEntry
impl Unpin for LogEntry
impl UnsafeUnpin for LogEntry
impl UnwindSafe for LogEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more