@@ -842,12 +842,8 @@ logfile::process_prefix(shared_buffer_ref& sbr,
842842 .get_time <std::chrono::microseconds>();
843843 }
844844 if (this ->lf_format != nullptr ) {
845- best_match = std::make_pair (this ->lf_format .get (),
846- log_format::scan_match{
847- this ->lf_format_quality ,
848- 0 ,
849- this ->lf_format_precision ,
850- });
845+ best_match
846+ = std::make_pair (this ->lf_format .get (), this ->lf_format_match );
851847 }
852848
853849 /*
@@ -961,23 +957,11 @@ logfile::process_prefix(shared_buffer_ref& sbr,
961957 sm.sm_quality ,
962958 sm.sm_precision ,
963959 sm.sm_strikes );
964- if (sm.sm_quality > this ->lf_format_quality ) {
965- this ->lf_format_quality = sm.sm_quality ;
966- }
967- if (sm.sm_precision > this ->lf_format_precision ) {
968- this ->lf_format_precision = sm.sm_precision ;
969- }
960+ this ->lf_format_match .merge_best (sm);
970961 prev_index_size = this ->lf_index .size ();
971962 found = best_match->second ;
972963 } else if (!best_match
973- || (sm.sm_quality > best_match->second .sm_quality
974- || (sm.sm_quality
975- == best_match->second .sm_quality
976- && (sm.sm_precision
977- > best_match->second .sm_precision
978- || sm.sm_strikes
979- < best_match->second
980- .sm_strikes ))))
964+ || sm.is_better_than (best_match->second ))
981965 {
982966 log_info (
983967 " scan with format (%s) matched with quality of "
@@ -1093,9 +1077,8 @@ logfile::process_prefix(shared_buffer_ref& sbr,
10931077 && (this ->lf_format == nullptr
10941078 || ((this ->lf_format ->lf_root_format
10951079 != best_match->first ->lf_root_format )
1096- && (best_match->second .sm_quality > this ->lf_format_quality
1097- || best_match->second .sm_precision
1098- > this ->lf_format_precision ))))
1080+ && best_match->second .is_better_than (
1081+ this ->lf_format_match ))))
10991082 {
11001083 auto winner = best_match.value ();
11011084 auto * curr = winner.first ;
@@ -1122,8 +1105,7 @@ logfile::process_prefix(shared_buffer_ref& sbr,
11221105 }
11231106 this ->lf_level_stats .update_msg_count (ll.get_msg_level ());
11241107 }
1125- this ->lf_format_quality = winner.second .sm_quality ;
1126- this ->lf_format_precision = winner.second .sm_precision ;
1108+ this ->lf_format_match = winner.second ;
11271109 this ->set_format_base_time (this ->lf_format .get (), li);
11281110 if (this ->lf_format ->lf_date_time .dts_fmt_lock != -1 ) {
11291111 this ->lf_content_id
0 commit comments