bneradt commented on code in PR #13645:
URL: https://github.com/apache/trafficserver/pull/13645#discussion_r3991452362
##########
src/proxy/logging/Log.cc:
##########
@@ -322,393 +337,247 @@ Log::init_fields()
return;
}
- LogField *field;
-
//
// Initializes material to find a milestone name from their
// name in a rapid manner.
LogField::init_milestone_container();
// client -> proxy fields
- field =
- new LogField("client_host_ip", "chi", LogField::Type::IP,
&LogAccess::marshal_client_host_ip, &LogAccess::unmarshal_ip_to_str);
- global_field_list.add(field, false);
- field_symbol_hash.emplace("chi", field);
-
- field = new LogField("client_host_port", "chp", LogField::Type::sINT,
&LogAccess::marshal_client_host_port,
- &LogAccess::unmarshal_int_to_str);
- global_field_list.add(field, false);
- field_symbol_hash.emplace("chp", field);
-
- field = new LogField("client_host_ip_hex", "chih", LogField::Type::IP,
&LogAccess::marshal_client_host_ip,
- &LogAccess::unmarshal_ip_to_hex);
- global_field_list.add(field, false);
- field_symbol_hash.emplace("chih", field);
-
- field = new LogField("client_host_ip_verified", "chiv", LogField::Type::IP,
&LogAccess::marshal_client_host_ip_verified,
- &LogAccess::unmarshal_ip_to_str);
- global_field_list.add(field, false);
- field_symbol_hash.emplace("chiv", field);
+ register_field(
+ new LogField("client_host_ip", "chi", LogField::Type::IP,
&LogAccess::marshal_client_host_ip, &LogAccess::unmarshal_ip_to_str));
+
+ register_field(new LogField("client_host_port", "chp", LogField::Type::sINT,
&LogAccess::marshal_client_host_port,
Review Comment:
Adding this helper function is a lot nicer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]