Function eve_log_parser::parse_log_line
source · pub fn parse_log_line(text: &String) -> Option<Log>Expand description
Read any log line from eve and creates an appropriate log if possible
§Example:
use chrono::{TimeZone, Utc};
use eve_log_parser::models::{Log, DamageLog, Destination};
use eve_log_parser::parse_log_line;
let log: String = "[ 2024.07.02 20:31:28 ] (combat) <color=0xff00ffff><b>200</b> <color=0x77ffffff><font size=10>to</font> <b><color=0xffffffff>Hornet EC-300[-15.0](Hornet EC-300)</b><font size=10><color=0x77ffffff> - Draclira's Modified Tachyon Beam Laser - Penetrates\n".to_string();
let expected_output = Log::Damage(DamageLog::new(
Utc.with_ymd_and_hms(2024, 7, 2, 20, 31, 28).unwrap(),
200,
"Hornet EC-300".to_string(),
"Hornet EC-300".to_string(),
"Draclira's Modified Tachyon Beam Laser".to_string(),
Destination::Dealing,
));
let output = parse_log_line(&log).unwrap();
assert_eq!(expected_output, output);