trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iga...@apache.org
Subject [2/5] TS-2106: transform all plugins to new logging non-API
Date Sun, 11 Aug 2013 18:31:20 GMT
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/42306ff7/plugins/header_rewrite/resources.cc
----------------------------------------------------------------------
diff --git a/plugins/header_rewrite/resources.cc b/plugins/header_rewrite/resources.cc
index c33dfbf..41b1498 100644
--- a/plugins/header_rewrite/resources.cc
+++ b/plugins/header_rewrite/resources.cc
@@ -27,13 +27,13 @@
 void
 Resources::gather(const ResourceIDs ids, TSHttpHookID hook)
 {
-  TSDebug(PLUGIN_NAME, "Building resource structure for hook (%d)", hook);
+  TSLogDebug("Building resource structure for hook (%d)", hook);
 
   // If we need the client request headers, make sure it's also available in the client vars.
   if (ids & RSRC_CLIENT_REQUEST_HEADERS) {
-    TSDebug(PLUGIN_NAME, "\tAdding TXN client request header buffers");
+    TSLogDebug("\tAdding TXN client request header buffers");
     if (TSHttpTxnClientReqGet(txnp, &client_bufp, &client_hdr_loc) != TS_SUCCESS)
{
-      TSDebug(PLUGIN_NAME, "could not gather bufp/hdr_loc for request");
+      TSLogDebug("could not gather bufp/hdr_loc for request");
       return;
     }
   }
@@ -42,14 +42,14 @@ Resources::gather(const ResourceIDs ids, TSHttpHookID hook)
   case TS_HTTP_READ_RESPONSE_HDR_HOOK:
     // Read response headers from server
     if (ids & RSRC_SERVER_RESPONSE_HEADERS) {
-      TSDebug(PLUGIN_NAME, "\tAdding TXN server response header buffers");
+      TSLogDebug("\tAdding TXN server response header buffers");
       if (TSHttpTxnServerRespGet(txnp, &bufp, &hdr_loc) != TS_SUCCESS) {
-        TSDebug(PLUGIN_NAME, "could not gather bufp/hdr_loc for response");
+        TSLogDebug("Could not gather bufp/hdr_loc for response");
         return;
       }
     }
     if (ids & RSRC_RESPONSE_STATUS) {
-      TSDebug(PLUGIN_NAME, "\tAdding TXN server response status resource");
+      TSLogDebug("\tAdding TXN server response status resource");
       resp_status = TSHttpHdrStatusGet(bufp, hdr_loc);
     }
     break;
@@ -57,9 +57,9 @@ Resources::gather(const ResourceIDs ids, TSHttpHookID hook)
   case TS_HTTP_SEND_REQUEST_HDR_HOOK:
     // Read request headers to server
     if (ids & RSRC_SERVER_REQUEST_HEADERS) {
-      TSDebug(PLUGIN_NAME, "\tAdding TXN server request header buffers");
+      TSLogDebug("\tAdding TXN server request header buffers");
       if (!TSHttpTxnServerReqGet(txnp, &bufp, &hdr_loc)) {
-        TSDebug(PLUGIN_NAME, "could not gather bufp/hdr_loc for request");
+        TSLogDebug("Could not gather bufp/hdr_loc for request");
         return;
       }
     }
@@ -77,13 +77,13 @@ Resources::gather(const ResourceIDs ids, TSHttpHookID hook)
   case TS_HTTP_SEND_RESPONSE_HDR_HOOK:
     // Send response headers to client
     if (ids & RSRC_CLIENT_RESPONSE_HEADERS) {
-      TSDebug(PLUGIN_NAME, "\tAdding TXN client response header buffers");
+      TSLogDebug("\tAdding TXN client response header buffers");
       if (TSHttpTxnClientRespGet(txnp, &bufp, &hdr_loc) != TS_SUCCESS) {
-        TSDebug(PLUGIN_NAME, "could not gather bufp/hdr_loc for request");
+        TSLogDebug("Could not gather bufp/hdr_loc for request");
         return;
       }
       if (ids & RSRC_RESPONSE_STATUS) {
-        TSDebug(PLUGIN_NAME, "\tAdding TXN client esponse status resource");
+        TSLogDebug("\tAdding TXN client esponse status resource");
         resp_status = TSHttpHdrStatusGet(bufp, hdr_loc);
       }
     }
@@ -92,7 +92,7 @@ Resources::gather(const ResourceIDs ids, TSHttpHookID hook)
   case TS_REMAP_PSEUDO_HOOK:
     // Pseudo-hook for a remap instance
     if (client_bufp && client_hdr_loc) {
-      TSDebug(PLUGIN_NAME, "\tAdding TXN client request header buffers for remap instance");
+      TSLogDebug("\tAdding TXN client request header buffers for remap instance");
       bufp = client_bufp;
       hdr_loc = client_hdr_loc;
     }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/42306ff7/plugins/header_rewrite/resources.h
----------------------------------------------------------------------
diff --git a/plugins/header_rewrite/resources.h b/plugins/header_rewrite/resources.h
index d2ce9f5..815a3e1 100644
--- a/plugins/header_rewrite/resources.h
+++ b/plugins/header_rewrite/resources.h
@@ -51,7 +51,7 @@ public:
     : txnp(txnptr), contp(contptr), bufp(NULL), hdr_loc(NULL), client_bufp(NULL), client_hdr_loc(NULL),
       resp_status(TS_HTTP_STATUS_NONE), _rri(NULL), changed_url(false), _ready(false)
   {
-    TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for Resources (InkAPI)");
+    TSLogDebug("Calling CTOR for Resources (InkAPI)");
   }
 
   Resources(TSHttpTxn txnptr, TSRemapRequestInfo *rri) :
@@ -59,8 +59,8 @@ public:
     bufp(NULL), hdr_loc(NULL), client_bufp(NULL), client_hdr_loc(NULL), resp_status(TS_HTTP_STATUS_NONE),
     _rri(rri), _ready(false)
   {
-    TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for Resources (RemapAPI)");
-    TSDebug(PLUGIN_NAME, "rri: %p", _rri);
+    TSLogDebug("Calling CTOR for Resources (RemapAPI)");
+    TSLogDebug("rri: %p", _rri);
   }
 
   ~Resources() { destroy(); }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/42306ff7/plugins/header_rewrite/ruleset.cc
----------------------------------------------------------------------
diff --git a/plugins/header_rewrite/ruleset.cc b/plugins/header_rewrite/ruleset.cc
index 9b2d688..11204c7 100644
--- a/plugins/header_rewrite/ruleset.cc
+++ b/plugins/header_rewrite/ruleset.cc
@@ -45,10 +45,10 @@ RuleSet::add_condition(Parser& p) {
   Condition* c = condition_factory(p.get_op());
 
   if (NULL != c) {
-    TSDebug(PLUGIN_NAME, "Adding condition: %%{%s} with arg: %s\n", p.get_op().c_str(), p.get_arg().c_str());
+    TSLogDebug("Adding condition: %%{%s} with arg: %s\n", p.get_op().c_str(), p.get_arg().c_str());
     c->initialize(p);
     if (!c->set_hook(_hook)) {
-      TSError("header_rewrite: can't use this condition in this hook");
+      TSLogError("Cannot use this condition in this hook");
       return;
     }
     if (NULL == _cond) {
@@ -70,10 +70,10 @@ RuleSet::add_operator(Parser& p) {
 
   if (NULL != o) {
     // TODO: This should be extended to show both the "argument" and the "value" (if both
are used)
-    TSDebug(PLUGIN_NAME, "Adding operator: %s(%s)\n", p.get_op().c_str(), p.get_arg().c_str());
+    TSLogDebug("Adding operator: %s(%s)\n", p.get_op().c_str(), p.get_arg().c_str());
     o->initialize(p);
     if (!o->set_hook(_hook)) {
-      TSError("header_rewrite: can't use this operator in this hook");
+      TSLogError("Cannot use this operator in this hook");
       return;
     }
     if (NULL == _oper) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/42306ff7/plugins/header_rewrite/statement.h
----------------------------------------------------------------------
diff --git a/plugins/header_rewrite/statement.h b/plugins/header_rewrite/statement.h
index 15fdf11..7492137 100644
--- a/plugins/header_rewrite/statement.h
+++ b/plugins/header_rewrite/statement.h
@@ -51,11 +51,11 @@ class Statement
   Statement()
     : _next(NULL), _pdata(NULL), _rsrc(RSRC_NONE), _initialized(false), _hook(TS_HTTP_READ_RESPONSE_HDR_HOOK)
   {
-    TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for Statement");
+    TSLogDebug("Calling CTOR for Statement");
   }
 
   virtual ~Statement() {
-    TSDebug(PLUGIN_NAME_DBG, "Calling DTOR for Statement");
+    TSLogDebug("Calling DTOR for Statement");
     free_pdata();
   }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/42306ff7/plugins/header_rewrite/value.h
----------------------------------------------------------------------
diff --git a/plugins/header_rewrite/value.h b/plugins/header_rewrite/value.h
index 0c318fc..55fa537 100644
--- a/plugins/header_rewrite/value.h
+++ b/plugins/header_rewrite/value.h
@@ -44,7 +44,7 @@ public:
   Value()
     : _value(""), _int_value(-1), _cond_val(NULL)
   {
-    TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for Value");
+    TSLogDebug("Calling CTOR for Value");
   };
 
   void

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/42306ff7/plugins/libloader/libloader.c
----------------------------------------------------------------------
diff --git a/plugins/libloader/libloader.c b/plugins/libloader/libloader.c
index ef84c2f..acf8373 100644
--- a/plugins/libloader/libloader.c
+++ b/plugins/libloader/libloader.c
@@ -32,6 +32,9 @@
 #include <stdlib.h>
 #include <ts/ts.h>
 
+#define PLUGIN_NAME "libloader"
+#include <ts/debug.h>
+
 typedef struct {
     void *handle;
     void *next;
@@ -61,7 +64,7 @@ void TSPluginInit(int argc, const char *argv[])
     info.support_email = (char *)"users@trafficserver.apache.org";
 
     if (TSPluginRegister(TS_SDK_VERSION_3_0, &info) != TS_SUCCESS) {
-        TSError("[libloader] Plugin registration failed.\n");
+        TSLogError("Plugin registration failed.");
         return;
     }
 
@@ -75,10 +78,10 @@ void TSPluginInit(int argc, const char *argv[])
             l->handle = handle;
             l->next = libs;
             libs = l;
-            TSDebug("libloader", " loaded %s\n", lib);
+            TSLogDebug("loaded %s", lib);
         }
         else {
-            TSError("[libloader] failed to load %s: %s\n", lib, dlerror());
+            TSLogError("Failed to load %s: %s", lib, dlerror());
         }
     }
     return;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/42306ff7/plugins/regex_remap/regex_remap.cc
----------------------------------------------------------------------
diff --git a/plugins/regex_remap/regex_remap.cc b/plugins/regex_remap/regex_remap.cc
index 8b637f6..327e611 100644
--- a/plugins/regex_remap/regex_remap.cc
+++ b/plugins/regex_remap/regex_remap.cc
@@ -47,7 +47,8 @@
 #include "ink_atomic.h"
 #include "ink_time.h"
 
-static const char* PLUGIN_NAME = "regex_remap";
+#define PLUGIN_NAME "regex_remap"
+#include <ts/debug.h>
 
 // Constants
 static const int OVECCOUNT = 30; // We support $0 - $9 x2 ints, and this needs to be 1.5x
that
@@ -121,13 +122,13 @@ class RemapRegex
     _num_subs(-1), _rex(NULL), _extra(NULL), _order(-1), _simple(false),
     _active_timeout(-1), _no_activity_timeout(-1), _connect_timeout(-1), _dns_timeout(-1)
   {
-    TSDebug(PLUGIN_NAME, "Calling constructor");
+    TSLogDebug("Calling constructor");
 
     _status = static_cast<TSHttpStatus>(0);
 
     if (!reg.empty()) {
       if (reg == ".") {
-        TSDebug(PLUGIN_NAME, "Rule is simple, and fast!");
+        TSLogDebug("Rule is simple, and fast!");
         _simple = true;
       }
       _rex_string = TSstrdup(reg.c_str());
@@ -158,7 +159,7 @@ class RemapRegex
       ++start;
       pos1 = opt.find_first_of("=", start);
       if (pos1 == std::string::npos) {
-        TSError("Malformed options: %s", opt.c_str());
+        TSLogError("Malformed options: %s", opt.c_str());
         break;
       }
       ++pos1;
@@ -178,7 +179,7 @@ class RemapRegex
       } else if (opt.compare(start, 11, "dns_timeout") == 0) {
         _dns_timeout = atoi(opt_val.c_str());
       } else {
-        TSError("Unknown options: %s", opt.c_str());
+        TSLogError("Unknown options: %s", opt.c_str());
       }
       start = opt.find_first_of("@", pos2);
     }
@@ -186,7 +187,7 @@ class RemapRegex
 
   ~RemapRegex()
   {
-    TSDebug(PLUGIN_NAME, "Calling destructor");
+    TSLogDebug("Calling destructor");
     if (_rex_string)
       TSfree(_rex_string);
     if (_subst)
@@ -280,7 +281,7 @@ class RemapRegex
 
         if (ix > -1) {
           if ((ix < 10) && (ix > ccount)) {
-            TSDebug(PLUGIN_NAME, "Trying to use unavailable substitution, check the regex!");
+            TSLogDebug("Trying to use unavailable substitution, check the regex!");
             return -1; // No substitutions available other than $0
           }
 
@@ -554,7 +555,7 @@ TSRemapInit(TSRemapInterface* api_info, char *errbuf, int errbuf_size)
   }
 
   setup_memory_allocation();
-  TSDebug(PLUGIN_NAME, "plugin is successfully initialized");
+  TSLogInfo("plugin is successfully initialized");
   return TS_SUCCESS;
 }
 
@@ -575,7 +576,7 @@ TSRemapNewInstance(int argc, char* argv[], void** ih, char* /* errbuf
ATS_UNUSED
 
   *ih = (void*)ri;
   if (ri == NULL) {
-    TSError("Unable to create remap instance");
+    TSLogError("Unable to create remap instance");
     return TS_ERROR;
   }
 
@@ -607,10 +608,10 @@ TSRemapNewInstance(int argc, char* argv[], void** ih, char* /* errbuf
ATS_UNUSED
 
       f.open((ri->filename).c_str(), std::ios::in);
       if (!f.is_open()) { // Try with the default path instead
-        TSError("unable to open %s", (ri->filename).c_str());
+        TSLogError("unable to open %s", (ri->filename).c_str());
         return TS_ERROR;
       }
-      TSDebug(PLUGIN_NAME, "loading regular expression maps from %s", (ri->filename).c_str());
+      TSLogDebug("loading regular expression maps from %s", (ri->filename).c_str());
 
       while (!f.eof()) {
         std::string line, regex, subst, options;
@@ -647,12 +648,12 @@ TSRemapNewInstance(int argc, char* argv[], void** ih, char* /* errbuf
ATS_UNUSED
 
         if (regex.empty()) {
           // No regex found on this line
-          TSError("no regexp found in %s: line %d", (ri->filename).c_str(), lineno);
+          TSLogError("no regexp found in %s: line %d", (ri->filename).c_str(), lineno);
           continue;
         }
         if (subst.empty() && options.empty()) {
           // No substitution found on this line (and no options)
-          TSError("no substitution string found in %s: line %d", (ri->filename).c_str(),
lineno);
+          TSLogError("no substitution string found in %s: line %d", (ri->filename).c_str(),
lineno);
           continue;
         }
 
@@ -660,16 +661,15 @@ TSRemapNewInstance(int argc, char* argv[], void** ih, char* /* errbuf
ATS_UNUSED
         RemapRegex* cur = new RemapRegex(regex, subst, options);
 
         if (cur == NULL) {
-          TSError("can't create a new regex remap rule");
+          TSLogError("can't create a new regex remap rule");
           continue;
         }
 
         if (cur->compile(&error, &erroffset) < 0) {
-          TSError("PCRE failed in %s (line %d) at offset %d: %s", (ri->filename).c_str(),
lineno, erroffset, error);
+          TSLogError("PCRE failed in %s (line %d) at offset %d: %s", (ri->filename).c_str(),
lineno, erroffset, error);
           delete(cur);
         } else {
-          TSDebug(PLUGIN_NAME, "added regex=%s with substitution=%s and options `%s'",
-                   regex.c_str(), subst.c_str(), options.c_str());
+          TSLogDebug("added regex=%s with substitution=%s and options `%s'", regex.c_str(),
subst.c_str(), options.c_str());
           cur->set_order(++count);
           if (ri->first == NULL)
             ri->first = cur;
@@ -683,7 +683,7 @@ TSRemapNewInstance(int argc, char* argv[], void** ih, char* /* errbuf
ATS_UNUSED
 
   // Make sure we got something...
   if (ri->first == NULL) {
-    TSError("Got no regular expressions from the maps");
+    TSLogError("Got no regular expressions from the maps");
     return TS_ERROR;
   }
 
@@ -743,7 +743,7 @@ TSRemapStatus
 TSRemapDoRemap(void* ih, TSHttpTxn txnp, TSRemapRequestInfo *rri)
 {
   if (NULL == ih) {
-    TSDebug(PLUGIN_NAME, "Falling back to default URL on regex remap without rules");
+    TSLogDebug("Falling back to default URL on regex remap without rules");
     return TSREMAP_NO_REMAP;
   }
 
@@ -796,7 +796,7 @@ TSRemapDoRemap(void* ih, TSHttpTxn txnp, TSRemapRequestInfo *rri)
     match_len += (req_url.query_len + 1);
   }
   match_buf[match_len] = '\0'; // NULL terminate the match string
-  TSDebug(PLUGIN_NAME, "Target match string is `%s'", match_buf);
+  TSLogDebug("Target match string is `%s'", match_buf);
 
   // Apply the regular expressions, in order. First one wins.
   while (re) {
@@ -806,19 +806,19 @@ TSRemapDoRemap(void* ih, TSHttpTxn txnp, TSRemapRequestInfo *rri)
 
       // Set timeouts
       if (re->active_timeout_option() > (-1)) {
-        TSDebug(PLUGIN_NAME, "Setting active timeout to %d", re->active_timeout_option());
+        TSLogDebug("Setting active timeout to %d", re->active_timeout_option());
         TSHttpTxnActiveTimeoutSet(txnp, re->active_timeout_option());
       }
       if (re->no_activity_timeout_option() > (-1)) {
-        TSDebug(PLUGIN_NAME, "Setting no activity timeout to %d", re->no_activity_timeout_option());
+        TSLogDebug("Setting no activity timeout to %d", re->no_activity_timeout_option());
         TSHttpTxnNoActivityTimeoutSet(txnp, re->no_activity_timeout_option());
       }
       if (re->connect_timeout_option() > (-1)) {
-        TSDebug(PLUGIN_NAME, "Setting connect timeout to %d", re->connect_timeout_option());
+        TSLogDebug("Setting connect timeout to %d", re->connect_timeout_option());
         TSHttpTxnConnectTimeoutSet(txnp, re->connect_timeout_option());
       }
       if (re->dns_timeout_option() > (-1)) {
-        TSDebug(PLUGIN_NAME, "Setting DNS timeout to %d", re->dns_timeout_option());
+        TSLogDebug("Setting DNS timeout to %d", re->dns_timeout_option());
         TSHttpTxnDNSTimeoutSet(txnp, re->dns_timeout_option());
       }
 
@@ -834,9 +834,9 @@ TSRemapDoRemap(void* ih, TSHttpTxn txnp, TSRemapRequestInfo *rri)
         dest = (char*)alloca(new_len+8);
         dest_len = re->substitute(dest, match_buf, ovector, lengths, rri, &req_url);
 
-        TSDebug(PLUGIN_NAME, "New URL is estimated to be %d bytes long, or less", new_len);
-        TSDebug(PLUGIN_NAME, "New URL is %s (length %d)", dest, dest_len);
-        TSDebug(PLUGIN_NAME, "    matched rule %d [%s]", re->order(), re->regex());
+        TSLogDebug("New URL is estimated to be %d bytes long, or less", new_len);
+        TSLogDebug("New URL is %s (length %d)", dest, dest_len);
+        TSLogDebug("    matched rule %d [%s]", re->order(), re->regex());
 
         // Check for a quick response, if the status option is set
         if (re->status_option() > 0) {
@@ -847,7 +847,7 @@ TSRemapDoRemap(void* ih, TSHttpTxn txnp, TSRemapRequestInfo *rri)
             break;
           }
 
-          TSDebug(PLUGIN_NAME, "Redirecting URL, status=%d", re->status_option());
+          TSLogDebug("Redirecting URL, status=%d", re->status_option());
           TSHttpTxnSetHttpRetStatus(txnp, re->status_option());
           rri->redirect = 1;
         }
@@ -859,7 +859,7 @@ TSRemapDoRemap(void* ih, TSHttpTxn txnp, TSRemapRequestInfo *rri)
           // Setup the new URL
           if (TS_PARSE_ERROR == TSUrlParse(rri->requestBufp, rri->requestUrl, &start,
start + dest_len)) {
             TSHttpTxnSetHttpRetStatus(txnp, TS_HTTP_STATUS_INTERNAL_SERVER_ERROR);
-            TSError("can't parse substituted URL string");
+            TSLogError("can't parse substituted URL string");
           }
         }
         break;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/42306ff7/plugins/stats_over_http/stats_over_http.c
----------------------------------------------------------------------
diff --git a/plugins/stats_over_http/stats_over_http.c b/plugins/stats_over_http/stats_over_http.c
index 89a13af..5cfb8db 100644
--- a/plugins/stats_over_http/stats_over_http.c
+++ b/plugins/stats_over_http/stats_over_http.c
@@ -39,6 +39,9 @@
 static const char* url_path = "_stats";
 static int url_path_len;
 
+#define PLUGIN_NAME "stats_ver_http"
+#include <ts/debug.h>
+
 typedef struct stats_state_t
 {
   TSVConn net_vc;
@@ -102,20 +105,20 @@ stats_add_resp_header(stats_state * my_state)
 static void
 stats_process_read(TSCont contp, TSEvent event, stats_state * my_state)
 {
-  TSDebug("istats", "stats_process_read(%d)", event);
+  TSLogDebug("event: %d", event);
   if (event == TS_EVENT_VCONN_READ_READY) {
     my_state->output_bytes = stats_add_resp_header(my_state);
     TSVConnShutdown(my_state->net_vc, 1, 0);
     my_state->write_vio = TSVConnWrite(my_state->net_vc, contp, my_state->resp_reader,
INT64_MAX);
   } else if (event == TS_EVENT_ERROR) {
-    TSError("stats_process_read: Received TS_EVENT_ERROR\n");
+    TSLogError("Received TS_EVENT_ERROR");
   } else if (event == TS_EVENT_VCONN_EOS) {
     /* client may end the connection, simply return */
     return;
   } else if (event == TS_EVENT_NET_ACCEPT_FAILED) {
-    TSError("stats_process_read: Received TS_EVENT_NET_ACCEPT_FAILED\n");
+    TSLogError("Received TS_EVENT_NET_ACCEPT_FAILED");
   } else {
-    printf("Unexpected Event %d\n", event);
+    TSLogError("Unexpected Event %d", event);
     TSReleaseAssert(!"Unexpected Event");
   }
 }
@@ -143,7 +146,7 @@ json_out_stat(TSRecordType rec_type ATS_UNUSED, void *edata, int registered
ATS_
   case TS_RECORDDATATYPE_STRING:
     APPEND_STAT(name, "%s", datum->rec_string); break;
   default:
-    TSDebug("istats", "unknown type for %s: %d", name, data_type);
+    TSLogDebug("unknown type for %s: %d", name, data_type);
     break;
   }
 }
@@ -166,7 +169,7 @@ stats_process_write(TSCont contp, TSEvent event, stats_state * my_state)
 {
   if (event == TS_EVENT_VCONN_WRITE_READY) {
     if (my_state->body_written == 0) {
-      TSDebug("istats", "plugin adding response body");
+      TSLogDebug("plugin adding response body");
       my_state->body_written = 1;
       json_out_stats(my_state);
       TSVIONBytesSet(my_state->write_vio, my_state->output_bytes);
@@ -175,7 +178,7 @@ stats_process_write(TSCont contp, TSEvent event, stats_state * my_state)
   } else if (TS_EVENT_VCONN_WRITE_COMPLETE) {
     stats_cleanup(contp, my_state);
   } else if (event == TS_EVENT_ERROR) {
-    TSError("stats_process_write: Received TS_EVENT_ERROR\n");
+    TSLogError("Received TS_EVENT_ERROR");
   } else {
     TSReleaseAssert(!"Unexpected Event");
   }
@@ -208,7 +211,7 @@ stats_origin(TSCont contp ATS_UNUSED, TSEvent event ATS_UNUSED, void *edata)
   TSMLoc hdr_loc = NULL, url_loc = NULL;
   TSEvent reenable = TS_EVENT_HTTP_CONTINUE;
 
-  TSDebug("istats", "in the read stuff");
+  TSLogDebug("in the read stuff");
  
   if (TSHttpTxnClientReqGet(txnp, &reqp, &hdr_loc) != TS_SUCCESS)
     goto cleanup;
@@ -218,7 +221,7 @@ stats_origin(TSCont contp ATS_UNUSED, TSEvent event ATS_UNUSED, void *edata)
   
   int path_len = 0;
   const char* path = TSUrlPathGet(reqp,url_loc,&path_len);
-  TSDebug("istats","Path: %.*s",path_len,path);
+  TSLogDebug("Path: %.*s",path_len,path);
   
   if (! (path_len != 0 && path_len == url_path_len  && !memcmp(path,url_path,url_path_len))
) {
     goto notforme;
@@ -227,7 +230,7 @@ stats_origin(TSCont contp ATS_UNUSED, TSEvent event ATS_UNUSED, void *edata)
   TSSkipRemappingSet(txnp,1); //not strictly necessary, but speed is everything these days
 
   /* This is us -- register our intercept */
-  TSDebug("istats", "Intercepting request");
+  TSLogDebug("Intercepting request");
 
   icontp = TSContCreate(stats_dostuff, TSMutexCreate());
   my_state = (stats_state *) TSmalloc(sizeof(*my_state));
@@ -254,12 +257,12 @@ TSPluginInit(int argc, const char *argv[])
 {
   TSPluginRegistrationInfo info;
 
-  info.plugin_name = "stats";
+  info.plugin_name = "stats_over_http";
   info.vendor_name = "Apache Software Foundation";
-  info.support_email = "jesus@omniti.com";
+  info.support_email = "dev@trafficserver.apache.org";
 
   if (TSPluginRegister(TS_SDK_VERSION_2_0, &info) != TS_SUCCESS)
-    TSError("Plugin registration failed. \n");
+    TSLogError("Plugin registration failed. \n");
 
   if (argc > 1) {
     url_path = TSstrdup(argv[1] + ('/' == argv[1][0] ? 1 : 0)); /* Skip leading / */
@@ -269,5 +272,5 @@ TSPluginInit(int argc, const char *argv[])
   /* Create a continuation with a mutex as there is a shared global structure
      containing the headers to add */
   TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, TSContCreate(stats_origin, NULL));
-  TSDebug("istats", "stats module registered");
+  TSLogInfo("stats module registered");
 }


Mime
View raw message