You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by cm...@apache.org on 2024/05/16 14:24:14 UTC

(trafficserver) branch 10.0.x updated (ea0b29416a -> 05f9b4e0fd)

This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a change to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


    from ea0b29416a ATS_PROBE: add SystemTap ATS probe autest (#11339)
     new 6eb7f608ce Fix RelWithDebInfo to be release with debug info (#11211)
     new 14924ed99f Use large IOBufferBlock only on sending DATA frame (#11229)
     new f4139730da Coverity 1534725: Uninitialized scalar variable (#11336)
     new 9a54d66243 Fix undefined behavior doing memcpy from timespec** instead from timespec* (#11356)
     new 2f4544a0a4 Remove obsolete debug output calls in 23 source files. (#11298)
     new 0a9b9f8140 Eliminate leaking of HostStatusSync instances. (#11275)
     new 46369c6567 Remove obsolete debug output calls in 18 source files. (#11307)
     new 05f9b4e0fd Adding Cripts documentation structure (#11359)

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CMakeLists.txt                                     |   4 +
 .../cripts-bundles.en.rst}                         |   8 +-
 .../cripts-connections.en.rst}                     |   8 +-
 .../cripts-examples.en.rst}                        |   8 +-
 doc/developer-guide/cripts/cripts-headers.en.rst   | 163 ++++++++++++
 .../cripts-matcher.en.rst}                         |   8 +-
 .../cripts-misc.en.rst}                            |   8 +-
 doc/developer-guide/cripts/cripts-overview.en.rst  | 286 +++++++++++++++++++++
 doc/developer-guide/cripts/cripts-urls.en.rst      | 118 +++++++++
 doc/developer-guide/cripts/cripts-variables.en.rst | 155 +++++++++++
 .../{layout => cripts}/index.en.rst                |  14 +-
 doc/developer-guide/index.en.rst                   |   1 +
 include/proxy/HostStatus.h                         |  34 ++-
 include/proxy/http2/HTTP2.h                        |   1 +
 .../experimental/txn_box/plugin/src/ip_space.cc    |   1 +
 src/iocore/net/UnixUDPNet.cc                       |   2 +-
 src/proxy/CacheControl.cc                          |  24 +-
 src/proxy/ControlBase.cc                           |   6 +-
 src/proxy/FetchSM.cc                               |  42 +--
 src/proxy/HostStatus.cc                            |  51 ++--
 src/proxy/ParentSelectionStrategy.cc               |  12 +-
 src/proxy/ProtocolProbeSessionAccept.cc            |  35 ++-
 src/proxy/ReverseProxy.cc                          |  15 +-
 src/proxy/Transform.cc                             |  57 ++--
 src/proxy/hdrs/HTTP.cc                             |  28 +-
 src/proxy/hdrs/HdrHeap.cc                          |  12 +-
 src/proxy/hdrs/HdrToken.cc                         |  14 +-
 src/proxy/hdrs/MIME.cc                             |  67 ++---
 src/proxy/hdrs/URL.cc                              |  55 ++--
 src/proxy/hdrs/XPACK.cc                            |  30 ++-
 src/proxy/http2/HPACK.cc                           |  21 +-
 src/proxy/http2/HTTP2.cc                           |   3 +
 src/proxy/http2/Http2ClientSession.cc              |  16 +-
 src/proxy/http2/Http2CommonSession.cc              |  19 +-
 src/proxy/http2/Http2ConnectionState.cc            |  25 +-
 src/proxy/http2/Http2Frame.cc                      |  11 +-
 src/proxy/http2/Http2SessionAccept.cc              |  12 +-
 src/proxy/http3/Http09App.cc                       |  15 +-
 src/proxy/http3/Http3App.cc                        |  29 ++-
 src/proxy/http3/Http3Frame.cc                      |   8 +-
 src/proxy/http3/Http3FrameCollector.cc             |   8 +-
 src/proxy/http3/Http3FrameDispatcher.cc            |  17 +-
 src/proxy/http3/Http3HeaderFramer.cc               |   8 +-
 src/proxy/http3/Http3HeaderVIOAdaptor.cc           |  19 +-
 src/proxy/http3/Http3SessionAccept.cc              |  18 +-
 src/proxy/http3/Http3SettingsHandler.cc            |  14 +-
 src/proxy/http3/Http3Transaction.cc                |  21 +-
 src/proxy/http3/QPACK.cc                           |  10 +-
 src/proxy/logging/Log.cc                           |  63 +++--
 src/proxy/logging/LogAccess.cc                     |  27 +-
 src/proxy/logging/LogBuffer.cc                     |  27 +-
 src/proxy/logging/LogConfig.cc                     |  50 ++--
 src/proxy/logging/LogField.cc                      |  22 +-
 src/proxy/logging/LogFile.cc                       |  41 +--
 src/proxy/logging/LogFilter.cc                     |  19 +-
 src/proxy/logging/LogFormat.cc                     |  59 +++--
 src/proxy/logging/LogObject.cc                     |  93 ++++---
 src/proxy/logging/YamlLogConfig.cc                 |  11 +-
 .../logging/unit-tests/benchmark_LogObject.cc      |   2 +-
 59 files changed, 1497 insertions(+), 458 deletions(-)
 copy doc/developer-guide/{debugging/using-tsassert.en.rst => cripts/cripts-bundles.en.rst} (91%)
 copy doc/developer-guide/{debugging/using-tsassert.en.rst => cripts/cripts-connections.en.rst} (90%)
 copy doc/developer-guide/{debugging/using-tsassert.en.rst => cripts/cripts-examples.en.rst} (91%)
 create mode 100644 doc/developer-guide/cripts/cripts-headers.en.rst
 copy doc/developer-guide/{debugging/using-tsassert.en.rst => cripts/cripts-matcher.en.rst} (91%)
 copy doc/developer-guide/{debugging/using-tsassert.en.rst => cripts/cripts-misc.en.rst} (90%)
 create mode 100644 doc/developer-guide/cripts/cripts-overview.en.rst
 create mode 100644 doc/developer-guide/cripts/cripts-urls.en.rst
 create mode 100644 doc/developer-guide/cripts/cripts-variables.en.rst
 copy doc/developer-guide/{layout => cripts}/index.en.rst (79%)


(trafficserver) 04/08: Fix undefined behavior doing memcpy from timespec** instead from timespec* (#11356)

Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 9a54d662438a2fc2847401ac9efa7ef788210b5b
Author: Pavel Vazharov <pa...@x3me.net>
AuthorDate: Wed May 15 19:02:21 2024 +0300

    Fix undefined behavior doing memcpy from timespec** instead from timespec* (#11356)
    
    The code was wrongly copying from timespec** to timespec*.
    There was a warning emitted from GCC 13.2 about this.
    
    (cherry picked from commit 4dc6bede9cb15ffa3e992c6b0a45781a4211d339)
---
 src/iocore/net/UnixUDPNet.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/iocore/net/UnixUDPNet.cc b/src/iocore/net/UnixUDPNet.cc
index 92f44fd0e6..554031fbe3 100644
--- a/src/iocore/net/UnixUDPNet.cc
+++ b/src/iocore/net/UnixUDPNet.cc
@@ -97,7 +97,7 @@ UDPPacket::new_UDPPacket(struct sockaddr const *to, ink_hrtime when, Ptr<IOBuffe
   p->p.segment_size = segment_size;
 #ifdef HAVE_SO_TXTIME
   if (send_at_hint) {
-    memcpy(&p->p.send_at, &send_at_hint, sizeof(struct timespec));
+    memcpy(&p->p.send_at, send_at_hint, sizeof(struct timespec));
   }
 #endif
   return p;


(trafficserver) 05/08: Remove obsolete debug output calls in 23 source files. (#11298)

Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 2f4544a0a453c1f50e307524472f4166e4f9ea1d
Author: Walt Karas <wk...@yahooinc.com>
AuthorDate: Tue May 14 16:34:38 2024 -0400

    Remove obsolete debug output calls in 23 source files. (#11298)
    
    In the src/proxy tree.
    
    (cherry picked from commit c537ce6c2c954334549a835b3f0d20552dcd0fc6)
---
 src/proxy/ControlBase.cc                           |  6 +-
 src/proxy/hdrs/HTTP.cc                             | 28 ++++---
 src/proxy/hdrs/HdrHeap.cc                          | 12 ++-
 src/proxy/hdrs/HdrToken.cc                         | 14 +++-
 src/proxy/hdrs/MIME.cc                             | 67 +++++++++-------
 src/proxy/hdrs/URL.cc                              | 55 ++++++++-----
 src/proxy/hdrs/XPACK.cc                            | 30 ++++---
 src/proxy/http2/HPACK.cc                           | 21 ++---
 src/proxy/http2/Http2ClientSession.cc              | 10 ++-
 src/proxy/http2/Http2CommonSession.cc              | 19 +++--
 src/proxy/http2/Http2ConnectionState.cc            | 25 +++---
 src/proxy/http2/Http2SessionAccept.cc              | 12 ++-
 src/proxy/logging/Log.cc                           | 63 +++++++++------
 src/proxy/logging/LogAccess.cc                     | 27 ++++---
 src/proxy/logging/LogBuffer.cc                     | 27 ++++---
 src/proxy/logging/LogConfig.cc                     | 50 +++++++-----
 src/proxy/logging/LogField.cc                      | 22 +++--
 src/proxy/logging/LogFile.cc                       | 41 ++++++----
 src/proxy/logging/LogFilter.cc                     | 19 +++--
 src/proxy/logging/LogFormat.cc                     | 59 ++++++++------
 src/proxy/logging/LogObject.cc                     | 93 ++++++++++++----------
 src/proxy/logging/YamlLogConfig.cc                 | 11 ++-
 .../logging/unit-tests/benchmark_LogObject.cc      |  2 +-
 23 files changed, 432 insertions(+), 281 deletions(-)

diff --git a/src/proxy/ControlBase.cc b/src/proxy/ControlBase.cc
index e96ddd3765..69c9c757aa 100644
--- a/src/proxy/ControlBase.cc
+++ b/src/proxy/ControlBase.cc
@@ -525,9 +525,9 @@ PrefixMod::check(HttpRequestData *req) const
   const char *path = req->hdr->url_get()->path_get(&path_len);
   bool        zret = path_len >= static_cast<int>(text.size()) && 0 == memcmp(path, text.data(), text.size());
   /*
-    Debug("cache_control", "Prefix check: URL=%0.*s Mod=%0.*s Z=%s",
-      path_len, path, text.size(), text.data(),
-      zret ? "Match" : "Fail"
+    Dbg(dbg_ctl_cache_control, "Prefix check: URL=%0.*s Mod=%0.*s Z=%s",
+        path_len, path, text.size(), text.data(),
+        zret ? "Match" : "Fail"
     );
   */
   return zret;
diff --git a/src/proxy/hdrs/HTTP.cc b/src/proxy/hdrs/HTTP.cc
index fd3a2d3f36..166d896599 100644
--- a/src/proxy/hdrs/HTTP.cc
+++ b/src/proxy/hdrs/HTTP.cc
@@ -143,6 +143,12 @@ int HTTP_LEN_100_CONTINUE;
 
 Arena *const HTTPHdr::USE_HDR_HEAP_MAGIC = reinterpret_cast<Arena *>(1);
 
+namespace
+{
+DbgCtl dbg_ctl_http{"http"};
+
+} // end anonymous namespace
+
 /***********************************************************************
  *                                                                     *
  *                         M A I N    C O D E                          *
@@ -571,9 +577,9 @@ http_hdr_describe(HdrHeapObjImpl *raw, bool recurse)
   HTTPHdrImpl *obj = (HTTPHdrImpl *)raw;
 
   if (obj->m_polarity == HTTP_TYPE_REQUEST) {
-    Debug("http", "[TYPE: REQ, V: %04X, URL: %p, METHOD: \"%.*s\", METHOD_LEN: %d, FIELDS: %p]", obj->m_version.get_flat_version(),
-          obj->u.req.m_url_impl, obj->u.req.m_len_method, (obj->u.req.m_ptr_method ? obj->u.req.m_ptr_method : "NULL"),
-          obj->u.req.m_len_method, obj->m_fields_impl);
+    Dbg(dbg_ctl_http, "[TYPE: REQ, V: %04X, URL: %p, METHOD: \"%.*s\", METHOD_LEN: %d, FIELDS: %p]",
+        obj->m_version.get_flat_version(), obj->u.req.m_url_impl, obj->u.req.m_len_method,
+        (obj->u.req.m_ptr_method ? obj->u.req.m_ptr_method : "NULL"), obj->u.req.m_len_method, obj->m_fields_impl);
     if (recurse) {
       if (obj->u.req.m_url_impl) {
         obj_describe(obj->u.req.m_url_impl, recurse);
@@ -583,9 +589,9 @@ http_hdr_describe(HdrHeapObjImpl *raw, bool recurse)
       }
     }
   } else {
-    Debug("http", "[TYPE: RSP, V: %04X, STATUS: %d, REASON: \"%.*s\", REASON_LEN: %d, FIELDS: %p]",
-          obj->m_version.get_flat_version(), obj->u.resp.m_status, obj->u.resp.m_len_reason,
-          (obj->u.resp.m_ptr_reason ? obj->u.resp.m_ptr_reason : "NULL"), obj->u.resp.m_len_reason, obj->m_fields_impl);
+    Dbg(dbg_ctl_http, "[TYPE: RSP, V: %04X, STATUS: %d, REASON: \"%.*s\", REASON_LEN: %d, FIELDS: %p]",
+        obj->m_version.get_flat_version(), obj->u.resp.m_status, obj->u.resp.m_len_reason,
+        (obj->u.resp.m_ptr_reason ? obj->u.resp.m_ptr_reason : "NULL"), obj->u.resp.m_len_reason, obj->m_fields_impl);
     if (recurse) {
       if (obj->m_fields_impl) {
         obj_describe(obj->m_fields_impl, recurse);
@@ -1249,7 +1255,7 @@ validate_hdr_content_length(HdrHeap *heap, HTTPHdrImpl *hh)
     // the Content-Length
     if (mime_hdr_field_find(hh->m_fields_impl, MIME_FIELD_TRANSFER_ENCODING, MIME_LEN_TRANSFER_ENCODING) != nullptr) {
       // Delete all Content-Length headers
-      Debug("http", "Transfer-Encoding header and Content-Length headers the request, removing all Content-Length headers");
+      Dbg(dbg_ctl_http, "Transfer-Encoding header and Content-Length headers the request, removing all Content-Length headers");
       mime_hdr_field_delete(heap, hh->m_fields_impl, content_length_field, true);
       return PARSE_RESULT_DONE;
     }
@@ -1268,14 +1274,14 @@ validate_hdr_content_length(HdrHeap *heap, HTTPHdrImpl *hh)
     // Content-Length = 1*DIGIT
     //
     if (value.empty()) {
-      Debug("http", "Content-Length headers don't match the ABNF, returning parse error");
+      Dbg(dbg_ctl_http, "Content-Length headers don't match the ABNF, returning parse error");
       return PARSE_RESULT_ERROR;
     }
 
     // If the content-length value contains a non-numeric value, the header is invalid
     if (std::find_if(value.cbegin(), value.cend(), [](std::string_view::value_type c) { return !std::isdigit(c); }) !=
         value.cend()) {
-      Debug("http", "Content-Length value contains non-digit, returning parse error");
+      Dbg(dbg_ctl_http, "Content-Length value contains non-digit, returning parse error");
       return PARSE_RESULT_ERROR;
     }
 
@@ -1284,11 +1290,11 @@ validate_hdr_content_length(HdrHeap *heap, HTTPHdrImpl *hh)
 
       if ((value.length() != value_dup.length()) || value.compare(value_dup) != 0) {
         // Values are different, parse error
-        Debug("http", "Content-Length headers don't match, returning parse error");
+        Dbg(dbg_ctl_http, "Content-Length headers don't match, returning parse error");
         return PARSE_RESULT_ERROR;
       } else {
         // Delete the duplicate since it has the same value
-        Debug("http", "Deleting duplicate Content-Length header");
+        Dbg(dbg_ctl_http, "Deleting duplicate Content-Length header");
         mime_hdr_field_delete(heap, hh->m_fields_impl, content_length_field->m_next_dup, false);
       }
     }
diff --git a/src/proxy/hdrs/HdrHeap.cc b/src/proxy/hdrs/HdrHeap.cc
index a8013f13fb..03ad762728 100644
--- a/src/proxy/hdrs/HdrHeap.cc
+++ b/src/proxy/hdrs/HdrHeap.cc
@@ -45,6 +45,12 @@ static constexpr uint32_t MAX_HDR_HEAP_OBJ_LENGTH = (1 << 20) - 1; ///< m_length
 Allocator hdrHeapAllocator("hdrHeap", HdrHeap::DEFAULT_SIZE);
 Allocator strHeapAllocator("hdrStrHeap", HdrStrHeap::DEFAULT_SIZE);
 
+namespace
+{
+DbgCtl dbg_ctl_http{"http"};
+
+} // end anonymous namespace
+
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
 
@@ -53,8 +59,8 @@ obj_describe(HdrHeapObjImpl *obj, bool recurse)
 {
   static const char *obj_names[] = {"EMPTY", "RAW", "URL", "HTTP_HEADER", "MIME_HEADER", "FIELD_BLOCK"};
 
-  Debug("http", "%s %p: [T: %d, L: %4d, OBJFLAGS: %X]  ", obj_names[obj->m_type], obj, obj->m_type, obj->m_length,
-        obj->m_obj_flags);
+  Dbg(dbg_ctl_http, "%s %p: [T: %d, L: %4d, OBJFLAGS: %X]  ", obj_names[obj->m_type], obj, obj->m_type, obj->m_length,
+      obj->m_obj_flags);
 
   switch (obj->m_type) {
   case HDR_HEAP_OBJ_EMPTY:
@@ -337,7 +343,7 @@ HdrHeap::demote_rw_str_heap()
       i.m_heap_start    = reinterpret_cast<char *>(m_read_write_heap.get());
       i.m_heap_len      = m_read_write_heap->total_size() - m_read_write_heap->space_avail();
 
-      //          Debug("hdrs", "Demoted rw heap of %d size", m_read_write_heap->total_size());
+      //          Dbg(dbg_ctl_hdrs, "Demoted rw heap of %d size", m_read_write_heap->total_size());
       m_read_write_heap = nullptr;
       return 0;
     }
diff --git a/src/proxy/hdrs/HdrToken.cc b/src/proxy/hdrs/HdrToken.cc
index 5262b39537..253d0d90a5 100644
--- a/src/proxy/hdrs/HdrToken.cc
+++ b/src/proxy/hdrs/HdrToken.cc
@@ -33,6 +33,10 @@
 #include "tsutil/Regex.h"
 #include "proxy/hdrs/URL.h"
 
+namespace
+{
+DbgCtl dbg_ctl_hdr_token{"hdr_token"};
+
 /*
  You SHOULD add to _hdrtoken_commonly_tokenized_strs, with the same ordering
  ** important, ordering matters **
@@ -47,7 +51,7 @@
   /ericb
 */
 
-static const char *_hdrtoken_strs[] = {
+const char *_hdrtoken_strs[] = {
   // MIME Field names
   "Accept-Charset", "Accept-Encoding", "Accept-Language", "Accept-Ranges", "Accept", "Age", "Allow",
   "Approved", // NNTP
@@ -118,7 +122,7 @@ static const char *_hdrtoken_strs[] = {
   // RFC-7932
   "br"};
 
-static HdrTokenTypeBinding _hdrtoken_strs_type_initializers[] = {
+HdrTokenTypeBinding _hdrtoken_strs_type_initializers[] = {
   {"file",                 HDRTOKEN_TYPE_SCHEME        },
   {"ftp",                  HDRTOKEN_TYPE_SCHEME        },
   {"gopher",               HDRTOKEN_TYPE_SCHEME        },
@@ -168,7 +172,7 @@ static HdrTokenTypeBinding _hdrtoken_strs_type_initializers[] = {
   {(char *)nullptr,        static_cast<HdrTokenType>(0)},
 };
 
-static HdrTokenFieldInfo _hdrtoken_strs_field_initializers[] = {
+HdrTokenFieldInfo _hdrtoken_strs_field_initializers[] = {
   {"Accept",                    MIME_SLOTID_ACCEPT,              MIME_PRESENCE_ACCEPT,              (HTIF_COMMAS | HTIF_MULTVALS)                },
   {"Accept-Charset",            MIME_SLOTID_ACCEPT_CHARSET,      MIME_PRESENCE_ACCEPT_CHARSET,      (HTIF_COMMAS | HTIF_MULTVALS)                },
   {"Accept-Encoding",           MIME_SLOTID_ACCEPT_ENCODING,     MIME_PRESENCE_ACCEPT_ENCODING,     (HTIF_COMMAS | HTIF_MULTVALS)                },
@@ -248,6 +252,8 @@ static HdrTokenFieldInfo _hdrtoken_strs_field_initializers[] = {
   {nullptr,                     0,                               0,                                 0                                            },
 };
 
+} // end anonymous namespace
+
 const char *_hdrtoken_strs_heap_f = nullptr; // storage first byte
 const char *_hdrtoken_strs_heap_l = nullptr; // storage last byte
 
@@ -609,7 +615,7 @@ hdrtoken_tokenize(const char *string, int string_len, const char **wks_string_ou
     return wks_idx;
   }
 
-  Debug("hdr_token", "Did not find a WKS for '%.*s'", string_len, string);
+  Dbg(dbg_ctl_hdr_token, "Did not find a WKS for '%.*s'", string_len, string);
   return -1;
 }
 
diff --git a/src/proxy/hdrs/MIME.cc b/src/proxy/hdrs/MIME.cc
index ad88c19f45..5dbcb349c0 100644
--- a/src/proxy/hdrs/MIME.cc
+++ b/src/proxy/hdrs/MIME.cc
@@ -355,6 +355,12 @@ int MIME_WKSIDX_SEC_WEBSOCKET_VERSION;
 int MIME_WKSIDX_HTTP2_SETTINGS;
 int MIME_WKSIDX_EARLY_DATA;
 
+namespace
+{
+DbgCtl dbg_ctl_http{"http"};
+
+} // end anonymous namespace
+
 /***********************************************************************
  *                                                                     *
  *                 U T I L I T Y    R O U T I N E S                    *
@@ -1325,14 +1331,15 @@ mime_hdr_field_find(MIMEHdrImpl *mh, const char *field_name_str, int field_name_
   ////////////////////////////////////////////
 
 #if TRACK_FIELD_FIND_CALLS
-  Debug("http", "mime_hdr_field_find(hdr 0x%X, field %.*s): is_wks = %d", mh, field_name_len, field_name_str, is_wks);
+  Dbg(dbg_ctl_http, "mime_hdr_field_find(hdr 0x%X, field %.*s): is_wks = %d", mh, field_name_len, field_name_str, is_wks);
 #endif
 
   if (is_wks) {
     token_info = hdrtoken_wks_to_prefix(field_name_str);
     if ((token_info->wks_info.mask) && ((mh->m_presence_bits & token_info->wks_info.mask) == 0)) {
 #if TRACK_FIELD_FIND_CALLS
-      Debug("http", "mime_hdr_field_find(hdr 0x%X, field %.*s): MISS (due to presence bits)", mh, field_name_len, field_name_str);
+      Dbg(dbg_ctl_http, "mime_hdr_field_find(hdr 0x%X, field %.*s): MISS (due to presence bits)", mh, field_name_len,
+          field_name_str);
 #endif
       return nullptr;
     }
@@ -1346,13 +1353,13 @@ mime_hdr_field_find(MIMEHdrImpl *mh, const char *field_name_str, int field_name_
         MIMEField *f = _mime_hdr_field_list_search_by_slotnum(mh, slotnum);
         ink_assert((f == nullptr) || f->is_live());
 #if TRACK_FIELD_FIND_CALLS
-        Debug("http", "mime_hdr_field_find(hdr 0x%X, field %.*s): %s (due to slot accelerators)", mh, field_name_len,
-              field_name_str, (f ? "HIT" : "MISS"));
+        Dbg(dbg_ctl_http, "mime_hdr_field_find(hdr 0x%X, field %.*s): %s (due to slot accelerators)", mh, field_name_len,
+            field_name_str, (f ? "HIT" : "MISS"));
 #endif
         return f;
       } else {
 #if TRACK_FIELD_FIND_CALLS
-        Debug("http", "mime_hdr_field_find(hdr 0x%X, field %.*s): UNKNOWN (slot too big)", mh, field_name_len, field_name_str);
+        Dbg(dbg_ctl_http, "mime_hdr_field_find(hdr 0x%X, field %.*s): UNKNOWN (slot too big)", mh, field_name_len, field_name_str);
 #endif
       }
     }
@@ -1364,8 +1371,8 @@ mime_hdr_field_find(MIMEHdrImpl *mh, const char *field_name_str, int field_name_
     MIMEField *f = _mime_hdr_field_list_search_by_wks(mh, token_info->wks_idx);
     ink_assert((f == nullptr) || f->is_live());
 #if TRACK_FIELD_FIND_CALLS
-    Debug("http", "mime_hdr_field_find(hdr 0x%X, field %.*s): %s (due to WKS list walk)", mh, field_name_len, field_name_str,
-          (f ? "HIT" : "MISS"));
+    Dbg(dbg_ctl_http, "mime_hdr_field_find(hdr 0x%X, field %.*s): %s (due to WKS list walk)", mh, field_name_len, field_name_str,
+        (f ? "HIT" : "MISS"));
 #endif
     return f;
   } else {
@@ -1373,8 +1380,8 @@ mime_hdr_field_find(MIMEHdrImpl *mh, const char *field_name_str, int field_name_
 
     ink_assert((f == nullptr) || f->is_live());
 #if TRACK_FIELD_FIND_CALLS
-    Debug("http", "mime_hdr_field_find(hdr 0x%X, field %.*s): %s (due to strcmp list walk)", mh, field_name_len, field_name_str,
-          (f ? "HIT" : "MISS"));
+    Dbg(dbg_ctl_http, "mime_hdr_field_find(hdr 0x%X, field %.*s): %s (due to strcmp list walk)", mh, field_name_len, field_name_str,
+        (f ? "HIT" : "MISS"));
 #endif
     return f;
   }
@@ -2654,16 +2661,16 @@ mime_hdr_describe(HdrHeapObjImpl *raw, bool recurse)
   MIMEFieldBlockImpl *fblock;
   MIMEHdrImpl        *obj = (MIMEHdrImpl *)raw;
 
-  Debug("http", "\t[PBITS: 0x%08X%08X, SLACC: 0x%04X%04X%04X%04X, HEADBLK: %p, TAILBLK: %p]",
-        (uint32_t)((obj->m_presence_bits >> 32) & (TOK_64_CONST(0xFFFFFFFF))),
-        (uint32_t)((obj->m_presence_bits >> 0) & (TOK_64_CONST(0xFFFFFFFF))), obj->m_slot_accelerators[0],
-        obj->m_slot_accelerators[1], obj->m_slot_accelerators[2], obj->m_slot_accelerators[3], &(obj->m_first_fblock),
-        obj->m_fblock_list_tail);
+  Dbg(dbg_ctl_http, "\t[PBITS: 0x%08X%08X, SLACC: 0x%04X%04X%04X%04X, HEADBLK: %p, TAILBLK: %p]",
+      (uint32_t)((obj->m_presence_bits >> 32) & (TOK_64_CONST(0xFFFFFFFF))),
+      (uint32_t)((obj->m_presence_bits >> 0) & (TOK_64_CONST(0xFFFFFFFF))), obj->m_slot_accelerators[0],
+      obj->m_slot_accelerators[1], obj->m_slot_accelerators[2], obj->m_slot_accelerators[3], &(obj->m_first_fblock),
+      obj->m_fblock_list_tail);
 
-  Debug("http", "\t[CBITS: 0x%08X, T_MAXAGE: %d, T_SMAXAGE: %d, T_MAXSTALE: %d, T_MINFRESH: %d, PNO$: %d]",
-        obj->m_cooked_stuff.m_cache_control.m_mask, obj->m_cooked_stuff.m_cache_control.m_secs_max_age,
-        obj->m_cooked_stuff.m_cache_control.m_secs_s_maxage, obj->m_cooked_stuff.m_cache_control.m_secs_max_stale,
-        obj->m_cooked_stuff.m_cache_control.m_secs_min_fresh, obj->m_cooked_stuff.m_pragma.m_no_cache);
+  Dbg(dbg_ctl_http, "\t[CBITS: 0x%08X, T_MAXAGE: %d, T_SMAXAGE: %d, T_MAXSTALE: %d, T_MINFRESH: %d, PNO$: %d]",
+      obj->m_cooked_stuff.m_cache_control.m_mask, obj->m_cooked_stuff.m_cache_control.m_secs_max_age,
+      obj->m_cooked_stuff.m_cache_control.m_secs_s_maxage, obj->m_cooked_stuff.m_cache_control.m_secs_max_stale,
+      obj->m_cooked_stuff.m_cache_control.m_secs_min_fresh, obj->m_cooked_stuff.m_pragma.m_no_cache);
   for (fblock = &(obj->m_first_fblock); fblock != nullptr; fblock = fblock->m_next) {
     if (recurse || (fblock == &(obj->m_first_fblock))) {
       obj_describe((HdrHeapObjImpl *)fblock, recurse);
@@ -2679,11 +2686,11 @@ mime_field_block_describe(HdrHeapObjImpl *raw, bool /* recurse ATS_UNUSED */)
 
   MIMEFieldBlockImpl *obj = (MIMEFieldBlockImpl *)raw;
 
-  Debug("http", "[FREETOP: %d, NEXTBLK: %p]", obj->m_freetop, obj->m_next);
+  Dbg(dbg_ctl_http, "[FREETOP: %d, NEXTBLK: %p]", obj->m_freetop, obj->m_next);
 
   for (i = 0; i < obj->m_freetop; i++) {
     MIMEField *f = &(obj->m_field_slots[i]);
-    Debug("http", "\tSLOT #%2d (%p), %-8s", i, f, readiness_names[f->m_readiness]);
+    Dbg(dbg_ctl_http, "\tSLOT #%2d (%p), %-8s", i, f, readiness_names[f->m_readiness]);
 
     switch (f->m_readiness) {
     case MIME_FIELD_SLOT_READINESS_EMPTY:
@@ -2691,14 +2698,14 @@ mime_field_block_describe(HdrHeapObjImpl *raw, bool /* recurse ATS_UNUSED */)
     case MIME_FIELD_SLOT_READINESS_DETACHED:
     case MIME_FIELD_SLOT_READINESS_LIVE:
     case MIME_FIELD_SLOT_READINESS_DELETED:
-      Debug("http", "[N: \"%.*s\", N_LEN: %d, N_IDX: %d, ", f->m_len_name, (f->m_ptr_name ? f->m_ptr_name : "NULL"), f->m_len_name,
-            f->m_wks_idx);
-      Debug("http", "V: \"%.*s\", V_LEN: %d, ", f->m_len_value, (f->m_ptr_value ? f->m_ptr_value : "NULL"), f->m_len_value);
-      Debug("http", "NEXTDUP: %p, RAW: %d, RAWLEN: %d, F: %d]", f->m_next_dup, f->m_n_v_raw_printable,
-            f->m_len_name + f->m_len_value + f->m_n_v_raw_printable_pad, f->m_flags);
+      Dbg(dbg_ctl_http, "[N: \"%.*s\", N_LEN: %d, N_IDX: %d, ", f->m_len_name, (f->m_ptr_name ? f->m_ptr_name : "NULL"),
+          f->m_len_name, f->m_wks_idx);
+      Dbg(dbg_ctl_http, "V: \"%.*s\", V_LEN: %d, ", f->m_len_value, (f->m_ptr_value ? f->m_ptr_value : "NULL"), f->m_len_value);
+      Dbg(dbg_ctl_http, "NEXTDUP: %p, RAW: %d, RAWLEN: %d, F: %d]", f->m_next_dup, f->m_n_v_raw_printable,
+          f->m_len_name + f->m_len_value + f->m_n_v_raw_printable_pad, f->m_flags);
       break;
     }
-    Debug("http", "\n");
+    Dbg(dbg_ctl_http, "\n");
   }
 }
 
@@ -3890,7 +3897,7 @@ MIMEHdrImpl::recompute_cooked_stuff(MIMEField *changing_field_or_null)
           // If >= 0 then this is a well known token
           if (hdrtoken_tokenize(s, tlen, &token_wks) >= 0) {
 #if TRACK_COOKING
-            Debug("http", "recompute_cooked_stuff: got field '%s'", token_wks);
+            Dbg(dbg_ctl_http, "recompute_cooked_stuff: got field '%s'", token_wks);
 #endif
 
             HdrTokenHeapPrefix *p                  = hdrtoken_wks_to_prefix(token_wks);
@@ -3898,7 +3905,7 @@ MIMEHdrImpl::recompute_cooked_stuff(MIMEField *changing_field_or_null)
             m_cooked_stuff.m_cache_control.m_mask |= mask;
 
 #if TRACK_COOKING
-            Debug("http", "                        set mask 0x%0X", mask);
+            Dbg(dbg_ctl_http, "                        set mask 0x%0X", mask);
 #endif
 
             if (mask & (MIME_COOKED_MASK_CC_MAX_AGE | MIME_COOKED_MASK_CC_S_MAXAGE | MIME_COOKED_MASK_CC_MAX_STALE |
@@ -3907,7 +3914,7 @@ MIMEHdrImpl::recompute_cooked_stuff(MIMEField *changing_field_or_null)
 
               if (mime_parse_integer(c, e, &value)) {
 #if TRACK_COOKING
-                Debug("http", "                        set integer value %d", value);
+                Dbg(dbg_ctl_http, "                        set integer value %d", value);
 #endif
                 if (token_wks == MIME_VALUE_MAX_AGE) {
                   m_cooked_stuff.m_cache_control.m_secs_max_age = value;
@@ -3920,7 +3927,7 @@ MIMEHdrImpl::recompute_cooked_stuff(MIMEField *changing_field_or_null)
                 }
               } else {
 #if TRACK_COOKING
-                Debug("http", "                        set integer value %d", INT_MAX);
+                Dbg(dbg_ctl_http, "                        set integer value %d", INT_MAX);
 #endif
                 if (token_wks == MIME_VALUE_MAX_STALE) {
                   m_cooked_stuff.m_cache_control.m_secs_max_stale = INT_MAX;
diff --git a/src/proxy/hdrs/URL.cc b/src/proxy/hdrs/URL.cc
index 7bfe3cf3ee..191e644876 100644
--- a/src/proxy/hdrs/URL.cc
+++ b/src/proxy/hdrs/URL.cc
@@ -93,9 +93,16 @@ int URL_LEN_MMS;
 int URL_LEN_MMSU;
 int URL_LEN_MMST;
 
+namespace
+{
 // Whether we should implement url_CryptoHash_get() using url_CryptoHash_get_fast(). Note that
 // url_CryptoHash_get_fast() does NOT produce the same result as url_CryptoHash_get_general().
-static int url_hash_method = 0;
+int url_hash_method = 0;
+
+DbgCtl dbg_ctl_http{"http"};
+DbgCtl dbg_ctl_url_cachekey{"url_cachekey"};
+
+} // end anonymous namespace
 
 // test to see if a character is a valid character for a host in a URI according to
 // RFC 3986 and RFC 1034
@@ -1210,7 +1217,7 @@ url_is_strictly_compliant(const char *start, const char *end)
 {
   for (const char *i = start; i < end; ++i) {
     if (!ParseRules::is_uri(*i)) {
-      Debug("http", "Non-RFC compliant character [0x%.2X] found in URL", (unsigned char)*i);
+      Dbg(dbg_ctl_http, "Non-RFC compliant character [0x%.2X] found in URL", (unsigned char)*i);
       return false;
     }
   }
@@ -1227,11 +1234,11 @@ url_is_mostly_compliant(const char *start, const char *end)
 {
   for (const char *i = start; i < end; ++i) {
     if (isspace(*i)) {
-      Debug("http", "Whitespace character [0x%.2X] found in URL", (unsigned char)*i);
+      Dbg(dbg_ctl_http, "Whitespace character [0x%.2X] found in URL", (unsigned char)*i);
       return false;
     }
     if (!isprint(*i)) {
-      Debug("http", "Non-printable character [0x%.2X] found in URL", (unsigned char)*i);
+      Dbg(dbg_ctl_http, "Non-printable character [0x%.2X] found in URL", (unsigned char)*i);
       return false;
     }
   }
@@ -1733,22 +1740,25 @@ url_describe(HdrHeapObjImpl *raw, bool /* recurse ATS_UNUSED */)
 {
   URLImpl *obj = (URLImpl *)raw;
 
-  Debug("http", "[URLTYPE: %d, SWKSIDX: %d,", obj->m_url_type, obj->m_scheme_wks_idx);
-  Debug("http", "\tSCHEME: \"%.*s\", SCHEME_LEN: %d,", obj->m_len_scheme, (obj->m_ptr_scheme ? obj->m_ptr_scheme : "NULL"),
-        obj->m_len_scheme);
-  Debug("http", "\tUSER: \"%.*s\", USER_LEN: %d,", obj->m_len_user, (obj->m_ptr_user ? obj->m_ptr_user : "NULL"), obj->m_len_user);
-  Debug("http", "\tPASSWORD: \"%.*s\", PASSWORD_LEN: %d,", obj->m_len_password,
-        (obj->m_ptr_password ? obj->m_ptr_password : "NULL"), obj->m_len_password);
-  Debug("http", "\tHOST: \"%.*s\", HOST_LEN: %d,", obj->m_len_host, (obj->m_ptr_host ? obj->m_ptr_host : "NULL"), obj->m_len_host);
-  Debug("http", "\tPORT: \"%.*s\", PORT_LEN: %d, PORT_NUM: %d", obj->m_len_port, (obj->m_ptr_port ? obj->m_ptr_port : "NULL"),
-        obj->m_len_port, obj->m_port);
-  Debug("http", "\tPATH: \"%.*s\", PATH_LEN: %d,", obj->m_len_path, (obj->m_ptr_path ? obj->m_ptr_path : "NULL"), obj->m_len_path);
-  Debug("http", "\tPARAMS: \"%.*s\", PARAMS_LEN: %d,", obj->m_len_params, (obj->m_ptr_params ? obj->m_ptr_params : "NULL"),
-        obj->m_len_params);
-  Debug("http", "\tQUERY: \"%.*s\", QUERY_LEN: %d,", obj->m_len_query, (obj->m_ptr_query ? obj->m_ptr_query : "NULL"),
-        obj->m_len_query);
-  Debug("http", "\tFRAGMENT: \"%.*s\", FRAGMENT_LEN: %d]", obj->m_len_fragment,
-        (obj->m_ptr_fragment ? obj->m_ptr_fragment : "NULL"), obj->m_len_fragment);
+  Dbg(dbg_ctl_http, "[URLTYPE: %d, SWKSIDX: %d,", obj->m_url_type, obj->m_scheme_wks_idx);
+  Dbg(dbg_ctl_http, "\tSCHEME: \"%.*s\", SCHEME_LEN: %d,", obj->m_len_scheme, (obj->m_ptr_scheme ? obj->m_ptr_scheme : "NULL"),
+      obj->m_len_scheme);
+  Dbg(dbg_ctl_http, "\tUSER: \"%.*s\", USER_LEN: %d,", obj->m_len_user, (obj->m_ptr_user ? obj->m_ptr_user : "NULL"),
+      obj->m_len_user);
+  Dbg(dbg_ctl_http, "\tPASSWORD: \"%.*s\", PASSWORD_LEN: %d,", obj->m_len_password,
+      (obj->m_ptr_password ? obj->m_ptr_password : "NULL"), obj->m_len_password);
+  Dbg(dbg_ctl_http, "\tHOST: \"%.*s\", HOST_LEN: %d,", obj->m_len_host, (obj->m_ptr_host ? obj->m_ptr_host : "NULL"),
+      obj->m_len_host);
+  Dbg(dbg_ctl_http, "\tPORT: \"%.*s\", PORT_LEN: %d, PORT_NUM: %d", obj->m_len_port, (obj->m_ptr_port ? obj->m_ptr_port : "NULL"),
+      obj->m_len_port, obj->m_port);
+  Dbg(dbg_ctl_http, "\tPATH: \"%.*s\", PATH_LEN: %d,", obj->m_len_path, (obj->m_ptr_path ? obj->m_ptr_path : "NULL"),
+      obj->m_len_path);
+  Dbg(dbg_ctl_http, "\tPARAMS: \"%.*s\", PARAMS_LEN: %d,", obj->m_len_params, (obj->m_ptr_params ? obj->m_ptr_params : "NULL"),
+      obj->m_len_params);
+  Dbg(dbg_ctl_http, "\tQUERY: \"%.*s\", QUERY_LEN: %d,", obj->m_len_query, (obj->m_ptr_query ? obj->m_ptr_query : "NULL"),
+      obj->m_len_query);
+  Dbg(dbg_ctl_http, "\tFRAGMENT: \"%.*s\", FRAGMENT_LEN: %d]", obj->m_len_fragment,
+      (obj->m_ptr_fragment ? obj->m_ptr_fragment : "NULL"), obj->m_len_fragment);
 }
 
 /*-------------------------------------------------------------------------
@@ -1904,9 +1914,10 @@ url_CryptoHash_get_general(const URLImpl *url, CryptoContext &ctx, CryptoHash &h
   ctx.update(&port, sizeof(port));
   if (generation != -1) {
     ctx.update(&generation, sizeof(generation));
-    Debug("url_cachekey", "Final url string for cache hash key %.*s%d%d", buffer_len, buffer, port, static_cast<int>(generation));
+    Dbg(dbg_ctl_url_cachekey, "Final url string for cache hash key %.*s%d%d", buffer_len, buffer, port,
+        static_cast<int>(generation));
   } else {
-    Debug("url_cachekey", "Final url string for cache hash key %.*s%d", buffer_len, buffer, port);
+    Dbg(dbg_ctl_url_cachekey, "Final url string for cache hash key %.*s%d", buffer_len, buffer, port);
   }
   ctx.finalize(hash);
 }
diff --git a/src/proxy/hdrs/XPACK.cc b/src/proxy/hdrs/XPACK.cc
index 7ed7bb359d..a218e9f79f 100644
--- a/src/proxy/hdrs/XPACK.cc
+++ b/src/proxy/hdrs/XPACK.cc
@@ -30,9 +30,13 @@
 #include "tscore/ink_memory.h"
 #include "tsutil/LocalBuffer.h"
 
-#define XPACKDebug(fmt, ...) Debug("xpack", fmt, ##__VA_ARGS__)
+namespace
+{
+DbgCtl dbg_ctl_xpack{"xpack"};
+
+#define XPACKDbg(fmt, ...) Dbg(dbg_ctl_xpack, fmt, ##__VA_ARGS__)
 
-static inline bool
+inline bool
 match(const char *s1, int s1_len, const char *s2, int s2_len)
 {
   if (s1_len != s2_len) {
@@ -50,6 +54,8 @@ match(const char *s1, int s1_len, const char *s2, int s2_len)
   return true;
 }
 
+} // end anonymous namespace
+
 //
 // [RFC 7541] 5.1. Integer representation
 //
@@ -216,7 +222,7 @@ xpack_encode_string(uint8_t *buf_start, const uint8_t *buf_end, const char *valu
 //
 XpackDynamicTable::XpackDynamicTable(uint32_t size) : _maximum_size(size), _available(size), _max_entries(size), _storage(size)
 {
-  XPACKDebug("Dynamic table size: %u", size);
+  XPACKDbg("Dynamic table size: %u", size);
   this->_entries      = static_cast<struct XpackDynamicTableEntry *>(ats_malloc(sizeof(struct XpackDynamicTableEntry) * size));
   this->_entries_head = size - 1;
   this->_entries_tail = size - 1;
@@ -233,7 +239,7 @@ XpackDynamicTable::~XpackDynamicTable()
 const XpackLookupResult
 XpackDynamicTable::lookup(uint32_t index, const char **name, size_t *name_len, const char **value, size_t *value_len) const
 {
-  XPACKDebug("Lookup entry: abs_index=%u", index);
+  XPACKDbg("Lookup entry: abs_index=%u", index);
 
   if (this->is_empty()) {
     // There's no entry
@@ -263,7 +269,7 @@ XpackDynamicTable::lookup(uint32_t index, const char **name, size_t *name_len, c
 const XpackLookupResult
 XpackDynamicTable::lookup(const char *name, size_t name_len, const char *value, size_t value_len) const
 {
-  XPACKDebug("Lookup entry: name=%.*s, value=%.*s", static_cast<int>(name_len), name, static_cast<int>(value_len), value);
+  XPACKDbg("Lookup entry: name=%.*s, value=%.*s", static_cast<int>(name_len), name, static_cast<int>(value_len), value);
   XpackLookupResult::MatchType match_type      = XpackLookupResult::MatchType::NONE;
   uint32_t                     i               = this->_calc_index(this->_entries_tail, 1);
   uint32_t                     end             = this->_calc_index(this->_entries_head, 1);
@@ -293,7 +299,7 @@ XpackDynamicTable::lookup(const char *name, size_t name_len, const char *value,
     }
   }
 
-  XPACKDebug("Lookup entry: candidate_index=%u, match_type=%u", candidate_index, match_type);
+  XPACKDbg("Lookup entry: candidate_index=%u, match_type=%u", candidate_index, match_type);
   return {candidate_index, match_type};
 }
 
@@ -307,7 +313,7 @@ const XpackLookupResult
 XpackDynamicTable::lookup_relative(uint32_t relative_index, const char **name, size_t *name_len, const char **value,
                                    size_t *value_len) const
 {
-  XPACKDebug("Lookup entry: rel_index=%u", relative_index);
+  XPACKDbg("Lookup entry: rel_index=%u", relative_index);
   return this->lookup(this->_entries[this->_entries_head].index - relative_index, name, name_len, value, value_len);
 }
 
@@ -355,8 +361,8 @@ XpackDynamicTable::insert_entry(const char *name, size_t name_len, const char *v
     wks};
   this->_available -= required_size;
 
-  XPACKDebug("Insert Entry: entry=%u, index=%u, size=%zu", this->_entries_head, this->_entries_inserted - 1, name_len + value_len);
-  XPACKDebug("Available size: %u", this->_available);
+  XPACKDbg("Insert Entry: entry=%u, index=%u, size=%zu", this->_entries_head, this->_entries_inserted - 1, name_len + value_len);
+  XPACKDbg("Available size: %u", this->_available);
   return {this->_entries_inserted, value_len ? XpackLookupResult::MatchType::EXACT : XpackLookupResult::MatchType::NAME};
 }
 
@@ -493,11 +499,11 @@ XpackDynamicTable::_make_space(uint64_t required_size)
 
   // Evict
   if (freed > 0) {
-    XPACKDebug("Evict entries: from %u to %u", this->_entries[this->_calc_index(this->_entries_tail, 1)].index,
-               this->_entries[tail - 1].index);
+    XPACKDbg("Evict entries: from %u to %u", this->_entries[this->_calc_index(this->_entries_tail, 1)].index,
+             this->_entries[tail - 1].index);
     this->_available    += freed;
     this->_entries_tail  = tail - 1;
-    XPACKDebug("Available size: %u", this->_available);
+    XPACKDbg("Available size: %u", this->_available);
   }
 
   return required_size <= this->_available;
diff --git a/src/proxy/http2/HPACK.cc b/src/proxy/http2/HPACK.cc
index 53e71ec2db..d2dd14be6c 100644
--- a/src/proxy/http2/HPACK.cc
+++ b/src/proxy/http2/HPACK.cc
@@ -196,6 +196,9 @@ constexpr HpackHeaderField STATIC_TABLE[] = {
 constexpr std::string_view HPACK_HDR_FIELD_COOKIE        = STATIC_TABLE[TS_HPACK_STATIC_TABLE_COOKIE].name;
 constexpr std::string_view HPACK_HDR_FIELD_AUTHORIZATION = STATIC_TABLE[TS_HPACK_STATIC_TABLE_AUTHORIZATION].name;
 
+DbgCtl dbg_ctl_hpack_encode{"hpack_encode"};
+DbgCtl dbg_ctl_hpack_decode{"hpack_decode"};
+
 //
 // Local functions
 //
@@ -208,7 +211,7 @@ hpack_field_is_literal(HpackField ftype)
 // Try not to use memcmp(sv, sv) and strncasecmp(sv, sv) because we don't care which value comes first on a dictionary.
 // Return immediately if the lengths of given strings don't match.
 // Also, we noticed with profiling that taking char* and int was more performant than taking std::string_view.
-static inline bool
+inline bool
 match(const char *s1, int s1_len, const char *s2, int s2_len)
 {
   if (s1_len != s2_len) {
@@ -411,7 +414,7 @@ encode_indexed_header_field(uint8_t *buf_start, const uint8_t *buf_end, uint32_t
   *p |= 0x80;
   p  += len;
 
-  Debug("hpack_encode", "Encoded field: %d", index);
+  Dbg(dbg_ctl_hpack_encode, "Encoded field: %d", index);
   return p - buf_start;
 }
 
@@ -464,7 +467,7 @@ encode_literal_header_field_with_indexed_name(uint8_t *buf_start, const uint8_t
   }
   p += len;
 
-  Debug("hpack_encode", "Encoded field: %d: %.*s", index, static_cast<int>(header.value.size()), header.value.data());
+  Dbg(dbg_ctl_hpack_encode, "Encoded field: %d: %.*s", index, static_cast<int>(header.value.size()), header.value.data());
   return p - buf_start;
 }
 
@@ -512,8 +515,8 @@ encode_literal_header_field_with_new_name(uint8_t *buf_start, const uint8_t *buf
 
   p += len;
 
-  Debug("hpack_encode", "Encoded field: %.*s: %.*s", static_cast<int>(header.name.size()), header.name.data(),
-        static_cast<int>(header.value.size()), header.value.data());
+  Dbg(dbg_ctl_hpack_encode, "Encoded field: %.*s: %.*s", static_cast<int>(header.name.size()), header.name.data(),
+      static_cast<int>(header.value.size()), header.value.data());
 
   return p - buf_start;
 }
@@ -549,13 +552,13 @@ decode_indexed_header_field(MIMEFieldWrapper &header, const uint8_t *buf_start,
     return HPACK_ERROR_COMPRESSION_ERROR;
   }
 
-  if (is_debug_tag_set("hpack_decode")) {
+  if (dbg_ctl_hpack_decode.on()) {
     int         decoded_name_len;
     const char *decoded_name = header.name_get(&decoded_name_len);
     int         decoded_value_len;
     const char *decoded_value = header.value_get(&decoded_value_len);
 
-    Debug("hpack_decode", "Decoded field: %.*s: %.*s", decoded_name_len, decoded_name, decoded_value_len, decoded_value);
+    Dbg(dbg_ctl_hpack_decode, "Decoded field: %.*s: %.*s", decoded_name_len, decoded_name, decoded_value_len, decoded_value);
   }
 
   return len;
@@ -640,13 +643,13 @@ decode_literal_header_field(MIMEFieldWrapper &header, const uint8_t *buf_start,
   }
 
   // Print decoded header field
-  if (is_debug_tag_set("hpack_decode")) {
+  if (dbg_ctl_hpack_decode.on()) {
     int         decoded_name_len;
     const char *decoded_name = header.name_get(&decoded_name_len);
     int         decoded_value_len;
     const char *decoded_value = header.value_get(&decoded_value_len);
 
-    Debug("hpack_decode", "Decoded field: %.*s: %.*s", decoded_name_len, decoded_name, decoded_value_len, decoded_value);
+    Dbg(dbg_ctl_hpack_decode, "Decoded field: %.*s: %.*s", decoded_name_len, decoded_name, decoded_value_len, decoded_value);
   }
 
   if (has_http2_violation) {
diff --git a/src/proxy/http2/Http2ClientSession.cc b/src/proxy/http2/Http2ClientSession.cc
index 5cd713e527..2839e37ade 100644
--- a/src/proxy/http2/Http2ClientSession.cc
+++ b/src/proxy/http2/Http2ClientSession.cc
@@ -30,13 +30,19 @@
 
 ClassAllocator<Http2ClientSession, true> http2ClientSessionAllocator("http2ClientSessionAllocator");
 
-static int
+namespace
+{
+DbgCtl dbg_ctl_ssl_early_data{"ssl_early_data"};
+
+int
 send_connection_event(Continuation *cont, int event, void *edata)
 {
   SCOPED_MUTEX_LOCK(lock, cont->mutex, this_ethread());
   return cont->handleEvent(event, edata);
 }
 
+} // end anonymous namespace
+
 Http2ClientSession::Http2ClientSession() : super() {}
 
 void
@@ -103,7 +109,7 @@ Http2ClientSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOB
 
   if (auto eds = new_vc->get_service<TLSEarlyDataSupport>(); eds) {
     this->read_from_early_data = eds->get_early_data_len();
-    Debug("ssl_early_data", "read_from_early_data = %" PRId64, this->read_from_early_data);
+    Dbg(dbg_ctl_ssl_early_data, "read_from_early_data = %" PRId64, this->read_from_early_data);
   }
 
   Http2SsnDebug("session born, netvc %p", this->_vc);
diff --git a/src/proxy/http2/Http2CommonSession.cc b/src/proxy/http2/Http2CommonSession.cc
index abc3c41aaf..7a46d37712 100644
--- a/src/proxy/http2/Http2CommonSession.cc
+++ b/src/proxy/http2/Http2CommonSession.cc
@@ -24,18 +24,23 @@
 #include "proxy/http2/Http2CommonSession.h"
 #include "proxy/http/HttpDebugNames.h"
 
+namespace
+{
+DbgCtl dbg_ctl_http2_cs{"http2_cs"};
+
 #define REMEMBER(e, r)                          \
   {                                             \
     this->remember(MakeSourceLocation(), e, r); \
   }
 
-#define STATE_ENTER(state_name, event)                                                                                          \
-  do {                                                                                                                          \
-    REMEMBER(event, this->recursion)                                                                                            \
-    Debug("http2_cs", "[%" PRId64 "] [%s, %s]", this->get_connection_id(), #state_name, HttpDebugNames::get_event_name(event)); \
+#define STATE_ENTER(state_name, event)                                                      \
+  do {                                                                                      \
+    REMEMBER(event, this->recursion)                                                        \
+    Dbg(dbg_ctl_http2_cs, "[%" PRId64 "] [%s, %s]", this->get_connection_id(), #state_name, \
+        HttpDebugNames::get_event_name(event));                                             \
   } while (0)
 
-#define Http2SsnDebug(fmt, ...) Debug("http2_cs", "[%" PRId64 "] " fmt, this->get_connection_id(), ##__VA_ARGS__)
+#define Http2SsnDebug(fmt, ...) Dbg(dbg_ctl_http2_cs, "[%" PRId64 "] " fmt, this->get_connection_id(), ##__VA_ARGS__)
 
 #define HTTP2_SET_SESSION_HANDLER(handler) \
   do {                                     \
@@ -45,7 +50,7 @@
 
 // memcpy the requested bytes from the IOBufferReader, returning how many were
 // actually copied.
-static inline unsigned
+inline unsigned
 copy_from_buffer_reader(void *dst, IOBufferReader *reader, unsigned nbytes)
 {
   char *end;
@@ -54,6 +59,8 @@ copy_from_buffer_reader(void *dst, IOBufferReader *reader, unsigned nbytes)
   return end - static_cast<char *>(dst);
 }
 
+} // end anonymous namespace
+
 void
 Http2CommonSession::remember(const SourceLocation &location, int event, int reentrant)
 {
diff --git a/src/proxy/http2/Http2ConnectionState.cc b/src/proxy/http2/Http2ConnectionState.cc
index 62645b758a..4baaa52b52 100644
--- a/src/proxy/http2/Http2ConnectionState.cc
+++ b/src/proxy/http2/Http2ConnectionState.cc
@@ -44,6 +44,11 @@
 #include <sstream>
 #include <numeric>
 
+namespace
+{
+DbgCtl dbg_ctl_http2_con{"http2_con"};
+DbgCtl dbg_ctl_http2_priority{"http2_priority"};
+
 #define REMEMBER(e, r)                                     \
   {                                                        \
     if (this->session) {                                   \
@@ -51,12 +56,12 @@
     }                                                      \
   }
 
-#define Http2ConDebug(session, fmt, ...) Debug("http2_con", "[%" PRId64 "] " fmt, session->get_connection_id(), ##__VA_ARGS__);
+#define Http2ConDebug(session, fmt, ...) Dbg(dbg_ctl_http2_con, "[%" PRId64 "] " fmt, session->get_connection_id(), ##__VA_ARGS__);
 
 #define Http2StreamDebug(session, stream_id, fmt, ...) \
-  Debug("http2_con", "[%" PRId64 "] [%u] " fmt, session->get_connection_id(), stream_id, ##__VA_ARGS__);
+  Dbg(dbg_ctl_http2_con, "[%" PRId64 "] [%u] " fmt, session->get_connection_id(), stream_id, ##__VA_ARGS__);
 
-static const int buffer_size_index[HTTP2_FRAME_TYPE_MAX] = {
+const int buffer_size_index[HTTP2_FRAME_TYPE_MAX] = {
   BUFFER_SIZE_INDEX_16K, // HTTP2_FRAME_TYPE_DATA
   BUFFER_SIZE_INDEX_16K, // HTTP2_FRAME_TYPE_HEADERS
   -1,                    // HTTP2_FRAME_TYPE_PRIORITY
@@ -69,7 +74,7 @@ static const int buffer_size_index[HTTP2_FRAME_TYPE_MAX] = {
   BUFFER_SIZE_INDEX_16K, // HTTP2_FRAME_TYPE_CONTINUATION
 };
 
-inline static unsigned
+inline unsigned
 read_rcv_buffer(char *buf, size_t bufsize, unsigned &nbytes, const Http2Frame &frame)
 {
   char *end;
@@ -84,6 +89,8 @@ read_rcv_buffer(char *buf, size_t bufsize, unsigned &nbytes, const Http2Frame &f
   return end - buf;
 }
 
+} // end anonymous namespace
+
 Http2Error
 Http2ConnectionState::rcv_data_frame(const Http2Frame &frame)
 {
@@ -195,7 +202,7 @@ Http2ConnectionState::rcv_data_frame(const Http2Frame &frame)
   // Update stream window size
   stream->decrement_local_rwnd(payload_length);
 
-  if (is_debug_tag_set("http2_con")) {
+  if (dbg_ctl_http2_con.on()) {
     uint32_t const stream_window  = this->acknowledged_local_settings.get(HTTP2_SETTINGS_INITIAL_WINDOW_SIZE);
     uint32_t const session_window = this->_get_configured_receive_session_window_size();
     Http2StreamDebug(this->session, id,
@@ -582,10 +589,10 @@ Http2ConnectionState::rcv_priority_frame(const Http2Frame &frame)
     // [RFC 7540] 5.3.3 Reprioritization
     Http2StreamDebug(this->session, stream_id, "Reprioritize");
     this->dependency_tree->reprioritize(node, priority.stream_dependency, priority.exclusive_flag);
-    if (is_debug_tag_set("http2_priority")) {
+    if (dbg_ctl_http2_priority.on()) {
       std::stringstream output;
       this->dependency_tree->dump_tree(output);
-      Debug("http2_priority", "[%" PRId64 "] reprioritize %s", this->session->get_connection_id(), output.str().c_str());
+      Dbg(dbg_ctl_http2_priority, "[%" PRId64 "] reprioritize %s", this->session->get_connection_id(), output.str().c_str());
     }
   } else {
     // PRIORITY frame is received before HEADERS frame.
@@ -1966,10 +1973,10 @@ Http2ConnectionState::delete_stream(Http2Stream *stream)
       if (node->active) {
         dependency_tree->deactivate(node, 0);
       }
-      if (is_debug_tag_set("http2_priority")) {
+      if (dbg_ctl_http2_priority.on()) {
         std::stringstream output;
         dependency_tree->dump_tree(output);
-        Debug("http2_priority", "[%" PRId64 "] %s", session->get_connection_id(), output.str().c_str());
+        Dbg(dbg_ctl_http2_priority, "[%" PRId64 "] %s", session->get_connection_id(), output.str().c_str());
       }
       dependency_tree->remove(node);
       // ink_release_assert(dependency_tree->find(stream->get_id()) == nullptr);
diff --git a/src/proxy/http2/Http2SessionAccept.cc b/src/proxy/http2/Http2SessionAccept.cc
index 53e84fe64e..8d9449a37d 100644
--- a/src/proxy/http2/Http2SessionAccept.cc
+++ b/src/proxy/http2/Http2SessionAccept.cc
@@ -26,6 +26,12 @@
 #include "iocore/utils/Machine.h"
 #include "proxy/IPAllow.h"
 
+namespace
+{
+DbgCtl dbg_ctl_http2_seq{"http2_seq"};
+
+} // end anonymous namespace
+
 Http2SessionAccept::Http2SessionAccept(const HttpSessionAccept::Options &_o) : SessionAccept(nullptr), options(_o)
 {
   SET_HANDLER(&Http2SessionAccept::mainEvent);
@@ -46,11 +52,11 @@ Http2SessionAccept::accept(NetVConnection *netvc, MIOBuffer *iobuf, IOBufferRead
 
   netvc->attributes = this->options.transport_type;
 
-  if (is_debug_tag_set("http2_seq")) {
+  if (dbg_ctl_http2_seq.on()) {
     ip_port_text_buffer ipb;
 
-    Debug("http2_seq", "[HttpSessionAccept2:mainEvent %p] accepted connection from %s transport type = %d", netvc,
-          ats_ip_nptop(client_ip, ipb, sizeof(ipb)), netvc->attributes);
+    DbgPrint(dbg_ctl_http2_seq, "[HttpSessionAccept2:mainEvent %p] accepted connection from %s transport type = %d", netvc,
+             ats_ip_nptop(client_ip, ipb, sizeof(ipb)), netvc->attributes);
   }
 
   Http2ClientSession *new_session = THREAD_ALLOC_INIT(http2ClientSessionAllocator, this_ethread());
diff --git a/src/proxy/logging/Log.cc b/src/proxy/logging/Log.cc
index 795421e967..2b884393ec 100644
--- a/src/proxy/logging/Log.cc
+++ b/src/proxy/logging/Log.cc
@@ -87,8 +87,17 @@ LogsStatsBlock log_rsb;
   to be changed (as the result of a manager callback).
   -------------------------------------------------------------------------*/
 
-LogConfig      *Log::config  = nullptr;
-static unsigned log_configid = 0;
+LogConfig *Log::config = nullptr;
+
+namespace
+{
+DbgCtl dbg_ctl_log_config{"log-config"};
+DbgCtl dbg_ctl_log_api_mutex{"log-api-mutex"};
+DbgCtl dbg_ctl_log_periodic{"log-periodic"};
+DbgCtl dbg_ctl_log{"log"};
+DbgCtl dbg_ctl_log_preproc{"log-preproc"};
+
+unsigned log_configid = 0;
 
 // Downcast from a Ptr<LogFieldAliasTable> to a Ptr<LogFieldAliasMap>.
 static Ptr<LogFieldAliasMap>
@@ -97,13 +106,15 @@ make_alias_map(Ptr<LogFieldAliasTable> &table)
   return make_ptr(static_cast<LogFieldAliasMap *>(table.get()));
 }
 
+} // end anonymous namespace
+
 void
 Log::change_configuration()
 {
   LogConfig *prev_config = Log::config;
   LogConfig *new_config  = nullptr;
 
-  Debug("log-config", "Changing configuration ...");
+  Dbg(dbg_ctl_log_config, "Changing configuration ...");
 
   new_config = new LogConfig;
   ink_assert(new_config != nullptr);
@@ -113,7 +124,7 @@ Log::change_configuration()
   // the new config
   //
   ink_mutex_acquire(prev_config->log_object_manager._APImutex);
-  Debug("log-api-mutex", "Log::change_configuration acquired api mutex");
+  Dbg(dbg_ctl_log_api_mutex, "Log::change_configuration acquired api mutex");
 
   new_config->init(prev_config);
 
@@ -127,7 +138,7 @@ Log::change_configuration()
   // Server would crash the next time the plugin referenced the freed object.
 
   ink_mutex_release(prev_config->log_object_manager._APImutex);
-  Debug("log-api-mutex", "Log::change_configuration released api mutex");
+  Dbg(dbg_ctl_log_api_mutex, "Log::change_configuration released api mutex");
 
   // Register the new config in the config processor; the old one will now be scheduled for a
   // future deletion. We don't need to do anything magical with refcounts, since the
@@ -138,7 +149,7 @@ Log::change_configuration()
   // objects that weren't transferred to the new config ...
   prev_config->log_object_manager.flush_all_objects();
 
-  Debug("log-config", "... new configuration in place");
+  Dbg(dbg_ctl_log_config, "... new configuration in place");
 }
 
 /*-------------------------------------------------------------------------
@@ -198,10 +209,10 @@ struct PeriodicWakeup : Continuation {
 void
 Log::periodic_tasks(long time_now)
 {
-  Debug("log-api-mutex", "entering Log::periodic_tasks");
+  Dbg(dbg_ctl_log_api_mutex, "entering Log::periodic_tasks");
 
   if (logging_mode_changed || Log::config->reconfiguration_needed) {
-    Debug("log-config", "Performing reconfiguration, init status = %d", init_status);
+    Dbg(dbg_ctl_log_config, "Performing reconfiguration, init status = %d", init_status);
 
     if (logging_mode_changed) {
       int val = static_cast<int>(REC_ConfigReadInteger("proxy.config.log.logging_enabled"));
@@ -221,8 +232,8 @@ Log::periodic_tasks(long time_now)
     //
     change_configuration();
   } else if (logging_mode > LOG_MODE_NONE || config->has_api_objects()) {
-    Debug("log-periodic", "Performing periodic tasks");
-    Debug("log-periodic", "Periodic task interval = %d", periodic_tasks_interval);
+    Dbg(dbg_ctl_log_periodic, "Performing periodic tasks");
+    Dbg(dbg_ctl_log_periodic, "Periodic task interval = %d", periodic_tasks_interval);
 
     // Check if space is ok and update the space used
     //
@@ -993,7 +1004,7 @@ int
 Log::handle_logging_mode_change(const char * /* name ATS_UNUSED */, RecDataT /* data_type ATS_UNUSED */,
                                 RecData /* data ATS_UNUSED */, void * /* cookie ATS_UNUSED */)
 {
-  Debug("log-config", "Enabled status changed");
+  Dbg(dbg_ctl_log_config, "Enabled status changed");
   logging_mode_changed = true;
   return 0;
 }
@@ -1002,14 +1013,14 @@ int
 Log::handle_periodic_tasks_int_change(const char * /* name ATS_UNUSED */, RecDataT /* data_type ATS_UNUSED */, RecData data,
                                       void * /* cookie ATS_UNSED */)
 {
-  Debug("log-periodic", "periodic task interval changed");
+  Dbg(dbg_ctl_log_periodic, "periodic task interval changed");
   if (data.rec_int <= 0) {
     periodic_tasks_interval = PERIODIC_TASKS_INTERVAL_FALLBACK;
     Error("new periodic tasks interval = %d is invalid, falling back to default = %d", (int)data.rec_int,
           PERIODIC_TASKS_INTERVAL_FALLBACK);
   } else {
     periodic_tasks_interval = static_cast<uint32_t>(data.rec_int);
-    Debug("log-periodic", "periodic task interval changed to %u", periodic_tasks_interval);
+    Dbg(dbg_ctl_log_periodic, "periodic task interval changed to %u", periodic_tasks_interval);
   }
   return REC_ERR_OKAY;
 }
@@ -1017,7 +1028,7 @@ Log::handle_periodic_tasks_int_change(const char * /* name ATS_UNUSED */, RecDat
 int
 Log::handle_log_rotation_request()
 {
-  Debug("log", "Request to reopen rotated log files.");
+  Dbg(dbg_ctl_log, "Request to reopen rotated log files.");
   log_rotate_signal_received = true;
   return 0;
 }
@@ -1078,7 +1089,7 @@ Log::init(int flags)
 
   init_fields();
   if (!(config_flags & LOGCAT)) {
-    Debug("log-config", "Log::init(): logging_mode = %d init status = %d", logging_mode, init_status);
+    Dbg(dbg_ctl_log_config, "Log::init(): logging_mode = %d init status = %d", logging_mode, init_status);
     config->init();
     init_when_enabled();
   }
@@ -1105,7 +1116,7 @@ Log::init_when_enabled()
   }
 
   Note("logging initialized[%d], logging_mode = %d", init_status, logging_mode);
-  if (is_debug_tag_set("log-config")) {
+  if (dbg_ctl_log_config.on()) {
     config->display();
   }
 }
@@ -1169,18 +1180,18 @@ Log::access(LogAccess *lad)
   if (Log::config->sampling_frequency > 1) {
     this_sample = sample++;
     if (this_sample && this_sample % Log::config->sampling_frequency) {
-      Debug("log", "sampling, skipping this entry ...");
+      Dbg(dbg_ctl_log, "sampling, skipping this entry ...");
       Metrics::Counter::increment(log_rsb.event_log_access_skip);
       ret = Log::SKIP;
       goto done;
     } else {
-      Debug("log", "sampling, LOGGING this entry ...");
+      Dbg(dbg_ctl_log, "sampling, LOGGING this entry ...");
       sample = 1;
     }
   }
 
   if (Log::config->log_object_manager.get_num_objects() == 0) {
-    Debug("log", "no log objects, skipping this entry ...");
+    Dbg(dbg_ctl_log, "no log objects, skipping this entry ...");
     Metrics::Counter::increment(log_rsb.event_log_access_skip);
     ret = Log::SKIP;
     goto done;
@@ -1264,7 +1275,7 @@ Log::preproc_thread_main(void *args)
 {
   int idx = *static_cast<int *>(args);
 
-  Debug("log-preproc", "log preproc thread is alive ...");
+  Dbg(dbg_ctl_log_preproc, "log preproc thread is alive ...");
 
   Log::preproc_notify[idx].lock();
 
@@ -1280,8 +1291,8 @@ Log::preproc_thread_main(void *args)
       // config->increment_space_used(bytes_to_disk);
       // TODO: the bytes_to_disk should be set to Log
 
-      Debug("log-preproc", "%zu buffers preprocessed from LogConfig %p (refcount=%d) this round", buffers_preproced, current,
-            current->refcount());
+      Dbg(dbg_ctl_log_preproc, "%zu buffers preprocessed from LogConfig %p (refcount=%d) this round", buffers_preproced, current,
+          current->refcount());
 
       configProcessor.release(log_configid, current);
     }
@@ -1362,8 +1373,8 @@ Log::flush_thread_main(void * /* args ATS_UNUSED */)
       //
       while (total_bytes - bytes_written) {
         if (Log::config->logging_space_exhausted) {
-          Debug("log", "logging space exhausted, failed to write file:%s, have dropped (%d) bytes.", logfile->get_name(),
-                (total_bytes - bytes_written));
+          Dbg(dbg_ctl_log, "logging space exhausted, failed to write file:%s, have dropped (%d) bytes.", logfile->get_name(),
+              (total_bytes - bytes_written));
 
           Metrics::Counter::increment(log_rsb.bytes_lost_before_written_to_disk, total_bytes - bytes_written);
           break;
@@ -1378,7 +1389,7 @@ Log::flush_thread_main(void * /* args ATS_UNUSED */)
           Metrics::Counter::increment(log_rsb.bytes_lost_before_written_to_disk, total_bytes - bytes_written);
           break;
         }
-        Debug("log", "Successfully wrote some stuff to %s", logfile->get_name());
+        Dbg(dbg_ctl_log, "Successfully wrote some stuff to %s", logfile->get_name());
         bytes_written += len;
       }
 
@@ -1395,7 +1406,7 @@ Log::flush_thread_main(void * /* args ATS_UNUSED */)
     //
     now = ink_get_hrtime() / HRTIME_SECOND;
     if (now >= last_time + periodic_tasks_interval) {
-      Debug("log-preproc", "periodic tasks for %" PRId64, (int64_t)now);
+      Dbg(dbg_ctl_log_preproc, "periodic tasks for %" PRId64, (int64_t)now);
       periodic_tasks(now);
       last_time = ink_get_hrtime() / HRTIME_SECOND;
     }
diff --git a/src/proxy/logging/LogAccess.cc b/src/proxy/logging/LogAccess.cc
index d8ced3a9cd..b14126a0fb 100644
--- a/src/proxy/logging/LogAccess.cc
+++ b/src/proxy/logging/LogAccess.cc
@@ -44,6 +44,13 @@ char INVALID_STR[] = "!INVALID_STR!";
 //
 #define MARSHAL_RECORD_LENGTH 32
 
+namespace
+{
+DbgCtl dbg_ctl_log_escape{"log-escape"};
+DbgCtl dbg_ctl_log_resolve{"log-resolve"};
+
+} // end anonymous namespace
+
 /*-------------------------------------------------------------------------
   LogAccess
 
@@ -710,7 +717,7 @@ escape_json(char *dest, const char *buf, int len)
 int
 unmarshal_str_json(char **buf, char *dest, int len, LogSlice *slice)
 {
-  Debug("log-escape", "unmarshal_str_json start, len=%d, slice=%p", len, slice);
+  Dbg(dbg_ctl_log_escape, "unmarshal_str_json start, len=%d, slice=%p", len, slice);
 
   char *val_buf     = *buf;
   int   val_len     = static_cast<int>(::strlen(val_buf));
@@ -722,7 +729,7 @@ unmarshal_str_json(char **buf, char *dest, int len, LogSlice *slice)
     int offset, n;
 
     n = slice->toStrOffset(escaped_len, &offset);
-    Debug("log-escape", "unmarshal_str_json start, n=%d, offset=%d", n, offset);
+    Dbg(dbg_ctl_log_escape, "unmarshal_str_json start, n=%d, offset=%d", n, offset);
     if (n <= 0) {
       return 0;
     }
@@ -1181,16 +1188,16 @@ char *
 resolve_logfield_string(LogAccess *context, const char *format_str)
 {
   if (!context) {
-    Debug("log-resolve", "No context to resolve?");
+    Dbg(dbg_ctl_log_resolve, "No context to resolve?");
     return nullptr;
   }
 
   if (!format_str) {
-    Debug("log-resolve", "No format to resolve?");
+    Dbg(dbg_ctl_log_resolve, "No format to resolve?");
     return nullptr;
   }
 
-  Debug("log-resolve", "Resolving: %s", format_str);
+  Dbg(dbg_ctl_log_resolve, "Resolving: %s", format_str);
 
   //
   // Divide the format string into two parts: one for the printf-style
@@ -1205,14 +1212,14 @@ resolve_logfield_string(LogAccess *context, const char *format_str)
   // format_str. Nothing to free here either.
   //
   if (!n_fields) {
-    Debug("log-resolve", "No fields found; returning copy of format_str");
+    Dbg(dbg_ctl_log_resolve, "No fields found; returning copy of format_str");
     ats_free(printf_str);
     ats_free(fields_str);
     return ats_strdup(format_str);
   }
 
-  Debug("log-resolve", "%d fields: %s", n_fields, fields_str);
-  Debug("log-resolve", "printf string: %s", printf_str);
+  Dbg(dbg_ctl_log_resolve, "%d fields: %s", n_fields, fields_str);
+  Dbg(dbg_ctl_log_resolve, "printf string: %s", printf_str);
 
   LogFieldList fields;
   bool         contains_aggregates;
@@ -1229,14 +1236,14 @@ resolve_logfield_string(LogAccess *context, const char *format_str)
   // temporary storage buffer.  Make sure the LogAccess context is
   // initialized first.
   //
-  Debug("log-resolve", "Marshaling data from LogAccess into buffer ...");
+  Dbg(dbg_ctl_log_resolve, "Marshaling data from LogAccess into buffer ...");
   context->init();
   unsigned bytes_needed = fields.marshal_len(context);
   char    *buf          = static_cast<char *>(ats_malloc(bytes_needed));
   unsigned bytes_used   = fields.marshal(context, buf);
 
   ink_assert(bytes_needed == bytes_used);
-  Debug("log-resolve", "    %u bytes marshalled", bytes_used);
+  Dbg(dbg_ctl_log_resolve, "    %u bytes marshalled", bytes_used);
 
   //
   // Now we can "unmarshal" the data from the buffer into a string,
diff --git a/src/proxy/logging/LogBuffer.cc b/src/proxy/logging/LogBuffer.cc
index 8b6d03f31b..600f389f2f 100644
--- a/src/proxy/logging/LogBuffer.cc
+++ b/src/proxy/logging/LogBuffer.cc
@@ -57,6 +57,13 @@ FieldListCacheElement fieldlist_cache[FIELDLIST_CACHE_SIZE];
 int                   fieldlist_cache_entries = 0;
 int32_t               LogBuffer::M_ID;
 
+namespace
+{
+DbgCtl dbg_ctl_log_logbuffer{"log-logbuffer"};
+DbgCtl dbg_ctl_log_fieldlist{"log-fieldlist"};
+
+} // end anonymous namespace
+
 /*-------------------------------------------------------------------------
   The following LogBufferHeader routines are used to grab strings out from
   the data section using the offsets held in the buffer header.
@@ -131,8 +138,8 @@ LogBuffer::LogBuffer(const LogConfig *cfg, LogObject *owner, size_t size, size_t
 
   m_expiration_time = LogUtils::timestamp() + cfg->max_secs_per_buffer;
 
-  Debug("log-logbuffer", "[%p] Created buffer %u for %s at address %p, size %d", this_ethread(), m_id, m_owner->get_base_filename(),
-        m_buffer, (int)size);
+  Dbg(dbg_ctl_log_logbuffer, "[%p] Created buffer %u for %s at address %p, size %d", this_ethread(), m_id,
+      m_owner->get_base_filename(), m_buffer, (int)size);
 }
 
 LogBuffer::LogBuffer(LogObject *owner, LogBufferHeader *header)
@@ -156,8 +163,8 @@ LogBuffer::LogBuffer(LogObject *owner, LogBufferHeader *header)
   //
   m_id = static_cast<uint32_t>(ink_atomic_increment(&M_ID, 1));
 
-  Debug("log-logbuffer", "[%p] Created repurposed buffer %u for %s at address %p", this_ethread(), m_id,
-        m_owner->get_base_filename(), m_buffer);
+  Dbg(dbg_ctl_log_logbuffer, "[%p] Created repurposed buffer %u for %s at address %p", this_ethread(), m_id,
+      m_owner->get_base_filename(), m_buffer);
 }
 
 void
@@ -171,7 +178,7 @@ LogBuffer::freeLogBuffer()
     log_buffer = m_buffer;
   }
   if (log_buffer) {
-    Debug("log-logbuffer", "[%p] Deleting buffer %u at address %p", this_ethread(), m_id, log_buffer);
+    Dbg(dbg_ctl_log_logbuffer, "[%p] Deleting buffer %u at address %p", this_ethread(), m_id, log_buffer);
     if (m_buffer_fast_allocator_size >= 0) {
       ioBufAllocator[m_buffer_fast_allocator_size].free_void(log_buffer);
     } else {
@@ -319,7 +326,7 @@ LogBuffer::checkout_write(size_t *write_offset, size_t write_size)
 
     *write_offset = offset + sizeof(LogEntryHeader);
   }
-  //    Debug("log-logbuffer","[%p] %s for buffer %u (%s) returning %d",
+  //    Dbg(dbg_ctl_log_logbuffer,"[%p] %s for buffer %u (%s) returning %d",
   //        this_ethread(),
   //        (write_offset ? "checkout_write" : "force_new_buffer"),
   //        m_id, m_owner->get_base_filename(), ret_val);
@@ -356,7 +363,7 @@ LogBuffer::checkin_write(size_t write_offset)
     }
   } while (!switch_state(old_s, new_s));
 
-  //    Debug("log-logbuffer","[%p] checkin_write for buffer %u (%s) "
+  //    Dbg(dbg_ctl_log_logbuffer,"[%p] checkin_write for buffer %u (%s) "
   //        "returning %d (%u writers left)", this_ethread(),
   //        m_id, m_owner->get_base_filename(), ret_val, writers_left);
 
@@ -617,21 +624,21 @@ LogBuffer::to_ascii(LogEntryHeader *entry, LogFormatType type, char *buf, int bu
 
   for (i = 0; i < fieldlist_cache_entries; i++) {
     if (strcmp(symbol_str, fieldlist_cache[i].symbol_str) == 0) {
-      Debug("log-fieldlist", "Fieldlist for %s found in cache, #%d", symbol_str, i);
+      Dbg(dbg_ctl_log_fieldlist, "Fieldlist for %s found in cache, #%d", symbol_str, i);
       fieldlist = fieldlist_cache[i].fieldlist;
       break;
     }
   }
 
   if (!fieldlist) {
-    Debug("log-fieldlist", "Fieldlist for %s not found; creating ...", symbol_str);
+    Dbg(dbg_ctl_log_fieldlist, "Fieldlist for %s not found; creating ...", symbol_str);
     fieldlist = new LogFieldList;
     ink_assert(fieldlist != nullptr);
     bool contains_aggregates = false;
     LogFormat::parse_symbol_string(symbol_str, fieldlist, &contains_aggregates);
 
     if (fieldlist_cache_entries < FIELDLIST_CACHE_SIZE) {
-      Debug("log-fieldlist", "Fieldlist cached as entry %d", fieldlist_cache_entries);
+      Dbg(dbg_ctl_log_fieldlist, "Fieldlist cached as entry %d", fieldlist_cache_entries);
       fieldlist_cache[fieldlist_cache_entries].fieldlist  = fieldlist;
       fieldlist_cache[fieldlist_cache_entries].symbol_str = ats_strdup(symbol_str);
       fieldlist_cache_entries++;
diff --git a/src/proxy/logging/LogConfig.cc b/src/proxy/logging/LogConfig.cc
index 0ef4db6ff7..1c542e494b 100644
--- a/src/proxy/logging/LogConfig.cc
+++ b/src/proxy/logging/LogConfig.cc
@@ -62,6 +62,14 @@
 #define DIAGS_LOG_FILENAME    "diags.log"
 #define MANAGER_LOG_FILENAME  "manager.log"
 
+namespace
+{
+DbgCtl dbg_ctl_logspace{"logspace"};
+DbgCtl dbg_ctl_log{"log"};
+DbgCtl dbg_ctl_log_config{"log-config"};
+
+} // end anonymous namespace
+
 void
 LogConfig::reconfigure_mgmt_variables(swoc::MemSpan<void>)
 {
@@ -77,8 +85,8 @@ LogConfig::register_rolled_log_auto_delete(std::string_view logname, int rolling
     return;
   }
 
-  Debug("logspace", "Registering rotated log deletion for %s with min roll count %d", std::string(logname).c_str(),
-        rolling_min_count);
+  Dbg(dbg_ctl_logspace, "Registering rotated log deletion for %s with min roll count %d", std::string(logname).c_str(),
+      rolling_min_count);
   rolledLogDeleter.register_log_type_for_deletion(logname, rolling_min_count);
 }
 
@@ -298,7 +306,7 @@ LogConfig::init(LogConfig *prev_config)
   if (Log::error_logging_enabled()) {
     std::unique_ptr<LogFormat> fmt(MakeTextLogFormat("error"));
 
-    Debug("log", "creating predefined error log object");
+    Dbg(dbg_ctl_log, "creating predefined error log object");
 
     errlog = new LogObject(this, fmt.get(), logfile_dir, error_log_filename, LOG_FILE_ASCII, nullptr, rolling_enabled,
                            preproc_threads, rolling_interval_sec, rolling_offset_hr, rolling_size_mb, /* auto_created */ false,
@@ -385,7 +393,7 @@ LogConfig::display(FILE *fd)
 void
 LogConfig::setup_log_objects()
 {
-  Debug("log", "creating objects...");
+  Dbg(dbg_ctl_log, "creating objects...");
 
   filter_list.clear();
 
@@ -395,7 +403,7 @@ LogConfig::setup_log_objects()
   // Open local pipes so readers can see them.
   log_object_manager.open_local_pipes();
 
-  if (is_debug_tag_set("log")) {
+  if (dbg_ctl_log.on()) {
     log_object_manager.display();
   }
 }
@@ -414,7 +422,7 @@ int
 LogConfig::reconfigure(const char * /* name ATS_UNUSED */, RecDataT /* data_type ATS_UNUSED */, RecData /* data ATS_UNUSED */,
                        void * /* cookie ATS_UNUSED */)
 {
-  Debug("log-config", "Reconfiguration request accepted");
+  Dbg(dbg_ctl_log_config, "Reconfiguration request accepted");
   Log::config->reconfiguration_needed = true;
   return 0;
 }
@@ -521,10 +529,10 @@ LogConfig::space_to_write(int64_t bytes_to_write) const
 
   space = ((logical_space_used < config_space) && (physical_space_left > partition_headroom));
 
-  Debug("logspace",
-        "logical space used %" PRId64 ", configured space %" PRId64 ", physical space left %" PRId64 ", partition headroom %" PRId64
-        ", space %s available",
-        logical_space_used, config_space, physical_space_left, partition_headroom, space ? "is" : "is not");
+  Dbg(dbg_ctl_logspace,
+      "logical space used %" PRId64 ", configured space %" PRId64 ", physical space left %" PRId64 ", partition headroom %" PRId64
+      ", space %s available",
+      logical_space_used, config_space, physical_space_left, partition_headroom, space ? "is" : "is not");
 
   return space;
 }
@@ -624,8 +632,8 @@ LogConfig::update_space_used()
   m_partition_space_left = partition_space_left;
   Metrics::Gauge::store(log_rsb.log_files_space_used, m_space_used);
 
-  Debug("logspace", "%" PRId64 " bytes being used for logs", m_space_used);
-  Debug("logspace", "%" PRId64 " bytes left on partition", m_partition_space_left);
+  Dbg(dbg_ctl_logspace, "%" PRId64 " bytes being used for logs", m_space_used);
+  Dbg(dbg_ctl_logspace, "%" PRId64 " bytes left on partition", m_partition_space_left);
 
   //
   // Now that we have an accurate picture of the amount of space being
@@ -642,16 +650,16 @@ LogConfig::update_space_used()
   int64_t headroom  = static_cast<int64_t>(max_space_mb_headroom) * LOG_MEGABYTE;
 
   if (!space_to_write(headroom)) {
-    Debug("logspace", "headroom reached, trying to clear space ...");
+    Dbg(dbg_ctl_logspace, "headroom reached, trying to clear space ...");
     if (!rolledLogDeleter.has_candidates()) {
       Note("Cannot clear space because there are no recognized Traffic Server rolled logs for auto deletion.");
     } else {
-      Debug("logspace", "Considering %zu delete candidates ...", rolledLogDeleter.get_candidate_count());
+      Dbg(dbg_ctl_logspace, "Considering %zu delete candidates ...", rolledLogDeleter.get_candidate_count());
     }
 
     while (rolledLogDeleter.has_candidates()) {
       if (space_to_write(headroom + log_buffer_size)) {
-        Debug("logspace", "low water mark reached; stop deleting");
+        Dbg(dbg_ctl_logspace, "low water mark reached; stop deleting");
         break;
       }
 
@@ -659,19 +667,19 @@ LogConfig::update_space_used()
       // Check if any candidate exists
       if (!victim) {
         // This shouldn't be triggered unless min_count are configured wrong or extra non-log files occupy the directory
-        Debug("logspace", "No more victims. Check your rolling_min_count settings and logging directory.");
+        Dbg(dbg_ctl_logspace, "No more victims. Check your rolling_min_count settings and logging directory.");
       } else {
-        Debug("logspace", "auto-deleting %s", victim->rolled_log_path.c_str());
+        Dbg(dbg_ctl_logspace, "auto-deleting %s", victim->rolled_log_path.c_str());
 
         if (unlink(victim->rolled_log_path.c_str()) < 0) {
           Note("Traffic Server was unable to auto-delete rolled "
                "logfile %s: %s.",
                victim->rolled_log_path.c_str(), strerror(errno));
         } else {
-          Debug("logspace",
-                "The rolled logfile, %s, was auto-deleted; "
-                "%" PRId64 " bytes were reclaimed.",
-                victim->rolled_log_path.c_str(), victim->size);
+          Dbg(dbg_ctl_logspace,
+              "The rolled logfile, %s, was auto-deleted; "
+              "%" PRId64 " bytes were reclaimed.",
+              victim->rolled_log_path.c_str(), victim->size);
 
           // Update after successful unlink;
           m_space_used           -= victim->size;
diff --git a/src/proxy/logging/LogField.cc b/src/proxy/logging/LogField.cc
index 1bdbf71625..9e02c4c721 100644
--- a/src/proxy/logging/LogField.cc
+++ b/src/proxy/logging/LogField.cc
@@ -39,9 +39,12 @@
 #include "proxy/logging/LogAccess.h"
 #include "proxy/logging/Log.h"
 
+namespace
+{
+
 // clang-format off
 //
-static const char *container_names[] = {
+const char *container_names[] = {
   "not-a-container",
   "cqh",
   "psh",
@@ -60,7 +63,7 @@ static const char *container_names[] = {
   "msdms",
 };
 
-static const char *aggregate_names[] = {
+const char *aggregate_names[] = {
   "not-an-agg-op",
   "COUNT",
   "SUM",
@@ -69,6 +72,11 @@ static const char *aggregate_names[] = {
   "LAST",
 };
 
+DbgCtl dbg_ctl_log_agg{"log-agg"};
+DbgCtl dbg_ctl_log_field_hash{"log-field-hash"};
+
+} // end anonymous namespace
+
 // clang-format on
 
 LogSlice::LogSlice(char *str)
@@ -678,10 +686,10 @@ LogField::update_aggregate(int64_t val)
     return;
   }
 
-  Debug("log-agg",
-        "Aggregate field %s updated with val %" PRId64 ", "
-        "new val = %" PRId64 ", cnt = %" PRId64 "",
-        m_symbol, val, m_agg_val, m_agg_cnt);
+  Dbg(dbg_ctl_log_agg,
+      "Aggregate field %s updated with val %" PRId64 ", "
+      "new val = %" PRId64 ", cnt = %" PRId64 "",
+      m_symbol, val, m_agg_val, m_agg_cnt);
 }
 
 LogField::Container
@@ -790,7 +798,7 @@ LogFieldList::find_by_symbol(const char *symbol) const
 
   if (auto it = Log::field_symbol_hash.find(symbol); it != Log::field_symbol_hash.end() && it->second) {
     field = it->second;
-    Debug("log-field-hash", "Field %s found", field->symbol());
+    Dbg(dbg_ctl_log_field_hash, "Field %s found", field->symbol());
     return field;
   }
   // trusty old method
diff --git a/src/proxy/logging/LogFile.cc b/src/proxy/logging/LogFile.cc
index 1f3caea3ca..b235045c76 100644
--- a/src/proxy/logging/LogFile.cc
+++ b/src/proxy/logging/LogFile.cc
@@ -55,6 +55,13 @@
 #include "proxy/logging/LogConfig.h"
 #include "proxy/logging/Log.h"
 
+namespace
+{
+DbgCtl dbg_ctl_log_file{"log-file"};
+DbgCtl dbg_ctl_log{"log"};
+
+} // end anonymous namespace
+
 /*-------------------------------------------------------------------------
   LogFile::LogFile
 
@@ -84,7 +91,7 @@ LogFile::LogFile(const char *name, const char *header, LogFileFormat format, uin
   m_fd                = -1;
   m_ascii_buffer_size = (ascii_buffer_size < max_line_size ? max_line_size : ascii_buffer_size);
 
-  Debug("log-file", "exiting LogFile constructor, m_name=%s, this=%p, escape_type=%d", m_name, this, escape_type);
+  Dbg(dbg_ctl_log_file, "exiting LogFile constructor, m_name=%s, this=%p, escape_type=%d", m_name, this, escape_type);
 }
 
 /*-------------------------------------------------------------------------
@@ -99,7 +106,7 @@ LogFile::LogFile(const char *name, const char *header, LogFileFormat format, uin
 
 LogFile::~LogFile()
 {
-  Debug("log-file", "entering LogFile destructor, this=%p", this);
+  Dbg(dbg_ctl_log_file, "entering LogFile destructor, this=%p", this);
 
   // close_file() checks whether a file is open before attempting to close, so
   // this is safe to call even if a file had not been opened. Further, calling
@@ -109,7 +116,7 @@ LogFile::~LogFile()
   delete m_log;
   ats_free(m_header);
   ats_free(m_name);
-  Debug("log-file", "exiting LogFile destructor, this=%p", this);
+  Dbg(dbg_ctl_log_file, "exiting LogFile destructor, this=%p", this);
 }
 
 /*-------------------------------------------------------------------------
@@ -165,14 +172,14 @@ LogFile::open_file()
         return LOG_FILE_COULD_NOT_CREATE_PIPE;
       }
     } else {
-      Debug("log-file", "Created named pipe %s for logging", m_name);
+      Dbg(dbg_ctl_log_file, "Created named pipe %s for logging", m_name);
     }
 
     // now open the pipe
-    Debug("log-file", "attempting to open pipe %s", m_name);
+    Dbg(dbg_ctl_log_file, "attempting to open pipe %s", m_name);
     m_fd = ::open(m_name, O_WRONLY | O_NDELAY, 0);
     if (m_fd < 0) {
-      Debug("log-file", "no readers for pipe %s", m_name);
+      Dbg(dbg_ctl_log_file, "no readers for pipe %s", m_name);
       return LOG_FILE_NO_PIPE_READERS;
     }
 
@@ -183,7 +190,7 @@ LogFile::open_file()
       if (pipe_size == -1) {
         Error("Get pipe size failed for pipe %s: %s", m_name, strerror(errno));
       } else {
-        Debug("log-file", "Previous buffer size for pipe %s: %ld", m_name, pipe_size);
+        Dbg(dbg_ctl_log_file, "Previous buffer size for pipe %s: %ld", m_name, pipe_size);
       }
 
       int ret = fcntl(m_fd, F_SETPIPE_SZ, m_pipe_buffer_size);
@@ -195,7 +202,7 @@ LogFile::open_file()
       if (pipe_size == -1) {
         Error("Get pipe size after setting it failed for pipe %s: %s", m_name, strerror(errno));
       } else {
-        Debug("log-file", "New buffer size for pipe %s: %ld", m_name, pipe_size);
+        Dbg(dbg_ctl_log_file, "New buffer size for pipe %s: %ld", m_name, pipe_size);
       }
     }
 #endif // F_GETPIPE_SZ
@@ -218,14 +225,14 @@ LogFile::open_file()
   //
   if (!file_exists) {
     if (m_file_format != LOG_FILE_BINARY && m_header && m_log) {
-      Debug("log-file", "writing header to LogFile %s", m_name);
+      Dbg(dbg_ctl_log_file, "writing header to LogFile %s", m_name);
       writeln(m_header, strlen(m_header), fileno(m_log->m_fp), m_name);
     }
   }
 
   Metrics::Gauge::increment(log_rsb.log_files_open);
 
-  Debug("log", "exiting LogFile::open_file(), file=%s presumably open", m_name);
+  Dbg(dbg_ctl_log, "exiting LogFile::open_file(), file=%s presumably open", m_name);
   return LOG_FILE_NO_ERROR;
 }
 
@@ -243,7 +250,7 @@ LogFile::close_file()
       if (::close(m_fd)) {
         Error("Error closing LogFile %s: %s.", m_name, strerror(errno));
       } else {
-        Debug("log-file", "LogFile %s (fd=%d) is closed", m_name, m_fd);
+        Dbg(dbg_ctl_log_file, "LogFile %s (fd=%d) is closed", m_name, m_fd);
         Metrics::Gauge::decrement(log_rsb.log_files_open);
       }
       m_fd = -1;
@@ -251,7 +258,7 @@ LogFile::close_file()
       if (m_log->close_file()) {
         Error("Error closing LogFile %s: %s.", m_log->get_name(), strerror(errno));
       } else {
-        Debug("log-file", "LogFile %s is closed", m_log->get_name());
+        Dbg(dbg_ctl_log_file, "LogFile %s is closed", m_log->get_name());
         Metrics::Gauge::decrement(log_rsb.log_files_open);
       }
     } else {
@@ -335,7 +342,7 @@ LogFile::trim_rolled(size_t rolling_max_count)
         Error("unable to auto-delete rolled logfile %s: %s", file._name.c_str(), strerror(errno));
         result = false;
       } else {
-        Debug("log-file", "rolled logfile, %s, was auto-deleted", file._name.c_str());
+        Dbg(dbg_ctl_log_file, "rolled logfile, %s, was auto-deleted", file._name.c_str());
       }
     }
   }
@@ -562,10 +569,10 @@ LogFile::write_ascii_logbuffer(LogBufferHeader *buffer_header, int fd, const cha
 int
 LogFile::write_ascii_logbuffer3(LogBufferHeader *buffer_header, const char *alt_format)
 {
-  Debug("log-file",
-        "entering LogFile::write_ascii_logbuffer3 for %s "
-        "(this=%p)",
-        m_name, this);
+  Dbg(dbg_ctl_log_file,
+      "entering LogFile::write_ascii_logbuffer3 for %s "
+      "(this=%p)",
+      m_name, this);
   ink_assert(buffer_header != nullptr);
 
   LogBufferIterator iter(buffer_header);
diff --git a/src/proxy/logging/LogFilter.cc b/src/proxy/logging/LogFilter.cc
index a3c97a87d5..8be0b3ae03 100644
--- a/src/proxy/logging/LogFilter.cc
+++ b/src/proxy/logging/LogFilter.cc
@@ -49,6 +49,13 @@
 const char *LogFilter::OPERATOR_NAME[] = {"MATCH", "CASE_INSENSITIVE_MATCH", "CONTAIN", "CASE_INSENSITIVE_CONTAIN"};
 const char *LogFilter::ACTION_NAME[]   = {"REJECT", "ACCEPT", "WIPE_FIELD_VALUE"};
 
+namespace
+{
+DbgCtl dbg_ctl_log{"log"};
+DbgCtl dbg_ctl_log_filter_compare{"log-filter-compare"};
+
+} // end anonymous namespace
+
 /*-------------------------------------------------------------------------
   LogFilter::LogFilter
 
@@ -91,14 +98,14 @@ LogFilter::parse(const char *name, Action action, const char *condition)
 
   // validate field symbol
   if (strlen(field_str) > 2 && field_str[0] == '%' && field_str[1] == '<') {
-    Debug("log", "Field symbol has <> form: %s", field_str);
+    Dbg(dbg_ctl_log, "Field symbol has <> form: %s", field_str);
     char *end = field_str;
     while (*end && *end != '>') {
       end++;
     }
     *end       = '\0';
     field_str += 2;
-    Debug("log", "... now field symbol is %s", field_str);
+    Dbg(dbg_ctl_log, "... now field symbol is %s", field_str);
   }
 
   if (LogField *f = Log::global_field_list.find_by_symbol(field_str)) {
@@ -108,7 +115,7 @@ LogFilter::parse(const char *name, Action action, const char *condition)
   if (!logfield) {
     // check for container fields
     if (*field_str == '{') {
-      Debug("log", "%s appears to be a container field", field_str);
+      Dbg(dbg_ctl_log, "%s appears to be a container field", field_str);
 
       char *fname;
       char *cname;
@@ -126,7 +133,7 @@ LogFilter::parse(const char *name, Action action, const char *condition)
       // start of container symbol
       cname = fname_end + 1;
 
-      Debug("log", "found container field: Name = %s, symbol = %s", fname, cname);
+      Dbg(dbg_ctl_log, "found container field: Name = %s, symbol = %s", fname, cname);
 
       LogField::Container container = LogField::valid_container_name(cname);
       if (container == LogField::NO_CONTAINER) {
@@ -883,7 +890,7 @@ filters_are_equal(LogFilter *filt1, LogFilter *filt2)
   // TODO: we should check name here
   if (filt1->type() == filt2->type()) {
     if (filt1->type() == LogFilter::INT_FILTER) {
-      Debug("log-filter-compare", "int compare");
+      Dbg(dbg_ctl_log_filter_compare, "int compare");
       ret = (*((LogFilterInt *)filt1) == *((LogFilterInt *)filt2));
     } else if (filt1->type() == LogFilter::IP_FILTER) {
       ret = (*((LogFilterIP *)filt1) == *((LogFilterIP *)filt2));
@@ -893,7 +900,7 @@ filters_are_equal(LogFilter *filt1, LogFilter *filt2)
       ink_assert(!"invalid filter type");
     }
   } else {
-    Debug("log-filter-compare", "type diff");
+    Dbg(dbg_ctl_log_filter_compare, "type diff");
   }
   return ret;
 }
diff --git a/src/proxy/logging/LogFormat.cc b/src/proxy/logging/LogFormat.cc
index c20e85f81a..5684bbc174 100644
--- a/src/proxy/logging/LogFormat.cc
+++ b/src/proxy/logging/LogFormat.cc
@@ -49,6 +49,13 @@
 //
 bool LogFormat::m_tagging_on = false;
 
+namespace
+{
+DbgCtl dbg_ctl_log_format{"log-format"};
+DbgCtl dbg_ctl_log_agg{"log-agg"};
+DbgCtl dbg_ctl_log_slice{"log-slice"};
+
+} // end anonymous namespace
 /*-------------------------------------------------------------------------
   LogFormat::setup
   -------------------------------------------------------------------------*/
@@ -282,13 +289,13 @@ LogFormat::format_from_specification(char *spec, char **file_name, char **file_h
   //
   token = tok.getNext();
   if (token == nullptr) {
-    Debug("log-format", "token expected");
+    Dbg(dbg_ctl_log_format, "token expected");
     return nullptr;
   }
   if (strcasecmp(token, "format") == 0) {
-    Debug("log-format", "this is a format");
+    Dbg(dbg_ctl_log_format, "this is a format");
   } else {
-    Debug("log-format", "should be 'format'");
+    Dbg(dbg_ctl_log_format, "should be 'format'");
     return nullptr;
   }
 
@@ -298,16 +305,16 @@ LogFormat::format_from_specification(char *spec, char **file_name, char **file_h
   //
   token = tok.getNext();
   if (token == nullptr) {
-    Debug("log-format", "token expected");
+    Dbg(dbg_ctl_log_format, "token expected");
     return nullptr;
   }
   if (!strcasecmp(token, "disabled")) {
-    Debug("log-format", "format not enabled, skipping ...");
+    Dbg(dbg_ctl_log_format, "format not enabled, skipping ...");
     return nullptr;
   } else if (!strcasecmp(token, "enabled")) {
-    Debug("log-format", "enabled format");
+    Dbg(dbg_ctl_log_format, "enabled format");
   } else {
-    Debug("log-format", "should be 'enabled' or 'disabled', not %s", token);
+    Dbg(dbg_ctl_log_format, "should be 'enabled' or 'disabled', not %s", token);
     return nullptr;
   }
 
@@ -316,7 +323,7 @@ LogFormat::format_from_specification(char *spec, char **file_name, char **file_h
   //
   token = tok.getNext();
   if (token == nullptr) {
-    Debug("log-format", "token expected");
+    Dbg(dbg_ctl_log_format, "token expected");
     return nullptr;
   }
   format_id = atoi(token);
@@ -327,7 +334,7 @@ LogFormat::format_from_specification(char *spec, char **file_name, char **file_h
   //
   token = tok.getNext();
   if (token == nullptr) {
-    Debug("log-format", "token expected");
+    Dbg(dbg_ctl_log_format, "token expected");
     return nullptr;
   }
   format_name = token;
@@ -337,7 +344,7 @@ LogFormat::format_from_specification(char *spec, char **file_name, char **file_h
   //
   token = tok.getNext();
   if (token == nullptr) {
-    Debug("log-format", "token expected");
+    Dbg(dbg_ctl_log_format, "token expected");
     return nullptr;
   }
   format_str = token;
@@ -347,7 +354,7 @@ LogFormat::format_from_specification(char *spec, char **file_name, char **file_h
   //
   token = tok.getNext();
   if (token == nullptr) {
-    Debug("log-format", "token expected");
+    Dbg(dbg_ctl_log_format, "token expected");
     return nullptr;
   }
   *file_name = ats_strdup(token);
@@ -357,7 +364,7 @@ LogFormat::format_from_specification(char *spec, char **file_name, char **file_h
   //
   token = tok.getNext();
   if (token == nullptr) {
-    Debug("log-format", "token expected");
+    Dbg(dbg_ctl_log_format, "token expected");
     return nullptr;
   }
   if (!strcasecmp(token, "ASCII")) {
@@ -365,7 +372,7 @@ LogFormat::format_from_specification(char *spec, char **file_name, char **file_h
   } else if (!strcasecmp(token, "BINARY")) {
     *file_type = LOG_FILE_BINARY;
   } else {
-    Debug("log-format", "%s is not a valid file format (ASCII or BINARY)", token);
+    Dbg(dbg_ctl_log_format, "%s is not a valid file format (ASCII or BINARY)", token);
     return nullptr;
   }
 
@@ -374,7 +381,7 @@ LogFormat::format_from_specification(char *spec, char **file_name, char **file_h
   //
   token = tok.getRest();
   if (token == nullptr) {
-    Debug("log-format", "token expected");
+    Dbg(dbg_ctl_log_format, "token expected");
     return nullptr;
   }
   // set header to NULL if "none" was specified (a NULL header means
@@ -382,7 +389,7 @@ LogFormat::format_from_specification(char *spec, char **file_name, char **file_h
   //
   *file_header = strcmp(token, "none") == 0 ? nullptr : ats_strdup(token);
 
-  Debug("log-format", "custom:%d:%s:%s:%s:%d:%s", format_id, format_name, format_str, *file_name, *file_type, token);
+  Dbg(dbg_ctl_log_format, "custom:%d:%s:%s:%s:%d:%s", format_id, format_name, format_str, *file_name, *file_type, token);
 
   format = new LogFormat(format_name, format_str);
   ink_assert(format != nullptr);
@@ -434,12 +441,12 @@ LogFormat::parse_symbol_string(const char *symbol_string, LogFieldList *field_li
     if (begin_paren) {
       char *end_paren = strchr(symbol, ')');
       if (end_paren) {
-        Debug("log-agg", "Aggregate symbol: %s", symbol);
+        Dbg(dbg_ctl_log_agg, "Aggregate symbol: %s", symbol);
         *begin_paren = '\0';
         *end_paren   = '\0';
         name         = begin_paren + 1;
         sym          = symbol;
-        Debug("log-agg", "Aggregate = %s, field = %s", sym, name);
+        Dbg(dbg_ctl_log_agg, "Aggregate = %s, field = %s", sym, name);
         aggregate = LogField::valid_aggregate_name(sym);
         if (aggregate == LogField::NO_AGGREGATE) {
           Note("Invalid aggregate specification: %s", sym);
@@ -461,7 +468,7 @@ LogFormat::parse_symbol_string(const char *symbol_string, LogFieldList *field_li
             field_list->add(new_f, false);
             field_count++;
             *contains_aggregates = true;
-            Debug("log-agg", "Aggregate field %s(%s) added", sym, name);
+            Dbg(dbg_ctl_log_agg, "Aggregate field %s(%s) added", sym, name);
           }
         }
       } else {
@@ -474,7 +481,7 @@ LogFormat::parse_symbol_string(const char *symbol_string, LogFieldList *field_li
     // Now check for a container field, which starts with '{'
     //
     else if (*symbol == '{') {
-      Debug("log-format", "Container symbol: %s", symbol);
+      Dbg(dbg_ctl_log_format, "Container symbol: %s", symbol);
       f              = nullptr;
       char *name_end = strchr(symbol, '}');
       if (name_end != nullptr) {
@@ -482,7 +489,7 @@ LogFormat::parse_symbol_string(const char *symbol_string, LogFieldList *field_li
         *name_end = 0;            // changes '}' to '\0'
         sym       = name_end + 1; // start of container symbol
         LogSlice slice(sym);
-        Debug("log-format", "Name = %s, symbol = %s", name, sym);
+        Dbg(dbg_ctl_log_format, "Name = %s, symbol = %s", name, sym);
         container = LogField::valid_container_name(sym);
         if (container == LogField::NO_CONTAINER) {
           Note("Invalid container specification: %s", sym);
@@ -491,11 +498,11 @@ LogFormat::parse_symbol_string(const char *symbol_string, LogFieldList *field_li
           ink_assert(f != nullptr);
           if (slice.m_enable) {
             f->m_slice = slice;
-            Debug("log-slice", "symbol = %s, [%d:%d]", sym, f->m_slice.m_start, f->m_slice.m_end);
+            Dbg(dbg_ctl_log_slice, "symbol = %s, [%d:%d]", sym, f->m_slice.m_start, f->m_slice.m_end);
           }
           field_list->add(f, false);
           field_count++;
-          Debug("log-format", "Container field {%s}%s added", name, sym);
+          Dbg(dbg_ctl_log_format, "Container field {%s}%s added", name, sym);
         }
       } else {
         Note("Invalid container field specification: no trailing "
@@ -508,17 +515,17 @@ LogFormat::parse_symbol_string(const char *symbol_string, LogFieldList *field_li
     //
     else {
       LogSlice slice(symbol);
-      Debug("log-format", "Regular field symbol: %s", symbol);
+      Dbg(dbg_ctl_log_format, "Regular field symbol: %s", symbol);
       f = Log::global_field_list.find_by_symbol(symbol);
       if (f != nullptr) {
         LogField *cpy = new LogField(*f);
         if (slice.m_enable) {
           cpy->m_slice = slice;
-          Debug("log-slice", "symbol = %s, [%d:%d]", symbol, cpy->m_slice.m_start, cpy->m_slice.m_end);
+          Dbg(dbg_ctl_log_slice, "symbol = %s, [%d:%d]", symbol, cpy->m_slice.m_start, cpy->m_slice.m_end);
         }
         field_list->add(cpy, false);
         field_count++;
-        Debug("log-format", "Regular field %s added", symbol);
+        Dbg(dbg_ctl_log_format, "Regular field %s added", symbol);
       } else {
         Note("The log format symbol %s was not found in the "
              "list of known symbols.",
@@ -727,7 +734,7 @@ LogFormat::parse_format_string(const char *format_str, char **printf_str, char *
   (*fields_str)[fields_pos] = '\0';
   (*printf_str)[printf_pos] = '\0';
 
-  Debug("log-format", "LogFormat::parse_format_string: field_count=%d, \"%s\", \"%s\"", field_count, *fields_str, *printf_str);
+  Dbg(dbg_ctl_log_format, "LogFormat::parse_format_string: field_count=%d, \"%s\", \"%s\"", field_count, *fields_str, *printf_str);
   return field_count;
 }
 
diff --git a/src/proxy/logging/LogObject.cc b/src/proxy/logging/LogObject.cc
index a21bb7b4d5..33df54dc13 100644
--- a/src/proxy/logging/LogObject.cc
+++ b/src/proxy/logging/LogObject.cc
@@ -42,18 +42,29 @@
 #include <thread>
 #include <map>
 
-static bool
+namespace
+{
+DbgCtl dbg_ctl_log_logbuffer{"log-logbuffer"};
+DbgCtl dbg_ctl_log_config{"log-config"};
+DbgCtl dbg_ctl_log{"log"};
+DbgCtl dbg_ctl_log_agg{"log-agg"};
+DbgCtl dbg_ctl_log_buffer{"log-buffer"};
+DbgCtl dbg_ctl_log_config_transfer{"log-config-transfer"};
+
+bool
 should_roll_on_time(Log::RollingEnabledValues roll)
 {
   return roll == Log::ROLL_ON_TIME_ONLY || roll == Log::ROLL_ON_TIME_OR_SIZE;
 }
 
-static bool
+bool
 should_roll_on_size(Log::RollingEnabledValues roll)
 {
   return roll == Log::ROLL_ON_SIZE_ONLY || roll == Log::ROLL_ON_TIME_OR_SIZE;
 }
 
+} // end anonymous namespace
+
 size_t
 LogBufferManager::preproc_buffers(LogBufferSink *sink)
 {
@@ -81,7 +92,7 @@ LogBufferManager::preproc_buffers(LogBufferSink *sink)
     prepared++;
   }
 
-  Debug("log-logbuffer", "prepared %d buffers", prepared);
+  Dbg(dbg_ctl_log_logbuffer, "prepared %d buffers", prepared);
   return prepared;
 }
 
@@ -137,12 +148,12 @@ LogObject::LogObject(LogConfig *cfg, const LogFormat *format, const char *log_di
   }
   _setup_rolling(cfg, rolling_enabled, rolling_interval_sec, rolling_offset_hr, rolling_size_mb);
 
-  Debug("log-config", "exiting LogObject constructor, filename=%s this=%p fast=%d", m_filename, this, m_fast);
+  Dbg(dbg_ctl_log_config, "exiting LogObject constructor, filename=%s this=%p fast=%d", m_filename, this, m_fast);
 }
 
 LogObject::~LogObject()
 {
-  Debug("log-config", "entering LogObject destructor, this=%p", this);
+  Dbg(dbg_ctl_log_config, "entering LogObject destructor, this=%p", this);
 
   preproc_buffers();
   ats_free(m_basename);
@@ -383,7 +394,7 @@ LogObject::_checkout_write(size_t *write_offset, size_t bytes_needed)
         ink_atomic_increment(&buffer->m_references, FREELIST_VERSION(old_h) - 1);
 
         int idx = m_buffer_manager_idx++ % m_flush_threads;
-        Debug("log-logbuffer", "adding buffer %d to flush list after checkout", buffer->get_id());
+        Dbg(dbg_ctl_log_logbuffer, "adding buffer %d to flush list after checkout", buffer->get_id());
         m_buffer_manager[idx].add_to_flush_queue(buffer);
         Log::preproc_notify[idx].signal();
         buffer = nullptr;
@@ -496,12 +507,12 @@ private:
       period = 1;
     }
     eventProcessor.schedule_every(this, period * HRTIME_SECOND, ET_CALL);
-    Debug("log-config", "thread local buffer manager init: %d wakeup period", period);
+    Dbg(dbg_ctl_log_config, "thread local buffer manager init: %d wakeup period", period);
   }
 
   ~ThreadLocalLogBufferManager() override
   {
-    Debug("log-config", "thread local buffer manager destructor");
+    Dbg(dbg_ctl_log_config, "thread local buffer manager destructor");
     // only the LogBuffer objects are owned by this
     for (auto [o, b] : current_buffers) {
       // ideally we flush these here but there are shutdown order issues so if the
@@ -562,7 +573,7 @@ void
 LogObject::flush_buffer(LogBuffer *buffer)
 {
   int idx = m_buffer_manager_idx++ % m_flush_threads;
-  Debug("log-logbuffer", "adding buffer %d to flush list after checkout", buffer->get_id());
+  Dbg(dbg_ctl_log_logbuffer, "adding buffer %d to flush list after checkout", buffer->get_id());
   m_buffer_manager[idx].add_to_flush_queue(buffer);
   Log::preproc_notify[idx].signal();
 }
@@ -578,7 +589,7 @@ LogObject::log(LogAccess *lad, std::string_view text_entry)
   // likewise, send data to a remote client even if local space is exhausted
   // (if there is a remote client, m_logFile will be NULL
   if (Log::config->logging_space_exhausted && !writes_to_pipe() && m_logFile) {
-    Debug("log", "logging space exhausted, can't write to:%s, drop this entry", m_logFile->get_name());
+    Dbg(dbg_ctl_log, "logging space exhausted, can't write to:%s, drop this entry", m_logFile->get_name());
     return Log::FULL;
   }
   // this verification must be done here in order to avoid 'dead' LogBuffers
@@ -589,12 +600,12 @@ LogObject::log(LogAccess *lad, std::string_view text_entry)
   }
 
   if (lad && m_filter_list.toss_this_entry(lad)) {
-    Debug("log", "entry filtered, skipping ...");
+    Dbg(dbg_ctl_log, "entry filtered, skipping ...");
     return Log::SKIP;
   }
 
   if (lad && m_filter_list.wipe_this_entry(lad)) {
-    Debug("log", "entry wiped, ...");
+    Dbg(dbg_ctl_log, "entry wiped, ...");
   }
 
   if (lad && m_format->is_aggregate()) {
@@ -622,10 +633,10 @@ LogObject::log(LogAccess *lad, std::string_view text_entry)
     }
 
     if (time_now < m_format->m_interval_next) {
-      Debug("log-agg",
-            "Time now = %ld, next agg = %ld; not time "
-            "for aggregate entry",
-            time_now, m_format->m_interval_next);
+      Dbg(dbg_ctl_log_agg,
+          "Time now = %ld, next agg = %ld; not time "
+          "for aggregate entry",
+          time_now, m_format->m_interval_next);
       return Log::AGGR;
     }
     // can easily compute bytes_needed because all fields are INTs
@@ -638,7 +649,7 @@ LogObject::log(LogAccess *lad, std::string_view text_entry)
   }
 
   if (bytes_needed == 0) {
-    Debug("log-buffer", "Nothing to log, bytes_needed = 0");
+    Dbg(dbg_ctl_log_buffer, "Nothing to log, bytes_needed = 0");
     return Log::SKIP;
   }
 
@@ -668,7 +679,7 @@ LogObject::log(LogAccess *lad, std::string_view text_entry)
     bytes_used = m_format->m_field_list.marshal_agg(&(*buffer)[offset]);
     ink_assert(bytes_needed >= bytes_used);
     m_format->m_interval_next += m_format->m_interval_sec;
-    Debug("log-agg", "Aggregate entry created; next time is %ld", m_format->m_interval_next);
+    Dbg(dbg_ctl_log_agg, "Aggregate entry created; next time is %ld", m_format->m_interval_next);
   } else if (lad) {
     bytes_used = m_format->m_field_list.marshal(lad, &(*buffer)[offset]);
     ink_assert(bytes_needed >= bytes_used);
@@ -949,10 +960,10 @@ LogObjectManager::_manage_object(LogObject *log_object, bool is_api_object, int
 
         ink_release_assert(retVal == NO_FILENAME_CONFLICTS);
 
-        Debug("log",
-              "LogObjectManager managing object %s (%s) "
-              "[signature = %" PRIu64 ", address = %p]",
-              log_object->get_base_filename(), log_object->get_full_filename(), log_object->get_signature(), log_object);
+        Dbg(dbg_ctl_log,
+            "LogObjectManager managing object %s (%s) "
+            "[signature = %" PRIu64 ", address = %p]",
+            log_object->get_base_filename(), log_object->get_full_filename(), log_object->get_signature(), log_object);
 
         if (log_object->has_alternate_name()) {
           Warning("The full path for the (%s) LogObject "
@@ -1002,13 +1013,13 @@ LogObjectManager::_solve_filename_conflicts(LogObject *log_object, int maxConfli
       if (got_sig && signature == obj_sig) {
         conflicts = false;
       }
-      Debug("log",
-            "LogObjectManager::_solve_filename_conflicts\n"
-            "\tfilename = %s\n"
-            "\tmeta file signature = %" PRIu64 "\n"
-            "\tlog object signature = %" PRIu64 "\n"
-            "\tconflicts = %d",
-            filename, signature, obj_sig, conflicts);
+      Dbg(dbg_ctl_log,
+          "LogObjectManager::_solve_filename_conflicts\n"
+          "\tfilename = %s\n"
+          "\tmeta file signature = %" PRIu64 "\n"
+          "\tlog object signature = %" PRIu64 "\n"
+          "\tconflicts = %d",
+          filename, signature, obj_sig, conflicts);
     }
 
     if (conflicts) {
@@ -1220,17 +1231,17 @@ LogObjectManager::open_local_pipes()
 void
 LogObjectManager::transfer_objects(LogObjectManager &old_mgr)
 {
-  Debug("log-config-transfer", "transferring objects from LogObjectManager %p, to %p", &old_mgr, this);
+  Dbg(dbg_ctl_log_config_transfer, "transferring objects from LogObjectManager %p, to %p", &old_mgr, this);
 
-  if (is_debug_tag_set("log-config-transfer")) {
-    Debug("log-config-transfer", "TRANSFER OBJECTS: list of old objects");
+  if (dbg_ctl_log_config_transfer.on()) {
+    Dbg(dbg_ctl_log_config_transfer, "TRANSFER OBJECTS: list of old objects");
     for (auto &_object : old_mgr._objects) {
-      Debug("log-config-transfer", "%s", _object->get_original_filename());
+      Dbg(dbg_ctl_log_config_transfer, "%s", _object->get_original_filename());
     }
 
-    Debug("log-config-transfer", "TRANSFER OBJECTS : list of new objects");
+    Dbg(dbg_ctl_log_config_transfer, "TRANSFER OBJECTS : list of new objects");
     for (unsigned i = 0; i < this->_objects.size(); i++) {
-      Debug("log-config-transfer", "%s", _objects[i]->get_original_filename());
+      Dbg(dbg_ctl_log_config_transfer, "%s", _objects[i]->get_original_filename());
     }
   }
 
@@ -1242,7 +1253,7 @@ LogObjectManager::transfer_objects(LogObjectManager &old_mgr)
   for (auto old_obj : old_mgr._objects) {
     LogObject *new_obj;
 
-    Debug("log-config-transfer", "examining existing object %s", old_obj->get_base_filename());
+    Dbg(dbg_ctl_log_config_transfer, "examining existing object %s", old_obj->get_base_filename());
 
     // See if any of the new objects is just a copy of an old one. If so, transfer the
     // old one to the new manager and delete the new one. We don't use Vec::in here because
@@ -1250,11 +1261,11 @@ LogObjectManager::transfer_objects(LogObjectManager &old_mgr)
     for (unsigned j = 0; j < _objects.size(); j++) {
       new_obj = _objects[j];
 
-      Debug("log-config-transfer", "comparing existing object %s to new object %s", old_obj->get_base_filename(),
-            new_obj->get_base_filename());
+      Dbg(dbg_ctl_log_config_transfer, "comparing existing object %s to new object %s", old_obj->get_base_filename(),
+          new_obj->get_base_filename());
 
       if (*new_obj == *old_obj) {
-        Debug("log-config-transfer", "keeping existing object %s", old_obj->get_base_filename());
+        Dbg(dbg_ctl_log_config_transfer, "keeping existing object %s", old_obj->get_base_filename());
 
         old_obj->refcount_inc();
         this->_objects[j] = old_obj;
@@ -1267,8 +1278,8 @@ LogObjectManager::transfer_objects(LogObjectManager &old_mgr)
     }
   }
 
-  if (is_debug_tag_set("log-config-transfer")) {
-    Debug("log-config-transfer", "Log Object List after transfer:");
+  if (dbg_ctl_log_config_transfer.on()) {
+    Dbg(dbg_ctl_log_config_transfer, "Log Object List after transfer:");
     display();
   }
 }
diff --git a/src/proxy/logging/YamlLogConfig.cc b/src/proxy/logging/YamlLogConfig.cc
index f673a9e40e..e554e8f966 100644
--- a/src/proxy/logging/YamlLogConfig.cc
+++ b/src/proxy/logging/YamlLogConfig.cc
@@ -31,6 +31,13 @@
 #include <algorithm>
 #include <memory>
 
+namespace
+{
+DbgCtl dbg_ctl_log{"log"};
+DbgCtl dbg_ctl_xml{"xml"};
+
+} // end anonymous namespace
+
 bool
 YamlLogConfig::parse(const char *cfgFilename)
 {
@@ -71,7 +78,7 @@ YamlLogConfig::loadLogConfig(const char *cfgFilename)
     if (fmt->valid()) {
       cfg->format_list.add(fmt, false);
 
-      if (is_debug_tag_set("log")) {
+      if (dbg_ctl_log.on()) {
         printf("The following format was added to the global format list\n");
         fmt->display(stdout);
       }
@@ -88,7 +95,7 @@ YamlLogConfig::loadLogConfig(const char *cfgFilename)
     if (filter) {
       cfg->filter_list.add(filter, false);
 
-      if (is_debug_tag_set("xml")) {
+      if (dbg_ctl_xml.on()) {
         printf("The following filter was added to the global filter list\n");
         filter->display(stdout);
       }
diff --git a/src/proxy/logging/unit-tests/benchmark_LogObject.cc b/src/proxy/logging/unit-tests/benchmark_LogObject.cc
index 3762d75fe2..e42f583907 100644
--- a/src/proxy/logging/unit-tests/benchmark_LogObject.cc
+++ b/src/proxy/logging/unit-tests/benchmark_LogObject.cc
@@ -99,7 +99,7 @@ TEST_CASE("LogObject", "[proxy/logging]")
   diags()->set_std_output(StdStream::STDOUT, bind_stdout);
   diags()->set_std_output(StdStream::STDERR, bind_stderr);
 
-  if (is_debug_tag_set("diags")) {
+  if (DbgCtl dc{"diags"}; dc.on()) {
     diags()->dump();
   }
   Layout::create("/opt/ats");


(trafficserver) 07/08: Remove obsolete debug output calls in 18 source files. (#11307)

Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 46369c6567ca07ac31074073f4a1976efa3b811c
Author: Walt Karas <wk...@yahooinc.com>
AuthorDate: Tue May 14 16:33:21 2024 -0400

    Remove obsolete debug output calls in 18 source files. (#11307)
    
    In the src/proxy tree.
    
    (cherry picked from commit 4ba6a7fb2d7cef58a44fec247e5dcabec1e42622)
---
 src/proxy/CacheControl.cc                | 24 +++++++++-----
 src/proxy/FetchSM.cc                     | 42 +++++++++++++----------
 src/proxy/HostStatus.cc                  | 49 +++++++++++++++------------
 src/proxy/ParentSelectionStrategy.cc     | 12 +++++--
 src/proxy/ProtocolProbeSessionAccept.cc  | 35 ++++++++++++--------
 src/proxy/ReverseProxy.cc                | 15 ++++++---
 src/proxy/Transform.cc                   | 57 ++++++++++++++++++--------------
 src/proxy/http3/Http09App.cc             | 15 ++++++---
 src/proxy/http3/Http3App.cc              | 29 ++++++++++------
 src/proxy/http3/Http3Frame.cc            |  8 ++++-
 src/proxy/http3/Http3FrameCollector.cc   |  8 ++++-
 src/proxy/http3/Http3FrameDispatcher.cc  | 17 +++++++---
 src/proxy/http3/Http3HeaderFramer.cc     |  8 ++++-
 src/proxy/http3/Http3HeaderVIOAdaptor.cc | 19 +++++++----
 src/proxy/http3/Http3SessionAccept.cc    | 18 ++++++----
 src/proxy/http3/Http3SettingsHandler.cc  | 14 +++++---
 src/proxy/http3/Http3Transaction.cc      | 21 ++++++++----
 src/proxy/http3/QPACK.cc                 | 10 ++++--
 18 files changed, 259 insertions(+), 142 deletions(-)

diff --git a/src/proxy/CacheControl.cc b/src/proxy/CacheControl.cc
index 844aed2aeb..a539b560cb 100644
--- a/src/proxy/CacheControl.cc
+++ b/src/proxy/CacheControl.cc
@@ -41,11 +41,13 @@
 #include "../iocore/cache/P_Cache.h"
 #include "tsutil/Regex.h"
 
-static const char modulePrefix[] = "[CacheControl]";
+namespace
+{
+const char modulePrefix[] = "[CacheControl]";
 
 #define TWEAK_CACHE_RESPONSES_TO_COOKIES "cache-responses-to-cookies"
 
-static const char *CC_directive_str[CC_NUM_TYPES] = {
+const char *CC_directive_str[CC_NUM_TYPES] = {
   "INVALID",
   "REVALIDATE_AFTER",
   "NEVER_CACHE",
@@ -58,11 +60,17 @@ static const char *CC_directive_str[CC_NUM_TYPES] = {
   // "CACHE_AUTH_CONTENT"
 };
 
-using CC_table = ControlMatcher<CacheControlRecord, CacheControlResult>;
+Ptr<ProxyMutex> reconfig_mutex;
+
+DbgCtl dbg_ctl_v_http3{"v_http3"};
+DbgCtl dbg_ctl_http3{"http3"};
+DbgCtl dbg_ctl_cache_control{"cache_control"};
+
+} // end anonymous namespace
 
 // Global Ptrs
-static Ptr<ProxyMutex> reconfig_mutex;
-CC_table              *CacheControlTable = nullptr;
+using CC_table              = ControlMatcher<CacheControlRecord, CacheControlResult>;
+CC_table *CacheControlTable = nullptr;
 
 // struct CC_FreerContinuation
 // Continuation to free old cache control lists after
@@ -75,7 +83,7 @@ struct CC_FreerContinuation : public Continuation {
   int
   freeEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
   {
-    Debug("cache_control", "Deleting old table");
+    Dbg(dbg_ctl_cache_control, "Deleting old table");
     delete p;
     delete this;
     return EVENT_DONE;
@@ -144,7 +152,7 @@ reloadCacheControl()
 
   CC_table *newTable;
 
-  Debug("cache_control", "%s updated, reloading", ts::filename::CACHE);
+  Dbg(dbg_ctl_cache_control, "%s updated, reloading", ts::filename::CACHE);
   eventProcessor.schedule_in(new CC_FreerContinuation(CacheControlTable), CACHE_CONTROL_TIMEOUT, ET_CALL);
   newTable = new CC_table("proxy.config.cache.control.filename", modulePrefix, &http_dest_tags);
   ink_atomic_swap(&CacheControlTable, newTable);
@@ -437,6 +445,6 @@ CacheControlRecord::UpdateMatch(CacheControlResult *result, RequestData *rdata)
       crtc_debug[0] = 0;
     }
 
-    Debug("cache_control", "Matched with for %s at line %d%s", CC_directive_str[this->directive], this->line_num, crtc_debug);
+    Dbg(dbg_ctl_cache_control, "Matched with for %s at line %d%s", CC_directive_str[this->directive], this->line_num, crtc_debug);
   }
 }
diff --git a/src/proxy/FetchSM.cc b/src/proxy/FetchSM.cc
index 22ad8e72a5..09d8e96d0d 100644
--- a/src/proxy/FetchSM.cc
+++ b/src/proxy/FetchSM.cc
@@ -33,13 +33,19 @@
 
 ClassAllocator<FetchSM> FetchSMAllocator("FetchSMAllocator");
 
+namespace
+{
+DbgCtl dbg_ctl{DEBUG_TAG};
+
+} // end anonymous namespace
+
 void
 FetchSM::cleanUp()
 {
-  Debug(DEBUG_TAG, "[%s] calling cleanup", __FUNCTION__);
+  Dbg(dbg_ctl, "[%s] calling cleanup", __FUNCTION__);
 
   if (!ink_atomic_cas(&destroyed, false, true)) {
-    Debug(DEBUG_TAG, "Error: Double delete on FetchSM, this:%p", this);
+    Dbg(dbg_ctl, "Error: Double delete on FetchSM, this:%p", this);
     return;
   }
 
@@ -67,7 +73,7 @@ FetchSM::httpConnect()
   const char     *tag = pi ? pi->getPluginTag() : "fetchSM";
   int64_t         id  = pi ? pi->getPluginId() : 0;
 
-  Debug(DEBUG_TAG, "[%s] calling httpconnect write pi=%p tag=%s id=%" PRId64, __FUNCTION__, pi, tag, id);
+  Dbg(dbg_ctl, "[%s] calling httpconnect write pi=%p tag=%s id=%" PRId64, __FUNCTION__, pi, tag, id);
   TSHttpConnectOptions options{.connect_type      = TS_CONNECT_PLUGIN,
                                .addr              = &_addr.sa,
                                .tag               = tag,
@@ -76,7 +82,7 @@ FetchSM::httpConnect()
                                .buffer_water_mark = TS_IOBUFFER_WATER_MARK_PLUGIN_VC_DEFAULT};
   http_vc = PluginHttpConnectInternal(&options);
   if (http_vc == nullptr) {
-    Debug(DEBUG_TAG, "Not ready to use");
+    Dbg(dbg_ctl, "Not ready to use");
     if (contp) {
       if (fetch_flags & TS_FETCH_FLAGS_STREAM) {
         return InvokePluginExt(TS_EVENT_ERROR);
@@ -199,8 +205,8 @@ FetchSM::check_for_field_value(const char *name, size_t name_len, char const *va
   if (ret) {
     for (Str *f = slist.head; f != nullptr; f = f->next) {
       if (f->len == value_len && 0 == strncasecmp(f->str, value, value_len)) {
-        Debug(DEBUG_TAG, "[%s] field '%.*s', value '%.*s'", __FUNCTION__, static_cast<int>(name_len), name,
-              static_cast<int>(value_len), value);
+        Dbg(dbg_ctl, "[%s] field '%.*s', value '%.*s'", __FUNCTION__, static_cast<int>(name_len), name, static_cast<int>(value_len),
+            value);
         zret = true;
         break;
       }
@@ -316,9 +322,9 @@ FetchSM::InvokePluginExt(int fetch_event)
     goto out;
   }
 
-  Debug(DEBUG_TAG, "[%s] chunked:%d, content_len: %" PRId64 ", received_len: %" PRId64 ", avail: %" PRId64 "", __FUNCTION__,
-        resp_is_chunked, resp_content_length, resp_received_body_len,
-        resp_is_chunked > 0 ? chunked_handler.chunked_reader->read_avail() : resp_reader->read_avail());
+  Dbg(dbg_ctl, "[%s] chunked:%d, content_len: %" PRId64 ", received_len: %" PRId64 ", avail: %" PRId64 "", __FUNCTION__,
+      resp_is_chunked, resp_content_length, resp_received_body_len,
+      resp_is_chunked > 0 ? chunked_handler.chunked_reader->read_avail() : resp_reader->read_avail());
 
   if (resp_is_chunked > 0) {
     if (!chunked_handler.chunked_reader->read_avail()) {
@@ -396,7 +402,7 @@ FetchSM::get_info_from_buffer(IOBufferReader *reader)
     reader->skip_empty_blocks();
 
   read_avail = reader->read_avail();
-  Debug(DEBUG_TAG, "[%s] total avail %" PRId64, __FUNCTION__, read_avail);
+  Dbg(dbg_ctl, "[%s] total avail %" PRId64, __FUNCTION__, read_avail);
   if (!read_avail) {
     client_bytes = 0;
     return;
@@ -494,7 +500,7 @@ FetchSM::get_info_from_buffer(IOBufferReader *reader)
 void
 FetchSM::process_fetch_read(int event)
 {
-  Debug(DEBUG_TAG, "[%s] I am here read", __FUNCTION__);
+  Dbg(dbg_ctl, "[%s] I am here read", __FUNCTION__);
   int64_t bytes;
   int     bytes_used;
   int64_t total_bytes_copied = 0;
@@ -504,18 +510,18 @@ FetchSM::process_fetch_read(int event)
     // duplicate the bytes for backward compatibility with TSFetchUrl()
     if (!(fetch_flags & TS_FETCH_FLAGS_STREAM)) {
       bytes = resp_reader->read_avail();
-      Debug(DEBUG_TAG, "[%s] number of bytes in read ready %" PRId64, __FUNCTION__, bytes);
+      Dbg(dbg_ctl, "[%s] number of bytes in read ready %" PRId64, __FUNCTION__, bytes);
 
       while (total_bytes_copied < bytes) {
         int64_t actual_bytes_copied;
         actual_bytes_copied = resp_buffer->write(resp_reader, bytes, 0);
-        Debug(DEBUG_TAG, "[%s] copied %" PRId64 " bytes", __FUNCTION__, actual_bytes_copied);
+        Dbg(dbg_ctl, "[%s] copied %" PRId64 " bytes", __FUNCTION__, actual_bytes_copied);
         if (actual_bytes_copied <= 0) {
           break;
         }
         total_bytes_copied += actual_bytes_copied;
       }
-      Debug(DEBUG_TAG, "[%s] total copied %" PRId64 " bytes", __FUNCTION__, total_bytes_copied);
+      Dbg(dbg_ctl, "[%s] total copied %" PRId64 " bytes", __FUNCTION__, total_bytes_copied);
       resp_reader->consume(total_bytes_copied);
     }
 
@@ -544,7 +550,7 @@ FetchSM::process_fetch_read(int event)
       get_info_from_buffer(resp_reader);
       InvokePlugin(callback_events.success_event_id, (void *)this);
     }
-    Debug(DEBUG_TAG, "[%s] received EOS", __FUNCTION__);
+    Dbg(dbg_ctl, "[%s] received EOS", __FUNCTION__);
     cleanUp();
     break;
   case TS_EVENT_ERROR:
@@ -561,7 +567,7 @@ FetchSM::process_fetch_read(int event)
 void
 FetchSM::process_fetch_write(int event)
 {
-  Debug(DEBUG_TAG, "[%s] calling process write", __FUNCTION__);
+  Dbg(dbg_ctl, "[%s] calling process write", __FUNCTION__);
   switch (event) {
   case TS_EVENT_VCONN_WRITE_COMPLETE:
     req_finished = true;
@@ -589,7 +595,7 @@ FetchSM::process_fetch_write(int event)
 int
 FetchSM::fetch_handler(int event, void *edata)
 {
-  Debug(DEBUG_TAG, "[%s] calling fetch_plugin", __FUNCTION__);
+  Dbg(dbg_ctl, "[%s] calling fetch_plugin", __FUNCTION__);
 
   if (edata == read_vio) {
     process_fetch_read(event);
@@ -681,7 +687,7 @@ FetchSM::ext_write_data(const void *data, size_t len)
   }
   req_buffer->write(data, len);
 
-  Debug(DEBUG_TAG, "[%s] re-enabling write_vio, header_done %u", __FUNCTION__, header_done);
+  Dbg(dbg_ctl, "[%s] re-enabling write_vio, header_done %u", __FUNCTION__, header_done);
   write_vio->reenable();
 
   if (fetch_flags & TS_FETCH_FLAGS_NEWLOCK) {
diff --git a/src/proxy/HostStatus.cc b/src/proxy/HostStatus.cc
index b1e0bb3463..31406b1e09 100644
--- a/src/proxy/HostStatus.cc
+++ b/src/proxy/HostStatus.cc
@@ -42,6 +42,8 @@ struct HostCmdInfo {
   int                      time{0};
 };
 
+DbgCtl dbg_ctl_host_statuses{"host_statuses"};
+
 } // namespace
 
 swoc::Rv<YAML::Node> server_get_status(std::string_view const id, YAML::Node const &params);
@@ -182,7 +184,7 @@ void
 HostStatus::loadRecord(std::string_view name, HostStatRec &h)
 {
   HostStatRec *host_stat = nullptr;
-  Debug("host_statuses", "loading host status record for %.*s", int(name.size()), name.data());
+  Dbg(dbg_ctl_host_statuses, "loading host status record for %.*s", int(name.size()), name.data());
   ink_rwlock_wrlock(&host_status_rwlock);
   {
     auto it = hosts_statuses.find(std::string(name));
@@ -213,7 +215,8 @@ HostStatus::setHostStatus(const std::string_view name, TSHostStatus status, cons
       hosts_statuses.emplace(name, host_stat);
     }
     if (reason & Reason::ACTIVE) {
-      Debug("host_statuses", "for host %.*s set status: %s, Reason:ACTIVE", int(name.size()), name.data(), HostStatusNames[status]);
+      Dbg(dbg_ctl_host_statuses, "for host %.*s set status: %s, Reason:ACTIVE", int(name.size()), name.data(),
+          HostStatusNames[status]);
       if (status == TSHostStatus::TS_HOST_STATUS_DOWN) {
         host_stat->active_marked_down  = time(0);
         host_stat->active_down_time    = down_time;
@@ -227,7 +230,8 @@ HostStatus::setHostStatus(const std::string_view name, TSHostStatus status, cons
       }
     }
     if (reason & Reason::LOCAL) {
-      Debug("host_statuses", "for host %.*s set status: %s, Reason:LOCAL", int(name.size()), name.data(), HostStatusNames[status]);
+      Dbg(dbg_ctl_host_statuses, "for host %.*s set status: %s, Reason:LOCAL", int(name.size()), name.data(),
+          HostStatusNames[status]);
       if (status == TSHostStatus::TS_HOST_STATUS_DOWN) {
         host_stat->local_marked_down  = time(0);
         host_stat->local_down_time    = down_time;
@@ -241,7 +245,8 @@ HostStatus::setHostStatus(const std::string_view name, TSHostStatus status, cons
       }
     }
     if (reason & Reason::MANUAL) {
-      Debug("host_statuses", "for host %.*s set status: %s, Reason:MANUAL", int(name.size()), name.data(), HostStatusNames[status]);
+      Dbg(dbg_ctl_host_statuses, "for host %.*s set status: %s, Reason:MANUAL", int(name.size()), name.data(),
+          HostStatusNames[status]);
       if (status == TSHostStatus::TS_HOST_STATUS_DOWN) {
         host_stat->manual_marked_down  = time(0);
         host_stat->manual_down_time    = down_time;
@@ -255,8 +260,8 @@ HostStatus::setHostStatus(const std::string_view name, TSHostStatus status, cons
       }
     }
     if (reason & Reason::SELF_DETECT) {
-      Debug("host_statuses", "for host %.*s set status: %s, Reason:SELF_DETECT", int(name.size()), name.data(),
-            HostStatusNames[status]);
+      Dbg(dbg_ctl_host_statuses, "for host %.*s set status: %s, Reason:SELF_DETECT", int(name.size()), name.data(),
+          HostStatusNames[status]);
       if (status == TSHostStatus::TS_HOST_STATUS_DOWN) {
         host_stat->self_detect_marked_down  = time(0);
         host_stat->reasons                 |= Reason::SELF_DETECT;
@@ -271,10 +276,10 @@ HostStatus::setHostStatus(const std::string_view name, TSHostStatus status, cons
       if (host_stat->reasons == 0) {
         host_stat->status = TSHostStatus::TS_HOST_STATUS_UP;
       }
-      Debug("host_statuses", "reasons: %d, status: %s", host_stat->reasons, HostStatusNames[host_stat->status]);
+      Dbg(dbg_ctl_host_statuses, "reasons: %d, status: %s", host_stat->reasons, HostStatusNames[host_stat->status]);
     } else {
       host_stat->status = status;
-      Debug("host_statuses", "reasons: %d, status: %s", host_stat->reasons, HostStatusNames[host_stat->status]);
+      Dbg(dbg_ctl_host_statuses, "reasons: %d, status: %s", host_stat->reasons, HostStatusNames[host_stat->status]);
     }
   }
   ink_rwlock_unlock(&host_status_rwlock);
@@ -343,24 +348,24 @@ HostStatus::getHostStatus(const std::string_view name)
     unsigned int reasons = _status->reasons;
     if ((_status->reasons & Reason::ACTIVE) && _status->active_down_time > 0) {
       if ((_status->active_down_time + _status->active_marked_down) < now) {
-        Debug("host_statuses", "name: %.*s, now: %ld, down_time: %d, marked_down: %ld, reason: %s", int(name.size()), name.data(),
-              now, _status->active_down_time, _status->active_marked_down, Reason::ACTIVE_REASON);
+        Dbg(dbg_ctl_host_statuses, "name: %.*s, now: %ld, down_time: %d, marked_down: %ld, reason: %s", int(name.size()),
+            name.data(), now, _status->active_down_time, _status->active_marked_down, Reason::ACTIVE_REASON);
         setHostStatus(name, TSHostStatus::TS_HOST_STATUS_UP, 0, Reason::ACTIVE);
         reasons ^= Reason::ACTIVE;
       }
     }
     if ((_status->reasons & Reason::LOCAL) && _status->local_down_time > 0) {
       if ((_status->local_down_time + _status->local_marked_down) < now) {
-        Debug("host_statuses", "name: %.*s, now: %ld, down_time: %d, marked_down: %ld, reason: %s", int(name.size()), name.data(),
-              now, _status->local_down_time, _status->local_marked_down, Reason::LOCAL_REASON);
+        Dbg(dbg_ctl_host_statuses, "name: %.*s, now: %ld, down_time: %d, marked_down: %ld, reason: %s", int(name.size()),
+            name.data(), now, _status->local_down_time, _status->local_marked_down, Reason::LOCAL_REASON);
         setHostStatus(name, TSHostStatus::TS_HOST_STATUS_UP, 0, Reason::LOCAL);
         reasons ^= Reason::LOCAL;
       }
     }
     if ((_status->reasons & Reason::MANUAL) && _status->manual_down_time > 0) {
       if ((_status->manual_down_time + _status->manual_marked_down) < now) {
-        Debug("host_statuses", "name: %.*s, now: %ld, down_time: %d, marked_down: %ld, reason: %s", int(name.size()), name.data(),
-              now, _status->manual_down_time, _status->manual_marked_down, Reason::MANUAL_REASON);
+        Dbg(dbg_ctl_host_statuses, "name: %.*s, now: %ld, down_time: %d, marked_down: %ld, reason: %s", int(name.size()),
+            name.data(), now, _status->manual_down_time, _status->manual_marked_down, Reason::MANUAL_REASON);
         setHostStatus(name, TSHostStatus::TS_HOST_STATUS_UP, 0, Reason::MANUAL);
         reasons ^= Reason::MANUAL;
       }
@@ -435,7 +440,7 @@ server_get_status(std::string_view id, YAML::Node const &params)
         HostStatus  &hs       = HostStatus::instance();
         host_rec              = hs.getHostStatus(name);
         if (host_rec == nullptr) {
-          Debug("host_statuses", "no record for %s was found", name.c_str());
+          Dbg(dbg_ctl_host_statuses, "no record for %s was found", name.c_str());
           errorList.push_back("no record for " + name + " was found");
           continue;
         } else {
@@ -444,7 +449,7 @@ server_get_status(std::string_view id, YAML::Node const &params)
           host[HOST_NAME_KEY] = name;
           host[STATUS_KEY]    = s.str();
           statusList.push_back(host);
-          Debug("host_statuses", "hostname: %s, status: %s", name.c_str(), s.str().c_str());
+          Dbg(dbg_ctl_host_statuses, "hostname: %s, status: %s", name.c_str(), s.str().c_str());
         }
       }
     } else { // return all host statuses.
@@ -459,7 +464,7 @@ server_get_status(std::string_view id, YAML::Node const &params)
       }
     }
   } catch (std::exception const &ex) {
-    Debug("host_statuses", "Got an error decoding the parameters: %s", ex.what());
+    Dbg(dbg_ctl_host_statuses, "Got an error decoding the parameters: %s", ex.what());
     errorList.push_back("Error decoding parameters : " + std::string(ex.what()));
   }
 
@@ -473,7 +478,7 @@ server_get_status(std::string_view id, YAML::Node const &params)
 swoc::Rv<YAML::Node>
 server_set_status(std::string_view id, YAML::Node const &params)
 {
-  Debug("host_statuses", "id=%s", id.data());
+  Dbg(dbg_ctl_host_statuses, "id=%s", id.data());
   namespace err = rpc::handlers::errors;
   swoc::Rv<YAML::Node> resp;
 
@@ -484,8 +489,8 @@ server_set_status(std::string_view id, YAML::Node const &params)
       for (auto const &name : cmdInfo.hosts) {
         HostStatus &hs       = HostStatus::instance();
         std::string statName = stat_prefix + name;
-        Debug("host_statuses", "marking server %s : %s", name.c_str(),
-              (cmdInfo.type == TSHostStatus::TS_HOST_STATUS_UP ? "up" : "down"));
+        Dbg(dbg_ctl_host_statuses, "marking server %s : %s", name.c_str(),
+            (cmdInfo.type == TSHostStatus::TS_HOST_STATUS_UP ? "up" : "down"));
         hs.setHostStatus(name.c_str(), cmdInfo.type, cmdInfo.time, cmdInfo.reasonType);
       }
     } else {
@@ -493,10 +498,10 @@ server_set_status(std::string_view id, YAML::Node const &params)
     }
 
     // schedule a write to the persistent store.
-    Debug("host_statuses", "updating persistent store");
+    Dbg(dbg_ctl_host_statuses, "updating persistent store");
     eventProcessor.schedule_imm(HostStatusSync::new_instance(), ET_TASK);
   } catch (std::exception const &ex) {
-    Debug("host_statuses", "Got an error HostCmdInfo decoding: %s", ex.what());
+    Dbg(dbg_ctl_host_statuses, "Got an error HostCmdInfo decoding: %s", ex.what());
     resp.errata()
       .assign(std::error_code{rpc::handlers::errors::Codes::SERVER})
       .note("Error found during host status set: {}", ex.what());
diff --git a/src/proxy/ParentSelectionStrategy.cc b/src/proxy/ParentSelectionStrategy.cc
index d105d0cf01..2bc532bef9 100644
--- a/src/proxy/ParentSelectionStrategy.cc
+++ b/src/proxy/ParentSelectionStrategy.cc
@@ -23,6 +23,12 @@
 
 #include "proxy/ParentSelection.h"
 
+namespace
+{
+DbgCtl dbg_ctl_parent_select{"parent_select"};
+
+} // end anonymous namespace
+
 void
 ParentSelectionStrategy::markParentDown(ParentResult *result, unsigned int fail_threshold, unsigned int retry_time)
 {
@@ -83,7 +89,7 @@ ParentSelectionStrategy::markParentDown(ParentResult *result, unsigned int fail_
       old_count = pRec->failCount.fetch_add(1, std::memory_order_relaxed);
     }
 
-    Debug("parent_select", "Parent fail count increased to %d for %s:%d", old_count + 1, pRec->hostname, pRec->port);
+    Dbg(dbg_ctl_parent_select, "Parent fail count increased to %d for %s:%d", old_count + 1, pRec->hostname, pRec->port);
     new_fail_count = old_count + 1;
   }
 
@@ -91,8 +97,8 @@ ParentSelectionStrategy::markParentDown(ParentResult *result, unsigned int fail_
     Note("Failure threshold met failcount:%d >= threshold:%d, http parent proxy %s:%d marked down with request: %s", new_fail_count,
          fail_threshold, pRec->hostname, pRec->port, result->url);
     pRec->available = false;
-    Debug("parent_select", "Parent %s:%d marked unavailable, pRec->available=%d", pRec->hostname, pRec->port,
-          pRec->available.load());
+    Dbg(dbg_ctl_parent_select, "Parent %s:%d marked unavailable, pRec->available=%d", pRec->hostname, pRec->port,
+        pRec->available.load());
   }
 }
 
diff --git a/src/proxy/ProtocolProbeSessionAccept.cc b/src/proxy/ProtocolProbeSessionAccept.cc
index 2996d2000d..8f76c95a1c 100644
--- a/src/proxy/ProtocolProbeSessionAccept.cc
+++ b/src/proxy/ProtocolProbeSessionAccept.cc
@@ -29,7 +29,9 @@
 #include "iocore/net/NetVConnection.h"
 #include "proxy/http/HttpConfig.h"
 
-static bool
+namespace
+{
+bool
 proto_is_http2(IOBufferReader *reader)
 {
   char      buf[HTTP2_CONNECTION_PREFACE_LEN];
@@ -48,6 +50,11 @@ proto_is_http2(IOBufferReader *reader)
   return memcmp(HTTP2_CONNECTION_PREFACE, buf, nbytes) == 0;
 }
 
+DbgCtl dbg_ctl_proxyprotocol{"proxyprotocol"};
+DbgCtl dbg_ctl_http{"http"};
+
+} // end anonymous namespace
+
 struct ProtocolProbeTrampoline : public Continuation, public ProtocolProbeSessionAcceptEnums {
   static const size_t   minimum_read_size = 1;
   static const unsigned buffer_size_index = CLIENT_CONNECTION_FIRST_READ_BUFFER_SIZE_INDEX;
@@ -103,28 +110,28 @@ struct ProtocolProbeTrampoline : public Continuation, public ProtocolProbeSessio
     pp_ipmap = probeParent->proxy_protocol_ipmap;
 
     if (netvc->get_is_proxy_protocol() && netvc->get_proxy_protocol_version() == ProxyProtocolVersion::UNDEFINED) {
-      Debug("proxyprotocol", "ioCompletionEvent: proxy protocol is enabled on this port");
+      Dbg(dbg_ctl_proxyprotocol, "ioCompletionEvent: proxy protocol is enabled on this port");
       if (pp_ipmap->count() > 0) {
-        Debug("proxyprotocol", "ioCompletionEvent: proxy protocol has a configured allowlist of trusted IPs - checking");
+        Dbg(dbg_ctl_proxyprotocol, "ioCompletionEvent: proxy protocol has a configured allowlist of trusted IPs - checking");
         if (!pp_ipmap->contains(swoc::IPAddr(netvc->get_remote_addr()))) {
-          Debug("proxyprotocol",
-                "ioCompletionEvent: Source IP is NOT in the configured allowlist of trusted IPs - closing connection");
+          Dbg(dbg_ctl_proxyprotocol,
+              "ioCompletionEvent: Source IP is NOT in the configured allowlist of trusted IPs - closing connection");
           goto done;
         } else {
           char new_host[INET6_ADDRSTRLEN];
-          Debug("proxyprotocol", "ioCompletionEvent: Source IP [%s] is trusted in the allowlist for proxy protocol",
-                ats_ip_ntop(netvc->get_remote_addr(), new_host, sizeof(new_host)));
+          Dbg(dbg_ctl_proxyprotocol, "ioCompletionEvent: Source IP [%s] is trusted in the allowlist for proxy protocol",
+              ats_ip_ntop(netvc->get_remote_addr(), new_host, sizeof(new_host)));
         }
       } else {
-        Debug("proxyprotocol",
-              "ioCompletionEvent: proxy protocol DOES NOT have a configured allowlist of trusted IPs but proxy protocol is "
-              "ernabled on this port - processing all connections");
+        Dbg(dbg_ctl_proxyprotocol,
+            "ioCompletionEvent: proxy protocol DOES NOT have a configured allowlist of trusted IPs but proxy protocol is "
+            "ernabled on this port - processing all connections");
       }
 
       if (netvc->has_proxy_protocol(reader)) {
-        Debug("proxyprotocol", "ioCompletionEvent: http has proxy protocol header");
+        Dbg(dbg_ctl_proxyprotocol, "ioCompletionEvent: http has proxy protocol header");
       } else {
-        Debug("proxyprotocol", "ioCompletionEvent: proxy protocol was enabled, but Proxy Protocol header was not present");
+        Dbg(dbg_ctl_proxyprotocol, "ioCompletionEvent: proxy protocol was enabled, but Proxy Protocol header was not present");
       }
     } // end of Proxy Protocol processing
 
@@ -186,11 +193,11 @@ ProtocolProbeSessionAccept::mainEvent(int event, void *data)
     HttpConfig::release(param);
 
     if (!probe->reader->is_read_avail_more_than(0)) {
-      Debug("http", "probe needs data, read..");
+      Dbg(dbg_ctl_http, "probe needs data, read..");
       vio = netvc->do_io_read(probe, BUFFER_SIZE_FOR_INDEX(ProtocolProbeTrampoline::buffer_size_index), probe->iobuf);
       vio->reenable();
     } else {
-      Debug("http", "probe already has data, call ioComplete directly..");
+      Dbg(dbg_ctl_http, "probe already has data, call ioComplete directly..");
       vio = netvc->do_io_read(this, 0, nullptr);
       probe->ioCompletionEvent(VC_EVENT_READ_COMPLETE, (void *)vio);
     }
diff --git a/src/proxy/ReverseProxy.cc b/src/proxy/ReverseProxy.cc
index 85a917809b..796e7eca66 100644
--- a/src/proxy/ReverseProxy.cc
+++ b/src/proxy/ReverseProxy.cc
@@ -42,8 +42,15 @@
 #include "proxy/http/remap/UrlRewrite.h"
 #include "proxy/http/remap/UrlMapping.h"
 
+namespace
+{
+Ptr<ProxyMutex> reconfig_mutex;
+
+DbgCtl dbg_ctl_url_rewrite{"url_rewrite"};
+
+} // end anonymous namespace
+
 // Global Ptrs
-static Ptr<ProxyMutex>            reconfig_mutex;
 UrlRewrite                       *rewrite_table       = nullptr;
 thread_local PluginThreadContext *pluginThreadContext = nullptr;
 
@@ -134,7 +141,7 @@ reloadUrlRewrite()
   UrlRewrite *newTable, *oldTable;
 
   Note("%s loading ...", ts::filename::REMAP);
-  Debug("url_rewrite", "%s updated, reloading...", ts::filename::REMAP);
+  Dbg(dbg_ctl_url_rewrite, "%s updated, reloading...", ts::filename::REMAP);
   newTable = new UrlRewrite();
   if (newTable->load()) {
     static const char *msg_format = "%s finished loading";
@@ -150,14 +157,14 @@ reloadUrlRewrite()
     // Release the old one
     oldTable->release();
 
-    Debug("url_rewrite", msg_format, ts::filename::REMAP);
+    Dbg(dbg_ctl_url_rewrite, msg_format, ts::filename::REMAP);
     Note(msg_format, ts::filename::REMAP);
     return true;
   } else {
     static const char *msg_format = "%s failed to load";
 
     delete newTable;
-    Debug("url_rewrite", msg_format, ts::filename::REMAP);
+    Dbg(dbg_ctl_url_rewrite, msg_format, ts::filename::REMAP);
     Error(msg_format, ts::filename::REMAP);
     return false;
   }
diff --git a/src/proxy/Transform.cc b/src/proxy/Transform.cc
index d3fa39432e..60af2983a1 100644
--- a/src/proxy/Transform.cc
+++ b/src/proxy/Transform.cc
@@ -67,6 +67,13 @@
 
 TransformProcessor transformProcessor;
 
+namespace
+{
+DbgCtl dbg_ctl_transform{"transform"};
+DbgCtl dbg_ctl_http_trans{"http_trans"};
+
+} // end anonymous namespace
+
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
 
@@ -141,7 +148,7 @@ TransformTerminus::handle_event(int event, void * /* edata ATS_UNUSED */)
 
   val = ink_atomic_increment(&m_event_count, -1);
 
-  Debug("transform", "[TransformTerminus::handle_event] event_count %d", m_event_count);
+  Dbg(dbg_ctl_transform, "[TransformTerminus::handle_event] event_count %d", m_event_count);
 
   if (val <= 0) {
     ink_assert(!"not reached");
@@ -151,15 +158,15 @@ TransformTerminus::handle_event(int event, void * /* edata ATS_UNUSED */)
 
   if (m_closed != 0 && m_tvc->m_closed != 0) {
     if (m_deletable) {
-      Debug("transform", "TransformVConnection destroy [0x%lx]", (long)m_tvc);
+      Dbg(dbg_ctl_transform, "TransformVConnection destroy [0x%lx]", (long)m_tvc);
       delete m_tvc;
       return 0;
     }
   } else if (m_write_vio.op == VIO::WRITE) {
     if (m_read_vio.op == VIO::NONE) {
       if (!m_called_user) {
-        Debug("transform", "TransformVConnection calling user: %d %d [0x%lx] [0x%lx]", m_event_count, event, (long)m_tvc,
-              (long)m_tvc->m_cont);
+        Dbg(dbg_ctl_transform, "TransformVConnection calling user: %d %d [0x%lx] [0x%lx]", m_event_count, event, (long)m_tvc,
+            (long)m_tvc->m_cont);
 
         m_called_user = 1;
         // It is our belief this is safe to pass a reference, i.e. its scope
@@ -278,7 +285,7 @@ TransformTerminus::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
   if (ink_atomic_increment(&m_event_count, 1) < 0) {
     ink_assert(!"not reached");
   }
-  Debug("transform", "[TransformTerminus::do_io_read] event_count %d", m_event_count);
+  Dbg(dbg_ctl_transform, "[TransformTerminus::do_io_read] event_count %d", m_event_count);
 
   this_ethread()->schedule_imm_local(this);
 
@@ -303,7 +310,7 @@ TransformTerminus::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *
   if (ink_atomic_increment(&m_event_count, 1) < 0) {
     ink_assert(!"not reached");
   }
-  Debug("transform", "[TransformTerminus::do_io_write] event_count %d", m_event_count);
+  Dbg(dbg_ctl_transform, "[TransformTerminus::do_io_write] event_count %d", m_event_count);
 
   this_ethread()->schedule_imm_local(this);
 
@@ -367,11 +374,11 @@ TransformTerminus::reenable(VIO *vio)
     if (ink_atomic_increment(&m_event_count, 1) < 0) {
       ink_assert(!"not reached");
     }
-    Debug("transform", "[TransformTerminus::reenable] event_count %d", m_event_count);
+    Dbg(dbg_ctl_transform, "[TransformTerminus::reenable] event_count %d", m_event_count);
     this_ethread()->schedule_imm_local(this);
   } else {
-    Debug("transform", "[TransformTerminus::reenable] skipping due to "
-                       "pending events");
+    Dbg(dbg_ctl_transform, "[TransformTerminus::reenable] skipping due to "
+                           "pending events");
   }
 }
 
@@ -396,7 +403,7 @@ TransformVConnection::TransformVConnection(Continuation *cont, APIHook *hooks)
   xform = (INKVConnInternal *)hooks->m_cont;
   xform->do_io_transform(&m_terminus);
 
-  Debug("transform", "TransformVConnection create [0x%lx]", (long)this);
+  Dbg(dbg_ctl_transform, "TransformVConnection create [0x%lx]", (long)this);
 }
 
 /*-------------------------------------------------------------------------
@@ -428,7 +435,7 @@ TransformVConnection::handle_event(int /* event ATS_UNUSED */, void * /* edata A
 VIO *
 TransformVConnection::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
 {
-  Debug("transform", "TransformVConnection do_io_read: 0x%lx [0x%lx]", (long)c, (long)this);
+  Dbg(dbg_ctl_transform, "TransformVConnection do_io_read: 0x%lx [0x%lx]", (long)c, (long)this);
 
   return m_terminus.do_io_read(c, nbytes, buf);
 }
@@ -439,7 +446,7 @@ TransformVConnection::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf
 VIO *
 TransformVConnection::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool /* owner ATS_UNUSED */)
 {
-  Debug("transform", "TransformVConnection do_io_write: 0x%lx [0x%lx]", (long)c, (long)this);
+  Dbg(dbg_ctl_transform, "TransformVConnection do_io_write: 0x%lx [0x%lx]", (long)c, (long)this);
 
   return m_transform->do_io_write(c, nbytes, buf);
 }
@@ -450,7 +457,7 @@ TransformVConnection::do_io_write(Continuation *c, int64_t nbytes, IOBufferReade
 void
 TransformVConnection::do_io_close(int error)
 {
-  Debug("transform", "TransformVConnection do_io_close: %d [0x%lx]", error, (long)this);
+  Dbg(dbg_ctl_transform, "TransformVConnection do_io_close: %d [0x%lx]", error, (long)this);
 
   if (m_closed != 0) {
     return;
@@ -474,7 +481,7 @@ TransformVConnection::do_io_shutdown(ShutdownHowTo_t howto)
 {
   ink_assert(howto == IO_SHUTDOWN_WRITE);
 
-  Debug("transform", "TransformVConnection do_io_shutdown: %d [0x%lx]", howto, (long)this);
+  Dbg(dbg_ctl_transform, "TransformVConnection do_io_shutdown: %d [0x%lx]", howto, (long)this);
 
   m_transform->do_io_shutdown(howto);
 }
@@ -601,7 +608,7 @@ NullTransform::NullTransform(ProxyMutex *_mutex)
 {
   SET_HANDLER(&NullTransform::handle_event);
 
-  Debug("transform", "NullTransform create [0x%lx]", (long)this);
+  Dbg(dbg_ctl_transform, "NullTransform create [0x%lx]", (long)this);
 }
 
 /*-------------------------------------------------------------------------
@@ -622,11 +629,11 @@ NullTransform::handle_event(int event, void *edata)
 {
   handle_event_count(event);
 
-  Debug("transform", "[NullTransform::handle_event] event count %d", m_event_count);
+  Dbg(dbg_ctl_transform, "[NullTransform::handle_event] event count %d", m_event_count);
 
   if (m_closed) {
     if (m_deletable) {
-      Debug("transform", "NullTransform destroy: %" PRId64 " [%p]", m_output_vio ? m_output_vio->ndone : 0, this);
+      Dbg(dbg_ctl_transform, "NullTransform destroy: %" PRId64 " [%p]", m_output_vio ? m_output_vio->ndone : 0, this);
       delete this;
     }
   } else {
@@ -681,10 +688,10 @@ NullTransform::handle_event(int event, void *edata)
         }
 
         if (towrite > 0) {
-          Debug("transform",
-                "[NullTransform::handle_event] "
-                "writing %" PRId64 " bytes to output",
-                towrite);
+          Dbg(dbg_ctl_transform,
+              "[NullTransform::handle_event] "
+              "writing %" PRId64 " bytes to output",
+              towrite);
           m_output_buf->write(m_write_vio.get_reader(), towrite);
 
           m_write_vio.get_reader()->consume(towrite);
@@ -758,7 +765,7 @@ RangeTransform::RangeTransform(ProxyMutex *mut, RangeRecord *ranges, int num_fie
   SET_HANDLER(&RangeTransform::handle_event);
 
   m_num_chars_for_cl = num_chars_for_int(m_range_content_length);
-  Debug("http_trans", "RangeTransform creation finishes");
+  Dbg(dbg_ctl_http_trans, "RangeTransform creation finishes");
 }
 
 /*-------------------------------------------------------------------------
@@ -782,9 +789,9 @@ RangeTransform::handle_event(int event, void *edata)
   if (m_closed) {
     if (m_deletable) {
       if (m_output_vc != nullptr) {
-        Debug("http_trans", "RangeTransform destroy: %p ndone=%" PRId64, this, m_output_vio ? m_output_vio->ndone : 0);
+        Dbg(dbg_ctl_http_trans, "RangeTransform destroy: %p ndone=%" PRId64, this, m_output_vio ? m_output_vio->ndone : 0);
       } else {
-        Debug("http_trans", "RangeTransform destroy");
+        Dbg(dbg_ctl_http_trans, "RangeTransform destroy");
       }
       delete this;
     }
@@ -909,7 +916,7 @@ RangeTransform::transform_to_range()
           add_boundary(true);
         }
 
-        Debug("http_trans", "total bytes of Range response body is %" PRId64, m_done);
+        Dbg(dbg_ctl_http_trans, "total bytes of Range response body is %" PRId64, m_done);
         m_output_vio->nbytes = m_done;
         m_output_vio->reenable();
 
diff --git a/src/proxy/http3/Http09App.cc b/src/proxy/http3/Http09App.cc
index e6bf6fbbd2..32c6cafe07 100644
--- a/src/proxy/http3/Http09App.cc
+++ b/src/proxy/http3/Http09App.cc
@@ -34,8 +34,15 @@
 #include "proxy/http3/Http3Session.h"
 #include "proxy/http3/Http3Transaction.h"
 
-static constexpr char debug_tag[]   = "quic_simple_app";
-static constexpr char debug_tag_v[] = "v_quic_simple_app";
+namespace
+{
+constexpr char debug_tag[]   = "quic_simple_app";
+constexpr char debug_tag_v[] = "v_quic_simple_app";
+
+DbgCtl dbg_ctl{debug_tag};
+DbgCtl dbg_ctl_v{debug_tag_v};
+
+} // end anonymous namespace
 
 Http09App::Http09App(NetVConnection *client_vc, QUICConnection *qc, IpAllow::ACL &&session_acl,
                      const HttpSessionAccept::Options &options)
@@ -89,13 +96,13 @@ Http09App::on_stream_close(QUICStream &stream)
 int
 Http09App::main_event_handler(int event, Event *data)
 {
-  Debug(debug_tag_v, "[%s] %s (%d)", this->_qc->cids().data(), get_vc_event_name(event), event);
+  Dbg(dbg_ctl_v, "[%s] %s (%d)", this->_qc->cids().data(), get_vc_event_name(event), event);
 
   VIO                 *vio     = reinterpret_cast<VIO *>(data->cookie);
   QUICStreamVCAdapter *adapter = static_cast<QUICStreamVCAdapter *>(vio->vc_server);
 
   if (adapter == nullptr) {
-    Debug(debug_tag, "[%s] Unknown Stream", this->_qc->cids().data());
+    Dbg(dbg_ctl, "[%s] Unknown Stream", this->_qc->cids().data());
     return -1;
   }
 
diff --git a/src/proxy/http3/Http3App.cc b/src/proxy/http3/Http3App.cc
index 7226b08d49..e24f90e9ea 100644
--- a/src/proxy/http3/Http3App.cc
+++ b/src/proxy/http3/Http3App.cc
@@ -41,8 +41,15 @@
 #include "proxy/http3/Http3SettingsHandler.h"
 #include "proxy/http3/Http3SettingsFramer.h"
 
-static constexpr char debug_tag[]   = "http3";
-static constexpr char debug_tag_v[] = "v_http3";
+namespace
+{
+constexpr char debug_tag[]   = "http3";
+constexpr char debug_tag_v[] = "v_http3";
+
+DbgCtl dbg_ctl{debug_tag};
+DbgCtl dbg_ctl_v{debug_tag_v};
+
+} // end anonymous namespace
 
 Http3App::Http3App(NetVConnection *client_vc, QUICConnection *qc, IpAllow::ACL &&session_acl,
                    const HttpSessionAccept::Options &options)
@@ -130,13 +137,13 @@ Http3App::on_stream_close(QUICStream &stream)
 int
 Http3App::main_event_handler(int event, Event *data)
 {
-  Debug(debug_tag_v, "[%s] %s (%d)", this->_qc->cids().data(), get_vc_event_name(event), event);
+  Dbg(dbg_ctl_v, "[%s] %s (%d)", this->_qc->cids().data(), get_vc_event_name(event), event);
 
   VIO                 *vio     = reinterpret_cast<VIO *>(data->cookie);
   QUICStreamVCAdapter *adapter = static_cast<QUICStreamVCAdapter *>(vio->vc_server);
 
   if (adapter == nullptr) {
-    Debug(debug_tag, "[%s] Unknown Stream", this->_qc->cids().data());
+    Dbg(dbg_ctl, "[%s] Unknown Stream", this->_qc->cids().data());
     return -1;
   }
 
@@ -203,9 +210,9 @@ Http3App::create_uni_stream(QUICStreamId &new_stream_id, Http3StreamType type)
   if (error == nullptr) {
     this->_local_uni_stream_map.insert(std::make_pair(new_stream_id, type));
 
-    Debug("http3", "[%" PRIu64 "] %s stream is created", new_stream_id, Http3DebugNames::stream_type(type));
+    Dbg(dbg_ctl, "[%" PRIu64 "] %s stream is created", new_stream_id, Http3DebugNames::stream_type(type));
   } else {
-    Debug("http3", "Could not create %s stream", Http3DebugNames::stream_type(type));
+    Dbg(dbg_ctl, "Could not create %s stream", Http3DebugNames::stream_type(type));
   }
 
   return error;
@@ -224,7 +231,7 @@ Http3App::_handle_uni_stream_on_read_ready(int /* event */, VIO *vio)
     vio->get_reader()->read(&buf, 1);
     type = Http3Stream::type(&buf);
 
-    Debug("http3", "[%" PRIu64 "] %s stream is opened", adapter->stream().id(), Http3DebugNames::stream_type(type));
+    Dbg(dbg_ctl, "[%" PRIu64 "] %s stream is opened", adapter->stream().id(), Http3DebugNames::stream_type(type));
 
     auto ret = this->_remote_uni_stream_map.insert(std::make_pair(adapter->stream().id(), type));
     if (!ret.second) {
@@ -242,13 +249,13 @@ Http3App::_handle_uni_stream_on_read_ready(int /* event */, VIO *vio)
     } else if (this->_control_stream_id != adapter->stream().id()) {
       error = std::make_unique<Http3Error>(Http3ErrorClass::CONNECTION, Http3ErrorCode::H3_STREAM_CREATION_ERROR,
                                            "Only one control stream per peer is permitted");
-      Debug("http3", "CONTROL stream [%" PRIu64 "] error: %hu, %s", this->_control_stream_id, error->get_code(), error->msg);
+      Dbg(dbg_ctl, "CONTROL stream [%" PRIu64 "] error: %hu, %s", this->_control_stream_id, error->get_code(), error->msg);
       break;
     }
     uint64_t nread = 0;
     error          = this->_control_stream_dispatcher.on_read_ready(adapter->stream().id(), type, *vio->get_reader(), nread);
     if (error && error->cls != Http3ErrorClass::UNDEFINED) {
-      Debug("http3", "CONTROL stream [%" PRIu64 "] error: %hu, %s", this->_control_stream_id, error->get_code(), error->msg);
+      Dbg(dbg_ctl, "CONTROL stream [%" PRIu64 "] error: %hu, %s", this->_control_stream_id, error->get_code(), error->msg);
     }
     // The sender MUST NOT close the control stream, and the receiver MUST NOT request that the sender close the control stream.
     // If either control stream is closed at any point, this MUST be treated as a connection error of type
@@ -258,7 +265,7 @@ Http3App::_handle_uni_stream_on_read_ready(int /* event */, VIO *vio)
   case Http3StreamType::PUSH: {
     error =
       std::make_unique<Http3Error>(Http3ErrorClass::CONNECTION, Http3ErrorCode::H3_STREAM_CREATION_ERROR, "Only servers can push");
-    Debug("http3", "PUSH stream [%" PRIu64 "] error: %hu, %s", adapter->stream().id(), error->get_code(), error->msg);
+    Dbg(dbg_ctl, "PUSH stream [%" PRIu64 "] error: %hu, %s", adapter->stream().id(), error->get_code(), error->msg);
     // if a server receives a client-initiated push stream, this MUST be treated as a connection error of type
     // H3_STREAM_CREATION_ERROR
     break;
@@ -273,7 +280,7 @@ Http3App::_handle_uni_stream_on_read_ready(int /* event */, VIO *vio)
     // processing. If reading is aborted, the recipient SHOULD use the H3_STREAM_CREATION_ERROR error code or a reserved error code
     // (Section 8.1). The recipient MUST NOT consider unknown stream types to be a connection error of any kind.
     error = std::make_unique<Http3Error>(Http3ErrorClass::STREAM, Http3ErrorCode::H3_STREAM_CREATION_ERROR, "Stream type unkown");
-    Debug("http3", "UNKNOWN stream [%" PRIu64 "] error: %hu, %s", adapter->stream().id(), error->get_code(), error->msg);
+    Dbg(dbg_ctl, "UNKNOWN stream [%" PRIu64 "] error: %hu, %s", adapter->stream().id(), error->get_code(), error->msg);
     break;
   }
   default:
diff --git a/src/proxy/http3/Http3Frame.cc b/src/proxy/http3/Http3Frame.cc
index cecb3f50f1..c429919217 100644
--- a/src/proxy/http3/Http3Frame.cc
+++ b/src/proxy/http3/Http3Frame.cc
@@ -31,8 +31,14 @@ ClassAllocator<Http3DataFrame>     http3DataFrameAllocator("http3DataFrameAlloca
 ClassAllocator<Http3HeadersFrame>  http3HeadersFrameAllocator("http3HeadersFrameAllocator");
 ClassAllocator<Http3SettingsFrame> http3SettingsFrameAllocator("http3SettingsFrameAllocator");
 
+namespace
+{
 constexpr int HEADER_OVERHEAD = 10; // This should work as long as a payload length is less than 64 bits
 
+DbgCtl dbg_ctl_http3_frame_factory{"http3_frame_factory"};
+
+} // end anonymous namespace
+
 //
 // Static functions
 //
@@ -419,7 +425,7 @@ Http3FrameFactory::create(const uint8_t *buf, size_t len)
     return Http3FrameUPtr(frame, &Http3FrameDeleter::delete_settings_frame);
   default:
     // Unknown frame
-    Debug("http3_frame_factory", "Unknown frame type %hhx", static_cast<uint8_t>(type));
+    Dbg(dbg_ctl_http3_frame_factory, "Unknown frame type %hhx", static_cast<uint8_t>(type));
     frame = http3FrameAllocator.alloc();
     new (frame) Http3Frame(buf, len);
     return Http3FrameUPtr(frame, &Http3FrameDeleter::delete_frame);
diff --git a/src/proxy/http3/Http3FrameCollector.cc b/src/proxy/http3/Http3FrameCollector.cc
index 998e02bffb..864fe2ac97 100644
--- a/src/proxy/http3/Http3FrameCollector.cc
+++ b/src/proxy/http3/Http3FrameCollector.cc
@@ -25,6 +25,12 @@
 
 #include "proxy/http3/Http3DebugNames.h"
 
+namespace
+{
+DbgCtl dbg_ctl_http3{"http3"};
+
+} // end anonymous namespace
+
 Http3ErrorUPtr
 Http3FrameCollector::on_write_ready(QUICStreamId stream_id, MIOBuffer &writer, size_t &nwritten, bool &all_done)
 {
@@ -41,7 +47,7 @@ Http3FrameCollector::on_write_ready(QUICStreamId stream_id, MIOBuffer &writer, s
       auto b    = frame->to_io_buffer_block();
       len       = writer.write(b.get(), INT64_MAX, 0);
       nwritten += len;
-      Debug("http3", "[TX] [%" PRIu64 "] | %s size=%zu", stream_id, Http3DebugNames::frame_type(frame->type()), len);
+      Dbg(dbg_ctl_http3, "[TX] [%" PRIu64 "] | %s size=%zu", stream_id, Http3DebugNames::frame_type(frame->type()), len);
     }
 
     all_done &= g->is_done();
diff --git a/src/proxy/http3/Http3FrameDispatcher.cc b/src/proxy/http3/Http3FrameDispatcher.cc
index 19acf264f6..ae1a6e4771 100644
--- a/src/proxy/http3/Http3FrameDispatcher.cc
+++ b/src/proxy/http3/Http3FrameDispatcher.cc
@@ -28,6 +28,13 @@
 
 #include "proxy/http3/Http3DebugNames.h"
 
+namespace
+{
+DbgCtl dbg_ctl_v_http3{"v_http3"};
+DbgCtl dbg_ctl_http3{"http3"};
+
+} // end anonymous namespace
+
 //
 // Frame Dispatcher
 //
@@ -53,13 +60,13 @@ Http3FrameDispatcher::on_read_ready(QUICStreamId stream_id, Http3StreamType stre
     uint8_t head[16];
     auto    p        = reader.memcpy(head, 16);
     int64_t read_len = p - reinterpret_cast<char *>(head);
-    Debug("v_http3", "reading H3 frame: state=%d read_len=%" PRId64, this->_reading_state, read_len);
+    Dbg(dbg_ctl_v_http3, "reading H3 frame: state=%d read_len=%" PRId64, this->_reading_state, read_len);
 
     if (this->_reading_state == READING_TYPE_LEN) {
       if (read_len >= 1) {
         this->_reading_frame_type_len = QUICVariableInt::size(head);
         this->_reading_state          = READING_LENGTH_LEN;
-        Debug("v_http3", "type_len=%" PRId64, this->_reading_frame_type_len);
+        Dbg(dbg_ctl_v_http3, "type_len=%" PRId64, this->_reading_frame_type_len);
       } else {
         break;
       }
@@ -69,7 +76,7 @@ Http3FrameDispatcher::on_read_ready(QUICStreamId stream_id, Http3StreamType stre
       if (read_len >= this->_reading_frame_type_len + 1) {
         this->_reading_frame_length_len = QUICVariableInt::size(head + this->_reading_frame_type_len);
         this->_reading_state            = READING_PAYLOAD_LEN;
-        Debug("v_http3", "length_len=%" PRId64, this->_reading_frame_length_len);
+        Dbg(dbg_ctl_v_http3, "length_len=%" PRId64, this->_reading_frame_length_len);
       } else {
         break;
       }
@@ -79,7 +86,7 @@ Http3FrameDispatcher::on_read_ready(QUICStreamId stream_id, Http3StreamType stre
       if (read_len >= this->_reading_frame_type_len + this->_reading_frame_length_len) {
         size_t dummy;
         QUICVariableInt::decode(this->_reading_frame_payload_len, dummy, head + this->_reading_frame_type_len);
-        Debug("v_http3", "payload_len=%" PRId64, this->_reading_frame_payload_len);
+        Dbg(dbg_ctl_v_http3, "payload_len=%" PRId64, this->_reading_frame_payload_len);
         this->_reading_state = READING_PAYLOAD;
       } else {
         break;
@@ -104,7 +111,7 @@ Http3FrameDispatcher::on_read_ready(QUICStreamId stream_id, Http3StreamType stre
 
       // Dispatch
       Http3FrameType type = frame->type();
-      Debug("http3", "[RX] [%" PRIu64 "] | %s size=%zu", stream_id, Http3DebugNames::frame_type(type), frame_len);
+      Dbg(dbg_ctl_http3, "[RX] [%" PRIu64 "] | %s size=%zu", stream_id, Http3DebugNames::frame_type(type), frame_len);
       std::vector<Http3FrameHandler *> handlers = this->_handlers[static_cast<uint8_t>(type)];
       for (auto h : handlers) {
         error = h->handle_frame(frame, frame_count - 1, stream_type);
diff --git a/src/proxy/http3/Http3HeaderFramer.cc b/src/proxy/http3/Http3HeaderFramer.cc
index 6a23a74937..7480a7f1d4 100644
--- a/src/proxy/http3/Http3HeaderFramer.cc
+++ b/src/proxy/http3/Http3HeaderFramer.cc
@@ -30,6 +30,12 @@
 #include "proxy/http3/Http3Frame.h"
 #include "proxy/http3/Http3Transaction.h"
 
+namespace
+{
+DbgCtl dbg_ctl_http3_trans{"http3_trans"};
+
+} // end anonymous namespace
+
 Http3HeaderFramer::Http3HeaderFramer(Http3Transaction *transaction, VIO *source, QPACK *qpack, uint64_t stream_id)
   : _transaction(transaction), _source_vio(source), _qpack(qpack), _stream_id(stream_id)
 {
@@ -109,7 +115,7 @@ Http3HeaderFramer::_generate_header_block()
   case PARSE_RESULT_CONT:
     break;
   default:
-    Debug("http3_trans", "Ignore invalid headers");
+    Dbg(dbg_ctl_http3_trans, "Ignore invalid headers");
     break;
   }
 }
diff --git a/src/proxy/http3/Http3HeaderVIOAdaptor.cc b/src/proxy/http3/Http3HeaderVIOAdaptor.cc
index 8dd59a1b70..5c9e174f27 100644
--- a/src/proxy/http3/Http3HeaderVIOAdaptor.cc
+++ b/src/proxy/http3/Http3HeaderVIOAdaptor.cc
@@ -27,6 +27,13 @@
 #include "iocore/eventsystem/VIO.h"
 #include "proxy/hdrs/HTTP.h"
 
+namespace
+{
+DbgCtl dbg_ctl_http3{"http3"};
+DbgCtl dbg_ctl_v_http3{"v_http3"};
+
+} // end anonymous namespace
+
 Http3HeaderVIOAdaptor::Http3HeaderVIOAdaptor(VIO *sink, HTTPType http_type, QPACK *qpack, uint64_t stream_id)
   : _sink_vio(sink), _qpack(qpack), _stream_id(stream_id)
 {
@@ -58,9 +65,9 @@ Http3HeaderVIOAdaptor::handle_frame(std::shared_ptr<const Http3Frame> frame, int
     // When decoding is not blocked, continuation should be called directly?
   } else if (res == 1) {
     // Decoding is blocked.
-    Debug("http3", "Decoding is blocked. DecodeRequest is scheduled");
+    Dbg(dbg_ctl_http3, "Decoding is blocked. DecodeRequest is scheduled");
   } else if (res < 0) {
-    Debug("http3", "Error on decoding header (%d)", res);
+    Dbg(dbg_ctl_http3, "Error on decoding header (%d)", res);
   } else {
     ink_abort("should not be here");
   }
@@ -79,13 +86,13 @@ Http3HeaderVIOAdaptor::event_handler(int event, Event *data)
 {
   switch (event) {
   case QPACK_EVENT_DECODE_COMPLETE:
-    Debug("v_http3", "%s (%d)", "QPACK_EVENT_DECODE_COMPLETE", event);
+    Dbg(dbg_ctl_v_http3, "%s (%d)", "QPACK_EVENT_DECODE_COMPLETE", event);
     if (this->_on_qpack_decode_complete()) {
       // If READ_READY event is scheduled, should it be canceled?
     }
     break;
   case QPACK_EVENT_DECODE_FAILED:
-    Debug("v_http3", "%s (%d)", "QPACK_EVENT_DECODE_FAILED", event);
+    Dbg(dbg_ctl_v_http3, "%s (%d)", "QPACK_EVENT_DECODE_FAILED", event);
     // FIXME: handle error
     break;
   }
@@ -100,12 +107,12 @@ Http3HeaderVIOAdaptor::_on_qpack_decode_complete()
   constexpr static bool NON_TRAILER = false;
   if (!HeaderValidator::is_h2_h3_header_valid(this->_header, http_hdr_type_get(this->_header.m_http) == HTTP_TYPE_RESPONSE,
                                               NON_TRAILER)) {
-    Debug("http3", "Header is invalid");
+    Dbg(dbg_ctl_http3, "Header is invalid");
     return -1;
   }
   int res = this->_hvc.convert(this->_header, 3, 1);
   if (res != 0) {
-    Debug("http3", "PARSE_RESULT_ERROR");
+    Dbg(dbg_ctl_http3, "PARSE_RESULT_ERROR");
     return -1;
   }
 
diff --git a/src/proxy/http3/Http3SessionAccept.cc b/src/proxy/http3/Http3SessionAccept.cc
index 458a523dc4..5725322662 100644
--- a/src/proxy/http3/Http3SessionAccept.cc
+++ b/src/proxy/http3/Http3SessionAccept.cc
@@ -32,6 +32,12 @@
 #include "proxy/http3/Http09App.h"
 #include "proxy/http3/Http3App.h"
 
+namespace
+{
+DbgCtl dbg_ctl_http3{"http3"};
+
+} // end anonymous namespace
+
 Http3SessionAccept::Http3SessionAccept(const HttpSessionAccept::Options &_o) : SessionAccept(nullptr), options(_o)
 {
   SET_HANDLER(&Http3SessionAccept::mainEvent);
@@ -52,7 +58,7 @@ Http3SessionAccept::accept(NetVConnection *netvc, MIOBuffer *iobuf, IOBufferRead
   // RFC9114, section 3.2-2: Client must send the SNI extension.
   if (auto sni = netvc->get_service<TLSSNISupport>(); !sni || sni->get_sni_server_name()[0] == '\0') {
     ip_port_text_buffer ipb;
-    Debug("http3", "SNI not found in connection from %s.", ats_ip_nptop(client_ip, ipb, sizeof(ipb)));
+    Dbg(dbg_ctl_http3, "SNI not found in connection from %s.", ats_ip_nptop(client_ip, ipb, sizeof(ipb)));
     return false;
   }
 
@@ -60,19 +66,19 @@ Http3SessionAccept::accept(NetVConnection *netvc, MIOBuffer *iobuf, IOBufferRead
 
   QUICConnection *qc = netvc->get_service<QUICSupport>()->get_quic_connection();
 
-  if (is_debug_tag_set("http3")) {
+  if (dbg_ctl_http3.on()) {
     ip_port_text_buffer ipb;
 
-    Debug("http3", "[%s] accepted connection from %s transport type = %d", qc->cids().data(),
-          ats_ip_nptop(client_ip, ipb, sizeof(ipb)), netvc->attributes);
+    DbgPrint(dbg_ctl_http3, "[%s] accepted connection from %s transport type = %d", qc->cids().data(),
+             ats_ip_nptop(client_ip, ipb, sizeof(ipb)), netvc->attributes);
   }
   std::string_view alpn = qc->negotiated_application_name();
 
   if (IP_PROTO_TAG_HTTP_QUIC.compare(alpn) == 0 || IP_PROTO_TAG_HTTP_QUIC_D29.compare(alpn) == 0) {
-    Debug("http3", "[%s] start HTTP/0.9 app (ALPN=%.*s)", qc->cids().data(), static_cast<int>(alpn.length()), alpn.data());
+    Dbg(dbg_ctl_http3, "[%s] start HTTP/0.9 app (ALPN=%.*s)", qc->cids().data(), static_cast<int>(alpn.length()), alpn.data());
     new Http09App(netvc, qc, std::move(session_acl), this->options);
   } else if (IP_PROTO_TAG_HTTP_3.compare(alpn) == 0 || IP_PROTO_TAG_HTTP_3_D29.compare(alpn) == 0) {
-    Debug("http3", "[%s] start HTTP/3 app (ALPN=%.*s)", qc->cids().data(), static_cast<int>(alpn.length()), alpn.data());
+    Dbg(dbg_ctl_http3, "[%s] start HTTP/3 app (ALPN=%.*s)", qc->cids().data(), static_cast<int>(alpn.length()), alpn.data());
 
     Http3App *app = new Http3App(netvc, qc, std::move(session_acl), this->options);
     app->start();
diff --git a/src/proxy/http3/Http3SettingsHandler.cc b/src/proxy/http3/Http3SettingsHandler.cc
index 603c40dc52..b00e1fb866 100644
--- a/src/proxy/http3/Http3SettingsHandler.cc
+++ b/src/proxy/http3/Http3SettingsHandler.cc
@@ -23,6 +23,12 @@
 
 #include "proxy/http3/Http3SettingsHandler.h"
 
+namespace
+{
+DbgCtl dbg_ctl_http3{"http3"};
+
+} // end anonymous namespace
+
 //
 // SETTINGS frame handler
 //
@@ -53,28 +59,28 @@ Http3SettingsHandler::handle_frame(std::shared_ptr<const Http3Frame> frame, int3
     uint64_t header_table_size = settings_frame->get(Http3SettingsId::HEADER_TABLE_SIZE);
     this->_session->remote_qpack()->update_max_table_size(header_table_size);
 
-    Debug("http3", "SETTINGS_HEADER_TABLE_SIZE: %" PRId64, header_table_size);
+    Dbg(dbg_ctl_http3, "SETTINGS_HEADER_TABLE_SIZE: %" PRId64, header_table_size);
   }
 
   if (settings_frame->contains(Http3SettingsId::MAX_FIELD_SECTION_SIZE)) {
     uint64_t max_field_section_size = settings_frame->get(Http3SettingsId::MAX_FIELD_SECTION_SIZE);
     this->_session->remote_qpack()->update_max_field_section_size(max_field_section_size);
 
-    Debug("http3", "SETTINGS_MAX_FIELD_SECTION_SIZE: %" PRId64, max_field_section_size);
+    Dbg(dbg_ctl_http3, "SETTINGS_MAX_FIELD_SECTION_SIZE: %" PRId64, max_field_section_size);
   }
 
   if (settings_frame->contains(Http3SettingsId::QPACK_BLOCKED_STREAMS)) {
     uint64_t qpack_blocked_streams = settings_frame->get(Http3SettingsId::QPACK_BLOCKED_STREAMS);
     this->_session->remote_qpack()->update_max_blocking_streams(qpack_blocked_streams);
 
-    Debug("http3", "SETTINGS_QPACK_BLOCKED_STREAMS: %" PRId64, qpack_blocked_streams);
+    Dbg(dbg_ctl_http3, "SETTINGS_QPACK_BLOCKED_STREAMS: %" PRId64, qpack_blocked_streams);
   }
 
   if (settings_frame->contains(Http3SettingsId::NUM_PLACEHOLDERS)) {
     uint64_t num_placeholders = settings_frame->get(Http3SettingsId::NUM_PLACEHOLDERS);
     // TODO: update settings for priority tree
 
-    Debug("http3", "SETTINGS_NUM_PLACEHOLDERS: %" PRId64, num_placeholders);
+    Dbg(dbg_ctl_http3, "SETTINGS_NUM_PLACEHOLDERS: %" PRId64, num_placeholders);
   }
 
   return Http3ErrorUPtr(nullptr);
diff --git a/src/proxy/http3/Http3Transaction.cc b/src/proxy/http3/Http3Transaction.cc
index 687d64989b..ab6f2350bf 100644
--- a/src/proxy/http3/Http3Transaction.cc
+++ b/src/proxy/http3/Http3Transaction.cc
@@ -35,13 +35,20 @@
 
 #define NetVC2QUICCon(netvc) netvc->get_service<QUICSupport>()->get_quic_connection()
 
-#define Http3TransDebug(fmt, ...)                                                                              \
-  Debug("http3_trans", "[%s] [%" PRIx32 "] " fmt, NetVC2QUICCon(this->_proxy_ssn->get_netvc())->cids().data(), \
-        this->get_transaction_id(), ##__VA_ARGS__)
+#define Http3TransDebug(fmt, ...)                                                                                  \
+  Dbg(dbg_ctl_http3_trans, "[%s] [%" PRIx32 "] " fmt, NetVC2QUICCon(this->_proxy_ssn->get_netvc())->cids().data(), \
+      this->get_transaction_id(), ##__VA_ARGS__)
 
-#define Http3TransVDebug(fmt, ...)                                                                               \
-  Debug("v_http3_trans", "[%s] [%" PRIx32 "] " fmt, NetVC2QUICCon(this->_proxy_ssn->get_netvc())->cids().data(), \
-        this->get_transaction_id(), ##__VA_ARGS__)
+#define Http3TransVDebug(fmt, ...)                                                                                   \
+  Dbg(dbg_ctl_v_http3_trans, "[%s] [%" PRIx32 "] " fmt, NetVC2QUICCon(this->_proxy_ssn->get_netvc())->cids().data(), \
+      this->get_transaction_id(), ##__VA_ARGS__)
+
+namespace
+{
+DbgCtl dbg_ctl_http3_trans{"http3_trans"};
+DbgCtl dbg_ctl_v_http3_trans{"v_http3_trans"};
+
+} // end anonymous namespace
 
 // static void
 // dump_io_buffer(IOBufferReader *reader)
@@ -50,7 +57,7 @@
 //   uint8_t msg[1024]            = {0};
 //   int64_t msg_len              = 1024;
 //   int64_t read_len             = debug_reader->read(msg, msg_len);
-//   Debug("v_http3_trans", "len=%" PRId64 "\n%s\n", read_len, msg);
+//   Dbg(dbg_ctl_v_http3_trans, "len=%" PRId64 "\n%s\n", read_len, msg);
 // }
 
 //
diff --git a/src/proxy/http3/QPACK.cc b/src/proxy/http3/QPACK.cc
index 0919718678..a8b0e8116b 100644
--- a/src/proxy/http3/QPACK.cc
+++ b/src/proxy/http3/QPACK.cc
@@ -27,8 +27,14 @@
 #include "tscore/ink_defs.h"
 #include "tscore/ink_memory.h"
 
-#define QPACKDebug(fmt, ...)   Debug("qpack", "[%s] " fmt, this->_qc->cids().data(), ##__VA_ARGS__)
-#define QPACKDTDebug(fmt, ...) Debug("qpack", "" fmt, ##__VA_ARGS__)
+#define QPACKDebug(fmt, ...)   Dbg(dbg_ctl_qpack, "[%s] " fmt, this->_qc->cids().data(), ##__VA_ARGS__)
+#define QPACKDTDebug(fmt, ...) Dbg(dbg_ctl_qpack, "" fmt, ##__VA_ARGS__)
+
+namespace
+{
+DbgCtl dbg_ctl_qpack{"qpack"};
+
+} // end anonymous namespace
 
 // qpack-05 Appendix A.
 const QPACK::Header QPACK::StaticTable::STATIC_HEADER_FIELDS[] = {


(trafficserver) 08/08: Adding Cripts documentation structure (#11359)

Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 05f9b4e0fd9378ee66609c52832fe28074ce5367
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Wed May 15 16:47:50 2024 -0600

    Adding Cripts documentation structure (#11359)
    
    (cherry picked from commit 1e0f57495ba82fdf668917cec8eba91ccbbe9aac)
---
 doc/developer-guide/cripts/cripts-bundles.en.rst   |  26 ++
 .../cripts/cripts-connections.en.rst               |  26 ++
 doc/developer-guide/cripts/cripts-examples.en.rst  |  26 ++
 doc/developer-guide/cripts/cripts-headers.en.rst   | 163 ++++++++++++
 doc/developer-guide/cripts/cripts-matcher.en.rst   |  26 ++
 doc/developer-guide/cripts/cripts-misc.en.rst      |  26 ++
 doc/developer-guide/cripts/cripts-overview.en.rst  | 286 +++++++++++++++++++++
 doc/developer-guide/cripts/cripts-urls.en.rst      | 118 +++++++++
 doc/developer-guide/cripts/cripts-variables.en.rst | 155 +++++++++++
 doc/developer-guide/cripts/index.en.rst            |  36 +++
 doc/developer-guide/index.en.rst                   |   1 +
 11 files changed, 889 insertions(+)

diff --git a/doc/developer-guide/cripts/cripts-bundles.en.rst b/doc/developer-guide/cripts/cripts-bundles.en.rst
new file mode 100644
index 0000000000..c50efe31db
--- /dev/null
+++ b/doc/developer-guide/cripts/cripts-bundles.en.rst
@@ -0,0 +1,26 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+
+.. include:: ../../common.defs
+
+.. highlight:: cpp
+.. default-domain:: cpp
+
+.. _cripts-bundles:
+
+Bundles
+*******
diff --git a/doc/developer-guide/cripts/cripts-connections.en.rst b/doc/developer-guide/cripts/cripts-connections.en.rst
new file mode 100644
index 0000000000..c0ee65105c
--- /dev/null
+++ b/doc/developer-guide/cripts/cripts-connections.en.rst
@@ -0,0 +1,26 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+
+.. include:: ../../common.defs
+
+.. highlight:: cpp
+.. default-domain:: cpp
+
+.. _cripts-connections:
+
+Connections
+***********
diff --git a/doc/developer-guide/cripts/cripts-examples.en.rst b/doc/developer-guide/cripts/cripts-examples.en.rst
new file mode 100644
index 0000000000..a94c885f9f
--- /dev/null
+++ b/doc/developer-guide/cripts/cripts-examples.en.rst
@@ -0,0 +1,26 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+
+.. include:: ../../common.defs
+
+.. highlight:: cpp
+.. default-domain:: cpp
+
+.. _cripts-examples:
+
+Examples
+********
diff --git a/doc/developer-guide/cripts/cripts-headers.en.rst b/doc/developer-guide/cripts/cripts-headers.en.rst
new file mode 100644
index 0000000000..46fe2b96bf
--- /dev/null
+++ b/doc/developer-guide/cripts/cripts-headers.en.rst
@@ -0,0 +1,163 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+
+.. include:: ../../common.defs
+
+.. highlight:: cpp
+.. default-domain:: cpp
+
+.. _cripts-headers:
+
+Headers
+*******
+
+Just like the URL objects, all header objects are managed and owned by the Cripts
+system, and must always be borrowed. The pattern for this is as follows:
+
+.. code-block:: cpp
+
+  borrow req = Client::Request::get();
+
+  auto foo = req["X-Foo"];
+
+There are four types of headers that can be borrowed:
+
+=====================   ===========================================================================
+Header Object           Description
+=====================   ===========================================================================
+``Client::Request``     The client request headers. Always available.
+``Client::Response``    The client response headers.
+``Server::Request``     The server request headers.
+``Server::Response``    The server response headers.
+=====================   ===========================================================================
+
+Note that for all of these headers, except the ``Client::Request``, the headers are not
+available until the respective hook is called. For example, the ``Client::Response`` headers
+are not available until the response headers are received from the origin server or cache lookup.
+
+Assigning the empty value (``""``) to a header will remove it from the header list. For example:
+
+.. code-block:: cpp
+
+  borrow req = Client::Request::get();
+
+  req["X-Foo"] = "bar"; // Set the header
+  req["X-Fie"] = "";    // Remove the header
+
+A header can also be removed by using the ``erase`` method, which is a little more explicit:
+
+.. code-block:: cpp
+
+  borrow req = Client::Request::get();
+
+  req.erase("X-Foo");
+
+.. _cripts-headers-iterators:
+
+Iterators
+---------
+
+A common use pattern with the header values is to iterate (loop) over all of them. This is easily done with
+a pattern such as the following example:
+
+.. code-block:: cpp
+
+  borrow req = Client::Request::get();
+
+  for (auto header : req) {
+    CDebug("Header: {}: {}", header, req[header]); // This will print all headers and their values
+  }
+
+The request object implements a standard C++ style iterator, so any type of loop that works with
+standard C++ iterators will work with the request object.
+
+.. _cripts-headers-methods:
+
+Methods
+-------
+
+In addition to holding all the request headers, the request objects also holds the ``method`` verb.
+For the ``Client::Request`` object, this is the client request method (GET, POST, etc.). For the
+``Server::Request`` object, this is the method that will be sent to the origin server (GET, POST, etc.).
+
+Cripts provides the following convenience symbols for common methods (and performance):
+
+==========================   ======================================================================
+Method                       Description
+==========================   ======================================================================
+``Cript::Method::GET``       The GET method.
+``Cript::Method::POST``      The POST method.
+``Cript::Method::PUT``       The PUT method.
+``Cript::Method::DELETE``    The DELETE method.
+``Cript::Method::HEAD``      The HEAD method.
+``Cript::Method::OPTIONS``   The OPTIONS method.
+``Cript::Method::CONNECT``   The CONNECT method.
+``Cript::Method::TRACE``     The TRACE method.
+==========================   ======================================================================
+
+These symbols can be used to compare against the method in the request object. For example:
+
+.. code-block:: cpp
+
+  borrow req = Client::Request::get();
+
+  if (req.method == Cript::Method::GET) {
+      // Do something
+  }
+
+.. _cripts-headers-status:
+
+Status
+------
+
+The two response objects also hold the status code of the response. This includes:
+
+==========================   ======================================================================
+Member                       Description
+==========================   ======================================================================
+``status``                   The status code of the response. E.g. ``200``.
+``reason``                   The reason phrase of the response. E.g. ``OK``.
+``cache``                    The cache status of the response. E.g. ``miss``.
+==========================   ======================================================================
+
+Of these, the first two are pretty self explanatory, but the ``cache`` status is a bit more
+complex. This is a string that represents the cache status of the response. The possible values
+are:
+
+==========================   ======================================================================
+Value                        Description
+==========================   ======================================================================
+``miss``                     The response was not found in the cache.
+``hit-stale``                The response was found in the cache, but it was stale.
+``hit-fresh``                The response was found in the cache and is fresh.
+``skipped``                  We skipped cache lookup completely
+==========================   ======================================================================
+
+This status can be used to determine if the response was found in the cache, and if so, if it was
+fresh or stale. Example usage of the cache status:
+
+.. code-block:: cpp
+
+  do_read_response() {
+    borrow resp = Server::Response::get();
+
+    if (resp.cache == "miss") {
+      // Do something
+    }
+  }
+
+..
diff --git a/doc/developer-guide/cripts/cripts-matcher.en.rst b/doc/developer-guide/cripts/cripts-matcher.en.rst
new file mode 100644
index 0000000000..17876d83ec
--- /dev/null
+++ b/doc/developer-guide/cripts/cripts-matcher.en.rst
@@ -0,0 +1,26 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+
+.. include:: ../../common.defs
+
+.. highlight:: cpp
+.. default-domain:: cpp
+
+.. _cripts-matchers:
+
+Matchers
+********
diff --git a/doc/developer-guide/cripts/cripts-misc.en.rst b/doc/developer-guide/cripts/cripts-misc.en.rst
new file mode 100644
index 0000000000..4590e9ad8b
--- /dev/null
+++ b/doc/developer-guide/cripts/cripts-misc.en.rst
@@ -0,0 +1,26 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+
+.. include:: ../../common.defs
+
+.. highlight:: cpp
+.. default-domain:: cpp
+
+.. _cripts-misc:
+
+Miscelanious
+************
diff --git a/doc/developer-guide/cripts/cripts-overview.en.rst b/doc/developer-guide/cripts/cripts-overview.en.rst
new file mode 100644
index 0000000000..0a56371f0d
--- /dev/null
+++ b/doc/developer-guide/cripts/cripts-overview.en.rst
@@ -0,0 +1,286 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+
+.. include:: ../../common.defs
+
+.. highlight:: cpp
+.. default-domain:: cpp
+
+.. _cripts-overview:
+
+Overview
+********
+
+Cripts, *C-Scripts*, is a set of wrappers and include files for making simple ATS
+plugins easy to generate, modify or create from scratch. A key design here is that
+the Code is the Configuration, i.e. the intent really is to have a custom Cript file
+for every remap rule in the running system.
+
+Cripts can also be seen as the scripting configuration language for many custom
+ATS setups. ATS can even load Cripts directly, if so desired. See the section on
+using Cripts for more information.
+
+.. _cripts-overview-building:
+
+Building
+========
+
+Cripts is built as a separate library, which can be enabled with ``-DENABLE_CRIPTS=ON``
+when configuring *cmake*. Building a Cript itself is just like compiling a normal
+ATS plugin, except it will also need the Cripts library linked in: ``-lcripts``.
+
+Plugins built using this method loads exactly like any other ATS plugin, and can be
+used in the same way. The only difference is that the plugin will be a lot simpler
+to write and maintain.
+
+.. _cripts-overview-usage:
+
+Usage
+=====
+
+The easiest way to use Cripts is to let ATS itself compile and load the Cript. This
+requires three things:
+
+1. The :file:`records.yaml` must have the ``plugin.compiler_path`` set to a build script.
+2. The remap rule must specify the Cript file to load.
+3. The Cript file must be in either the configuration or plugin installation directory.
+
+The first step is to set the plugin.compiler_path in the records.yaml file. For example:
+
+.. code-block:: yaml
+
+   ts:
+     plugin:
+       compiler_path: /opt/ats/bin/compiler.sh
+
+The second step is to specify the Cript file in the remap rule. For example:
+
+::
+
+    map https://www.example.com https://origin.example.com \
+        @plugin=example.cript
+
+The third step is to put the Cript file in either the configuration or plugin installation,
+depending on your preference. The file must be readable by the ATS process. Example:
+
+.. code-block:: cpp
+
+   #include <cripts/Preamble.hpp>
+
+   do_remap()
+   {
+     borrow url = Client::URL::get();
+
+     url.query.keep({"foo", "bar"});
+   }
+
+   #include <cripts/Epilogue.hpp>
+
+In this example, note that both the Preamble and Epilogue are explicitly included.
+This is strictly necessary for the Cript to compile and load correctly.
+
+.. _cripts-overview-usage-compiler:
+
+Compiler
+--------
+
+The compiler is a simple shell script that compiles the Cript file into a shared object
+file. The script is responsible for setting up the environment and calling the compiler
+with the correct arguments. The script must be executable and readable by the ATS process.
+
+Two arguments are always given to the compiler script:
+
+1. The path to the Cript file.
+2. The path to the shared object file to create.
+
+An example compiler script is provided in the ATS source directory, but an example is
+also shown below:
+
+.. code-block:: bash
+
+   #!/usr/bin/env bash
+
+   # This was done for a Mac, may need to be adjusted for other platforms.
+   ATS_ROOT=/opt/ats
+   CXX=clang++
+   CXXFLAGS="-std=c++20 -I/opt/homebrew/include -undefined dynamic_lookup"
+   STDFLAGS="-shared -fPIC -Wall -Werror -I${ATS_ROOT}/include -L${ATS_ROOT}/lib -lcripts"
+
+   SOURCE=$1
+   DEST=$2
+
+   ${CXX} ${CXXFLAGS} ${STDFLAGS} -o $DEST $SOURCE
+
+The example in the ATS source directory is more complex, as it also provides a basic
+cache for the shared object files. This is useful for large setups with many Cript files.
+In fact, moving the compilation details to be separate from the ATS process is a good
+idea with a lot of flexibility for the user.
+
+.. _cripts-overview-hooks:
+
+Hooks
+=====
+
+Hooks are the main way to interact with ATS. The hooks are the same as the ATS hooks,
+but with a few differences. The hooks are all in the global namespace, and the hooks
+are all functions. Cripts provides a core set of hooks which are always available,
+but they are not required to be used.
+
+Not all ATS hooks are available in Cripts, but the most common ones are. Hooks are
+implicitly called if they are defined in the Cript file. The Cript will never explicitly
+setup the hooks, as this is done by the ATS process.
+
+Normal Hooks
+------------
+
+Lets look at the normal hooks that are available in Cripts. Note here that the name
+of the function dictates the underlying ATS hook.
+
+.. _cripts-overview-hooks-do-remap:
+
+do_remap()
+^^^^^^^^^^
+
+The ``do_remap()`` hook is called when a remap rule matches. This is the main hook for
+modifying the request or response. In ATS plugin terms, this is the main entry point
+for all remap plugins.
+
+.. _cripts-overview-hooks-do-post-remap:
+
+do_post_remap()
+^^^^^^^^^^^^^^^
+
+The ``do_post_remap()`` hook is called after the remap has been done. This can sometimes
+be useful for modifying the request details *after* the remap has been done. More often
+than not, this hook is not needed.
+
+.. _cripts-overview-hooks-do-send-response:
+
+do_send_response()
+^^^^^^^^^^^^^^^^^^
+
+The ``do_send_response()`` hook is called when the response is ready to be sent to the
+client. In this hook you can modify or add to the response headers for example.
+
+.. _cripts-overview-hooks-do-cache-lookup:
+
+do_cache_lookup()
+^^^^^^^^^^^^^^^^^
+
+The ``do_cache_lookup()`` hook is called when a cache lookup is done. This can be useful
+to take action on the response from the cache, once you know if the cache lookup succeeded
+or not.
+
+.. _cripts-overview-hooks-do-send-request:
+
+do_send_request()
+^^^^^^^^^^^^^^^^^
+
+The ``do_send_request()`` hook is called when the request is ready to be sent to the
+origin server. This is the main hook for modifying the request to the origin server.
+
+.. _cripts-overview-hooks-do-read-response:
+
+do_read_response()
+^^^^^^^^^^^^^^^^^^
+
+The ``do_read_response()`` hook is called when the response is being read from the origin
+server. This is the main hook for modifying the response from the origin server.
+
+.. _cripts-overview-hooks-do-txn-close:
+
+do_txn_close()
+^^^^^^^^^^^^^^
+
+The ``do_txn_close()`` hook is called when the transaction is closed.
+
+Instance Hooks
+--------------
+
+In addition to these normal hooks, there are also three hooks that are used for setting
+up a cript and remap plugin instance. This is primarily useful when writing traditional
+remap plugins in Cripts.
+
+**Note:** These hooks are not needed for most Cripts that are used in remap rules.
+
+.. _cripts-overview-hooks-do-init:
+
+do_init()
+^^^^^^^^^
+
+The ``do_init()`` hook is called once when the plugin is loaded.
+
+.. _cripts-overview-hooks-do-create-instance:
+
+do_create_instance()
+^^^^^^^^^^^^^^^^^^^^
+
+The ``do_create_instance()`` hook is called when a new instance of the plugin is created.
+Of particular interest here is the ability to read and save the instance parameters that
+can be provided in the remap rule (e.g. ``@plugin=example.cript @pparam=value``).
+
+.. _cripts-overview-hooks-do-delete-instance:
+
+do_delete_instance()
+^^^^^^^^^^^^^^^^^^^^
+
+The ``do_delete_instance()`` hook is called when the instance is deleted.
+
+.. _cripts-overview-instance-data:
+
+Instance Data
+=============
+
+Instance data is a way to store data that is specific to a plugin instance. This is
+primarily useful when writing traditional remap plugins in Cripts using the instance hooks.
+Instance data is stored in a map that is specific to the plugin instance, and each slot
+is initially a string, as provided by the remap rule.
+
+Best way to understand this is to look at an example:
+
+.. code-block:: cpp
+
+   #include <cripts/Preamble.hpp>
+
+   do_create_instance()
+   {
+     if (instance.size() == 3) {
+       auto first  = float(AsString(instance.data[0]));
+       auto second = integer(AsString(instance.data[1]));
+       auto third  = boolean(AsString(instance.data[3]));
+
+       instance.data[0] = first;
+       instance.data[1] = second;
+       instance.data[2] = third;
+     }
+   }
+
+   do_remap()
+   {
+       auto first  = AsFloat(instance.data[0]);
+       auto second = AsInteger(instance.data[1]);
+       auto third  = AsBoolean(instance.data[3]);
+
+       // Use the instance parameter here in the Cript rules.
+   }
+
+   #include <cripts/Epilogue.hpp>
+
+As you can see, it takes a little bit of work to manage these instance parameters, which
+is a limitation of the language constructs in Cripts. But writing plugins like this is for
+more advanced users, and users just writing simple Cripts for their remap rules will not
+need to worry about this.
diff --git a/doc/developer-guide/cripts/cripts-urls.en.rst b/doc/developer-guide/cripts/cripts-urls.en.rst
new file mode 100644
index 0000000000..c9877abe36
--- /dev/null
+++ b/doc/developer-guide/cripts/cripts-urls.en.rst
@@ -0,0 +1,118 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+
+.. include:: ../../common.defs
+
+.. highlight:: cpp
+.. default-domain:: cpp
+
+.. _cripts-urls:
+
+Urls
+****
+
+The URL objects are managed and own by the Cripts subsystem, and as such
+must always be borrewed. The pattern for this is as follows:
+
+.. code-block:: cpp
+
+  borrow url = Client::URL::get();
+
+  auto path = url.path;
+
+There are four types of URLs that can be borrowed:
+
+===================   =============================================================================
+URL Object            Description
+===================   =============================================================================
+``Client::URL``       The client request URL, as it currently stands (may be modified).
+``Pristine:URL``      The pristine client request URL, as it was coming into the ATS server.
+``Parent::URL``       The outgoing server URL, as sent to the next server (parent or origin).
+``Cache::URL``        The cache URL, which will be used for the cache lookups.
+===================   =============================================================================
+
+These URLs all have the same methods and properties, but they are used in different
+hooks and have different meanings. The ``Client::URL`` is the most commonly used URL,
+which you will also modify in the tradtional remapping use case; for example changing
+the ``path`` or ``host`` before further processing.
+
+.. _cripts-urls-components:
+
+Components
+----------
+
+Every URL object has the following components:
+
+===============   =================================================================================
+Component         Description
+===============   =================================================================================
+``host``          The host name.
+``port``          The port number, this is an integer value.
+``scheme``        The scheme (http, https, etc).
+``path``          The path.
+``query``         The query.
+===============   =================================================================================
+
+These components can be accessed and modified as needed. Both the ``path`` and ``query`` are
+strings, and can be manipulated as such. However, they are both also considered list of their
+constituent parts, and can be accessed as such. For example, to get the first part of the path,
+you can use the following:
+
+.. code-block:: cpp
+
+  borrow url = Client::URL::get();
+
+  auto path = url.path; // This is the entire path
+  auto first = url.path[0]; // This is the first part of the path
+
+The same pattern applies for the query parameters, except they are key-value pairs, instead of
+indexed in a list. To get the value of a specific query parameter, you can use the following:
+
+.. code-block:: cpp
+
+  borrow url = Client::URL::get();
+
+  auto value = url.query["key"]; // This is the value of the key
+
+You can retreive the size of the path or query using the ``size()`` method, and you can clear
+the path or query using the ``erase()`` method. To summarize the ``path`` and ``query`` components
+have the following methods available to them:
+
+=================   ===============================================================================
+Method / access     Description
+=================   ===============================================================================
+Index []            Access a specific part of the path or query.
+``size()``          Get the number of parts of the path or query.
+``erase()``         Clears the component. Also available as ``clear()``.
+``sort()``          Sorts the query parameters. **Note**: Only for query parameters.
+``flush()``         Flushes any changes. This is rarely used, since Cripts will manage flushing.
+=================   ===============================================================================
+
+In addition, the query parameters ``erase()`` method can take a single key, or a list of keys to
+remove specific parameters. It also allows specify a list of keys to keep, and will remove all other
+keys. This is useful for filtering out unwanted query parameters.
+
+For example:
+
+.. code-block:: cpp
+
+  borrow url = Client::URL::get();
+
+  url.query.erase("key"); // Removes the key from the query
+  url.query.erase({"key1", "key2"}); // Removes both keys from the query
+  url.query.erase({"key1", "key2"}, true); // Removes all keys except key1 and key2
+  url.query.keep({"key1", "key2"}); // Same as previous
diff --git a/doc/developer-guide/cripts/cripts-variables.en.rst b/doc/developer-guide/cripts/cripts-variables.en.rst
new file mode 100644
index 0000000000..80e0e994de
--- /dev/null
+++ b/doc/developer-guide/cripts/cripts-variables.en.rst
@@ -0,0 +1,155 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+
+.. include:: ../../common.defs
+
+.. highlight:: cpp
+.. default-domain:: cpp
+
+.. _cripts-variables:
+
+Variables
+*********
+
+Cripts supports a wide variety of variable types, and they can be used in many places. In
+many cases, the variable types are automatically converted to the correct type, but in some
+cases you may need to explicitly declare the variable. Most commonly you will declare a
+variable using either ``auto`` or ``borrow``. The latter is used when working with a
+complex object, like a URL or a header, that is managed by ATS itself.
+
+For ``auto`` variables, these are the most common types:
+
+=================== ==================================================================================
+Type                Description
+=================== ==================================================================================
+``integer``         A 64-bit signed integer.
+``float``           A 64-bit floating point number.
+``boolean``         A boolean value.
+``string``          A string.
+``string_view``     A string view.
+=================== ==================================================================================
+
+Of these, ``string_view`` is perhaps the least familiar type, but it is the most commonly used
+type of strings within ATS itself. As such, they are incredibly efficient to use. Again, most of the
+time just declare your variables as ``auto`` and let the compiler figure out the type.
+
+.. _cripts-variables-strings:
+
+Strings
+=======
+
+String and ``string_views`` are probably the types you will work with most. These types
+have a number of methods that can be used to manipulate the string. Strings here are secretly
+wrapped in standard C++ strings, and have all the methods that come with them. As an example, to
+get the length of a string, you can use the ``size()`` method:
+
+.. code-block:: cpp
+
+     borrow req  = Client::Request::get();
+
+     if (req["Host"].size() > 3) {
+         // Do something
+     }
+
+Here's a list of methods available on strings:
+
+===================   =============================================================================
+Method                Description
+===================   =============================================================================
+``clear()``           Clear (empty) the string.
+``empty()``           Check if the string is empty or not, returns ``true`` or ``false``.
+``size()``            Return the length of the string. Also available as ``length()``.
+``starts_with()``     Check if the string starts with a given string.
+``ends_with()``       Check if the string ends with a given string.
+``find()``            Find a string within the string. **TBD**
+``rfind()``           Find a string within the string, starting from the end. **TBD**
+``contains()``        Check if the string contains a given string. **TBD**
+``substr()``          Get a substring of the string, arguments are ``start`` and ``end`` position.
+``split()``           Split the string into a list of strings, using a delimiter. Returns a list.
+``trim()``            Trim whitespace from the string.
+``ltrim()``           Trim whitespace from the left of the string.
+``rtrim()``           Trim whitespace from the right of the string.
+``remove_prefix()``   Remove a prefix string from the string. This does not return a new string.
+``remove_suffix()``   Remove a suffix string from the string. This does not return a new string.
+``toFloat()``         Convert the string to a float.
+``toBool()``          Convert the string to a boolean.
+``toInteger()``       Convert the string to an integer.
+``toFloat()``         Convert the string to a float.
+===================   =============================================================================
+
+In addition to this, there's a number of *matching* features in Cripts, which can be used together
+with strings. These are covered in more detail in the :ref:`cripts-matcher` section. Of course,
+regular comparisons such as ``==`` and ``!=`` are also available.
+
+**Note:** We'll continue to update features of Cripts as we start using it more in production. If you
+have any suggestions or requests for strings (or any other data type), please let us know!
+
+.. _cripts-variables-configuration:
+
+Configuration Variable
+======================
+
+ATS has a flexible set of configurations, many of which can be accessed and modified using Cripts.
+These configurations are, in ATS terms, what's called overridable. They all have a default value,
+that is set globally via :file:`records.yaml`, but they are also overridable per transaction.
+
+Cript exposes this via the global ``proxy`` object, which is a map of all the configurations.
+Best way to understand this is to look at an example:
+
+.. code-block:: cpp
+
+   auto cache_on = proxy.config.http.cache.http.get();
+
+   if (cache_on > 0) {
+     proxy.config.http.ignore_server_no_cache.set(1);
+   }
+
+This is a pretty artificial example, but shows the name space of these configurations, and how they
+match the documented ATS configuration names.
+
+.. _cripts-variables-control:
+
+Control Variable
+================
+
+ATS plugins (and Cripts) have access to a number of control functions that can be used to control
+some behavior of ATS. This is exposed via the global ``control`` object. This object has a number of
+variables that can be used to control the behavior of ATS.
+
+============================   ====================================================================
+Variable                       Description
+============================   ====================================================================
+``control.cache.request``      Control the cache behavior for the request.
+``control.cache.response``     Control the cache behavior for the response.
+``control.cache.nostore``      Control the cache behavior for the no-store.
+``control.logging``            Turn logging on or off.
+``control.intercept``          Turn incepts on or off.
+``control.debug``              Enable debugging (rarely used)
+``control.remap``              Indicate whether remap matching is required or not.
+============================   ====================================================================
+
+All of these are controlled via a boolean value, and can be set to either ``true`` or ``false``,
+the same ``.get()`` and ``.set()`` as for configuration variables. As an example, lets randomly
+turn off logging for some percentage of requests:
+
+.. code-block:: cpp
+
+   do_remap() {
+     if (Cript::random(1000) > 99) {
+       control.logging.set(false); // 10% log sampling
+     }
+   }
diff --git a/doc/developer-guide/cripts/index.en.rst b/doc/developer-guide/cripts/index.en.rst
new file mode 100644
index 0000000000..6a61611bd5
--- /dev/null
+++ b/doc/developer-guide/cripts/index.en.rst
@@ -0,0 +1,36 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+
+.. include:: ../../common.defs
+
+.. _developer-guide-cripts:
+
+Cripts
+******
+
+.. toctree::
+   :maxdepth: 2
+
+   cripts-overview.en
+   cripts-variables.en
+   cripts-urls.en
+   cripts-headers.en
+   cripts-connections.en
+   cripts-matcher.en
+   cripts-misc.en
+   cripts-bundles.en
+   cripts-examples.en
diff --git a/doc/developer-guide/index.en.rst b/doc/developer-guide/index.en.rst
index c273039c94..c681318025 100644
--- a/doc/developer-guide/index.en.rst
+++ b/doc/developer-guide/index.en.rst
@@ -48,6 +48,7 @@ duplicate bugs is encouraged, but not required.
    logging-architecture/index.en
    internal-libraries/index.en
    plugins/index.en
+   cripts/index.en
    config-vars.en
    api/index.en
    continuous-integration/index.en


(trafficserver) 06/08: Eliminate leaking of HostStatusSync instances. (#11275)

Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 0a9b9f8140d44101dfe703d064602e3c0d1c0f60
Author: Walt Karas <wk...@yahooinc.com>
AuthorDate: Mon Apr 22 10:22:03 2024 -0400

    Eliminate leaking of HostStatusSync instances. (#11275)
    
    (cherry picked from commit 1cf4991b4850bce96cbad1663b266b0b5ce49994)
---
 include/proxy/HostStatus.h | 34 +++++++++++++++++++++++++---------
 src/proxy/HostStatus.cc    |  2 +-
 2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/include/proxy/HostStatus.h b/include/proxy/HostStatus.h
index 436d133cf5..5772b05bdc 100644
--- a/include/proxy/HostStatus.h
+++ b/include/proxy/HostStatus.h
@@ -175,9 +175,29 @@ struct HostStatRec {
   }
 };
 
-struct HostStatusSync : public Continuation {
+class HostStatusSync : public Continuation
+{
+private:
+  HostStatusSync()
+  {
+    getHostStatusPersistentFilePath();
+
+    SET_HANDLER(&HostStatusSync::mainEvent);
+  }
+
+  ~HostStatusSync() = default;
+
+public:
+  HostStatusSync(HostStatusSync const &) = delete;
+
   std::string hostRecordsFile;
 
+  static HostStatusSync *
+  new_instance()
+  {
+    return new HostStatusSync;
+  }
+
   void sync_task();
   void
   getHostStatusPersistentFilePath()
@@ -186,18 +206,14 @@ struct HostStatusSync : public Continuation {
     hostRecordsFile = Layout::relative_to(rundir, ts::filename::HOST_RECORDS);
   }
 
-public:
-  HostStatusSync()
-  {
-    getHostStatusPersistentFilePath();
-
-    SET_HANDLER(&HostStatusSync::mainEvent);
-  }
-
+  // Deletes instance.
   int
   mainEvent(int event, Event *e)
   {
     sync_task();
+
+    delete this;
+
     return EVENT_DONE;
   }
 };
diff --git a/src/proxy/HostStatus.cc b/src/proxy/HostStatus.cc
index 668a52e6fc..b1e0bb3463 100644
--- a/src/proxy/HostStatus.cc
+++ b/src/proxy/HostStatus.cc
@@ -494,7 +494,7 @@ server_set_status(std::string_view id, YAML::Node const &params)
 
     // schedule a write to the persistent store.
     Debug("host_statuses", "updating persistent store");
-    eventProcessor.schedule_imm(new HostStatusSync, ET_TASK);
+    eventProcessor.schedule_imm(HostStatusSync::new_instance(), ET_TASK);
   } catch (std::exception const &ex) {
     Debug("host_statuses", "Got an error HostCmdInfo decoding: %s", ex.what());
     resp.errata()


(trafficserver) 01/08: Fix RelWithDebInfo to be release with debug info (#11211)

Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 6eb7f608ce775b1b59ea4647ee8e68975f9aa111
Author: Chris McFarlen <ch...@mcfarlen.us>
AuthorDate: Mon May 13 16:50:17 2024 -0600

    Fix RelWithDebInfo to be release with debug info (#11211)
    
    * Fix RelWithDebInfo to be release with debug info
    
    * Add comment
    
    (cherry picked from commit a7a150de4603bd39ef010bbc0f004f7fa487f359)
---
 CMakeLists.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 015099a457..96315cfa18 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,10 @@
 #
 #######################
 
+# Adjust default RelWithDebInfo flags to be in line with "Release with Debug".
+# The default RelWithDebInfo uses -O2, but Release uses -O3. This difference can be astonishing to users
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
+
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
   message(FATAL_ERROR "In source builds are disabled.  Use a preset, -B or run from a different directory")
 endif()


(trafficserver) 02/08: Use large IOBufferBlock only on sending DATA frame (#11229)

Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 14924ed99f75e4d6e4e53366f222764137198842
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Tue May 14 09:57:39 2024 +0900

    Use large IOBufferBlock only on sending DATA frame (#11229)
    
    (cherry picked from commit 0d14ad2b18fde85eff69ba01a87d92940866c59f)
---
 include/proxy/http2/HTTP2.h           |  1 +
 src/proxy/http2/HTTP2.cc              |  3 +++
 src/proxy/http2/Http2ClientSession.cc |  6 ++----
 src/proxy/http2/Http2Frame.cc         | 11 +++++++++--
 4 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/include/proxy/http2/HTTP2.h b/include/proxy/http2/HTTP2.h
index 5d73022fec..5cabf2b2cd 100644
--- a/include/proxy/http2/HTTP2.h
+++ b/include/proxy/http2/HTTP2.h
@@ -434,6 +434,7 @@ public:
   static uint32_t stream_slow_log_threshold;
   static uint32_t header_table_size_limit;
   static uint32_t write_buffer_block_size;
+  static int64_t  write_buffer_block_size_index;
   static float    write_size_threshold;
   static uint32_t write_time_threshold;
   static uint32_t buffer_water_mark;
diff --git a/src/proxy/http2/HTTP2.cc b/src/proxy/http2/HTTP2.cc
index 8fcb9d93d6..3de6bbab04 100644
--- a/src/proxy/http2/HTTP2.cc
+++ b/src/proxy/http2/HTTP2.cc
@@ -496,6 +496,7 @@ uint32_t Http2::con_slow_log_threshold             = 0;
 uint32_t Http2::stream_slow_log_threshold          = 0;
 uint32_t Http2::header_table_size_limit            = 65536;
 uint32_t Http2::write_buffer_block_size            = 262144;
+int64_t  Http2::write_buffer_block_size_index      = BUFFER_SIZE_INDEX_256K;
 float    Http2::write_size_threshold               = 0.5;
 uint32_t Http2::write_time_threshold               = 100;
 uint32_t Http2::buffer_water_mark                  = 0;
@@ -556,6 +557,8 @@ Http2::init()
   REC_EstablishStaticConfigInt32U(write_time_threshold, "proxy.config.http2.write_time_threshold");
   REC_EstablishStaticConfigInt32U(buffer_water_mark, "proxy.config.http2.default_buffer_water_mark");
 
+  write_buffer_block_size_index = iobuffer_size_to_index(Http2::write_buffer_block_size, MAX_BUFFER_SIZE_INDEX);
+
   // If any settings is broken, ATS should not start
   ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, max_concurrent_streams_in}));
   ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, min_concurrent_streams_in}));
diff --git a/src/proxy/http2/Http2ClientSession.cc b/src/proxy/http2/Http2ClientSession.cc
index 61da1fc9f5..5cd713e527 100644
--- a/src/proxy/http2/Http2ClientSession.cc
+++ b/src/proxy/http2/Http2ClientSession.cc
@@ -114,9 +114,7 @@ Http2ClientSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOB
   this->read_buffer->water_mark = connection_state.local_settings.get(HTTP2_SETTINGS_MAX_FRAME_SIZE);
   this->_read_buffer_reader     = reader ? reader : this->read_buffer->alloc_reader();
 
-  // This block size is the buffer size that we pass to SSLWriteBuffer
-  auto buffer_block_size_index = iobuffer_size_to_index(Http2::write_buffer_block_size, MAX_BUFFER_SIZE_INDEX);
-  this->write_buffer           = new_MIOBuffer(buffer_block_size_index);
+  this->write_buffer = new_MIOBuffer(HTTP2_HEADER_BUFFER_SIZE_INDEX);
 
   uint32_t buffer_water_mark;
   if (auto snis = this->_vc->get_service<TLSSNISupport>(); snis && snis->hints_from_sni.http2_buffer_water_mark.has_value()) {
@@ -127,7 +125,7 @@ Http2ClientSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOB
   this->write_buffer->water_mark = buffer_water_mark;
 
   this->_write_buffer_reader  = this->write_buffer->alloc_reader();
-  this->_write_size_threshold = index_to_buffer_size(buffer_block_size_index) * Http2::write_size_threshold;
+  this->_write_size_threshold = index_to_buffer_size(Http2::write_buffer_block_size_index) * Http2::write_size_threshold;
 
   this->_handle_if_ssl(new_vc);
 
diff --git a/src/proxy/http2/Http2Frame.cc b/src/proxy/http2/Http2Frame.cc
index 52482ab68b..b477b48d6b 100644
--- a/src/proxy/http2/Http2Frame.cc
+++ b/src/proxy/http2/Http2Frame.cc
@@ -22,6 +22,7 @@
  */
 
 #include "proxy/http2/Http2Frame.h"
+#include "iocore/eventsystem/IOBuffer.h"
 
 //
 // Http2Frame
@@ -60,8 +61,14 @@ Http2DataFrame::write_to(MIOBuffer *iobuffer) const
     int64_t written = 0;
     // Fill current IOBufferBlock as much as possible to reduce SSL_write() calls
     while (written < this->_payload_len) {
-      int64_t read_len  = std::min(this->_payload_len - written, this->_reader->block_read_avail());
-      written          += iobuffer->write(this->_reader->start(), read_len);
+      int64_t read_len = std::min(this->_payload_len - written, this->_reader->block_read_avail());
+
+      if (iobuffer->block_write_avail() < read_len) {
+        // This block size is the buffer size that we pass to SSLWriteBuffer
+        iobuffer->append_block(Http2::write_buffer_block_size_index);
+      }
+
+      written += iobuffer->write(this->_reader->start(), read_len);
       this->_reader->consume(read_len);
     }
     len += written;


(trafficserver) 03/08: Coverity 1534725: Uninitialized scalar variable (#11336)

Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit f4139730da042e689a41096735db1c1020d32d74
Author: Serris Lew <se...@gmail.com>
AuthorDate: Tue May 14 14:40:34 2024 -0700

    Coverity 1534725: Uninitialized scalar variable (#11336)
    
    Co-authored-by: Serris Lew <ls...@apple.com>
    (cherry picked from commit 7697c890d09b1d1f266f0f065633309ac1a987b9)
---
 plugins/experimental/txn_box/plugin/src/ip_space.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/plugins/experimental/txn_box/plugin/src/ip_space.cc b/plugins/experimental/txn_box/plugin/src/ip_space.cc
index 8868e91645..6b472e6356 100644
--- a/plugins/experimental/txn_box/plugin/src/ip_space.cc
+++ b/plugins/experimental/txn_box/plugin/src/ip_space.cc
@@ -599,6 +599,7 @@ Do_ip_space_define::define_column(Config &cfg, YAML::Node node)
   }
   col._idx        = _cols.size();
   col._row_offset = _row_size;
+  col._row_size   = 0;
   switch (col._type) {
   default:
     break; // shouldn't happen.