trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject [trafficserver] branch master updated: Add a new log tag %<vbn> AppVersionInfo.BldNumStr
Date Wed, 08 Apr 2020 23:23:04 GMT
This is an automated email from the ASF dual-hosted git repository.

rrm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 9bd8abb  Add a new log tag %<vbn> AppVersionInfo.BldNumStr
9bd8abb is described below

commit 9bd8abb51984861801af03310869424db244b778
Author: Masa Sekimura <sekimura@gmail.com>
AuthorDate: Fri Nov 18 23:34:35 2016 +0000

    Add a new log tag %<vbn> AppVersionInfo.BldNumStr
    
    TS-5051
---
 proxy/http/unit_tests/unit_test_main.cc |  5 +++++
 proxy/logging/Log.cc                    |  5 +++++
 proxy/logging/LogAccess.cc              | 15 +++++++++++++++
 proxy/logging/LogAccess.h               |  1 +
 4 files changed, 26 insertions(+)

diff --git a/proxy/http/unit_tests/unit_test_main.cc b/proxy/http/unit_tests/unit_test_main.cc
index 6aed3a6..6217bda 100644
--- a/proxy/http/unit_tests/unit_test_main.cc
+++ b/proxy/http/unit_tests/unit_test_main.cc
@@ -22,4 +22,9 @@
  */
 
 #define CATCH_CONFIG_MAIN
+
 #include "catch.hpp"
+
+#include "tscore/I_Version.h"
+
+AppVersionInfo appVersionInfo;
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 9f39ea9..42f8dc3 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -902,6 +902,11 @@ Log::init_fields()
   global_field_list.add(field, false);
   field_symbol_hash.emplace("ctpd", field);
 
+  field = new LogField("version_build_number", "vbn", LogField::STRING, &LogAccess::marshal_version_build_number,
+                       (LogField::UnmarshalFunc)&LogAccess::unmarshal_str);
+  global_field_list.add(field, false);
+  field_symbol_hash.emplace("vbn", field);
+
   init_status |= FIELDS_INITIALIZED;
 }
 
diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc
index 6e3aac4..32b2e19 100644
--- a/proxy/logging/LogAccess.cc
+++ b/proxy/logging/LogAccess.cc
@@ -30,6 +30,8 @@
 #include "LogFormat.h"
 #include "LogBuffer.h"
 
+extern AppVersionInfo appVersionInfo;
+
 char INVALID_STR[] = "!INVALID_STR!";
 
 #define HIDDEN_CONTENT_TYPE "@Content-Type"
@@ -1300,6 +1302,19 @@ LogAccess::marshal_client_sni_server_name(char *buf)
   -------------------------------------------------------------------------*/
 
 int
+LogAccess::marshal_version_build_number(char *buf)
+{
+  int len = sizeof(appVersionInfo.BldNumStr);
+  if (buf) {
+    marshal_str(buf, appVersionInfo.BldNumStr, len);
+  }
+  return len;
+}
+
+/*-------------------------------------------------------------------------
+  -------------------------------------------------------------------------*/
+
+int
 LogAccess::marshal_client_host_port(char *buf)
 {
   if (buf) {
diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h
index fa83bc8..e9090d3 100644
--- a/proxy/logging/LogAccess.h
+++ b/proxy/logging/LogAccess.h
@@ -251,6 +251,7 @@ public:
   inkcoreapi int marshal_client_http_transaction_priority_dependence(char *); // INT
   inkcoreapi int marshal_cache_lookup_url_canon(char *);                      // STR
   inkcoreapi int marshal_client_sni_server_name(char *);                      // STR
+  inkcoreapi int marshal_version_build_number(char *);                        // STR
 
   // named fields from within a http header
   //


Mime
View raw message