]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/store_log.cc
Cleanup: zap CVS Id tags
[thirdparty/squid.git] / src / store_log.cc
index 79480c5444b5ddd1d40f3af2df2492855d55e1ce..7392a1c448f2cfe205c0819a55b73c3376af02f0 100644 (file)
@@ -1,6 +1,5 @@
-
 /*
- * $Id: store_log.cc,v 1.33 2007/05/18 06:41:25 amosjeffries Exp $
+ * $Id$
  *
  * DEBUG: section 20    Storage Manager Logging Functions
  * AUTHOR: Duane Wessels
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
 #include "MemObject.h"
 #include "HttpReply.h"
 #include "CacheManager.h"
+#include "SquidTime.h"
 
-static const char *storeLogTags[] =
-    {
-        "CREATE",
-        "SWAPIN",
-        "SWAPOUT",
-        "RELEASE",
-        "SO_FAIL",
-    };
+static const char *storeLogTags[] = {
+    "CREATE",
+    "SWAPIN",
+    "SWAPOUT",
+    "RELEASE",
+    "SO_FAIL",
+};
 
 static int storeLogTagsCounts[STORE_LOG_SWAPOUTFAIL+1];
 static OBJH storeLogTagsHist;
@@ -76,7 +75,7 @@ storeLog(int tag, const StoreEntry * e)
          * Because if we print it before the swap file number, it'll break
          * the existing log format.
          */
-        logfilePrintf(storelog, "%9d.%03d %-7s %02d %08X %s %4d %9d %9d %9d %s %d/%d %s %s\n",
+        logfilePrintf(storelog, "%9d.%03d %-7s %02d %08X %s %4d %9d %9d %9d %s %"PRId64"/%"PRId64" %s %s\n",
                       (int) current_time.tv_sec,
                       (int) current_time.tv_usec / 1000,
                       storeLogTags[tag],
@@ -87,10 +86,10 @@ storeLog(int tag, const StoreEntry * e)
                       (int) reply->date,
                       (int) reply->last_modified,
                       (int) reply->expires,
-                      !reply->content_type.empty() ? reply->content_type.c_str() : "unknown",
+                      reply->content_type.size() ? reply->content_type.buf() : "unknown",
                       reply->content_length,
                       e->contentLen(),
-                      RequestMethodStr[mem->method],
+                      RequestMethodStr(mem->method),
                       mem->log_url);
     } else {
         /* no mem object. Most RELEASE cases */
@@ -124,10 +123,20 @@ storeLogClose(void)
     storelog = NULL;
 }
 
+static void
+storeLogRegisterWithCacheManager(void)
+{
+    CacheManager::GetInstance()->
+    registerAction("store_log_tags", "Histogram of store.log tags",
+                   storeLogTagsHist, 0, 1);
+}
+
 void
 storeLogOpen(void)
 {
-    if (strcmp(Config.Log.store, "none") == 0) {
+    storeLogRegisterWithCacheManager();
+
+    if (Config.Log.store == NULL || strcmp(Config.Log.store, "none") == 0) {
         debugs(20, 1, "Store logging disabled");
         return;
     }
@@ -135,21 +144,13 @@ storeLogOpen(void)
     storelog = logfileOpen(Config.Log.store, 0, 1);
 }
 
-void
-storeLogRegisterWithCacheManager(CacheManager & manager)
-{
-    manager.registerAction("store_log_tags",
-       "Histogram of store.log tags",
-       storeLogTagsHist, 0, 1);
-}
-
 void
 storeLogTagsHist(StoreEntry *e)
 {
     int tag;
     for (tag = 0; tag <= STORE_LOG_SWAPOUTFAIL; tag++) {
-       storeAppendPrintf(e, "%s %d\n",
-           storeLogTags[tag],
-           storeLogTagsCounts[tag]);
+        storeAppendPrintf(e, "%s %d\n",
+                          storeLogTags[tag],
+                          storeLogTagsCounts[tag]);
     }
 }