bneradt commented on code in PR #13645:
URL: https://github.com/apache/trafficserver/pull/13645#discussion_r3991558995


##########
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:
   Oh, sad. I was hoping github would show the before and after of your patch 
with this comment. It's clear this helper function removes three lines of 
boilerplate which is a nice cleanup.



-- 
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]

Reply via email to