bitcoind_log_parser/log_line/
mod.rs1mod log_header;
2mod log_message;
3
4pub use log_header::LogHeader;
5pub use log_message::LogMessage;
6
7use crate::ParseError;
8
9#[derive(Debug)]
10pub struct LogLine {
11 pub header: LogHeader,
12 pub message: LogMessage,
13}
14
15impl LogLine {
16 pub fn parse(log_line_string: &str) -> Result<LogLine, ParseError> {
18 let log_header_result = LogHeader::parse(log_line_string);
19
20 match log_header_result {
21 Ok((log_header, raw_log_message)) => {
22 let log_message_result = LogMessage::parse(raw_log_message);
23 match log_message_result {
24 Ok(log_message) => Ok(LogLine {
25 header: log_header,
26 message: log_message,
27 }),
28 Err(_) => Err(ParseError),
29 }
30 }
31 Err(_) => Err(ParseError),
32 }
33 }
34}