trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject [09/17] git commit: TS-2302: LogUtils wants to be a namespace, not a class
Date Thu, 31 Oct 2013 15:18:28 GMT
TS-2302: LogUtils wants to be a namespace, not a class


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/27417646
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/27417646
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/27417646

Branch: refs/heads/master
Commit: 274176463444d3efdee7e9c92ac6f80fb2bbd189
Parents: 81b3622
Author: James Peach <jpeach@apache.org>
Authored: Wed Sep 25 14:04:41 2013 -0700
Committer: James Peach <jpeach@apache.org>
Committed: Thu Oct 31 08:16:27 2013 -0700

----------------------------------------------------------------------
 proxy/logging/LogConfig.cc |  2 +-
 proxy/logging/LogUtils.cc  |  8 --------
 proxy/logging/LogUtils.h   | 43 +++++++++++++++--------------------------
 3 files changed, 17 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/27417646/proxy/logging/LogConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc
index fef2b55..161372e 100644
--- a/proxy/logging/LogConfig.cc
+++ b/proxy/logging/LogConfig.cc
@@ -1456,7 +1456,7 @@ LogConfig::update_space_used()
   if (!logfile_dir) {
     const char *msg = "Logging directory not specified";
     Error("%s", msg);
-    LogUtils::manager_alarm(LogUtils::LOG_ALARM_ERROR, msg);
+    LogUtils::manager_alarm(LogUtils::LOG_ALARM_ERROR, "%s", msg);
     m_log_directory_inaccessible = true;
     return;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/27417646/proxy/logging/LogUtils.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogUtils.cc b/proxy/logging/LogUtils.cc
index 5104d36..c92fac9 100644
--- a/proxy/logging/LogUtils.cc
+++ b/proxy/logging/LogUtils.cc
@@ -54,14 +54,6 @@
 
 
 /*-------------------------------------------------------------------------
-  -------------------------------------------------------------------------*/
-
-LogUtils::LogUtils(DoNotConstruct /* object ATS_UNUSED */)
-{
-  ink_release_assert(!"you can't construct a LogUtils object");
-}
-
-/*-------------------------------------------------------------------------
   LogUtils::timestamp_to_str
 
   This routine will convert a timestamp (seconds) into a short string,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/27417646/proxy/logging/LogUtils.h
----------------------------------------------------------------------
diff --git a/proxy/logging/LogUtils.h b/proxy/logging/LogUtils.h
index 17ae106..090b239 100644
--- a/proxy/logging/LogUtils.h
+++ b/proxy/logging/LogUtils.h
@@ -28,16 +28,8 @@
 #include "libts.h"
 #include "Arena.h"
 
-
-#define NELEMS(array)  (sizeof(array)/sizeof(array[0]))
-
-typedef int DoNotConstruct;
-
-class LogUtils
+namespace LogUtils
 {
-public:
-  LogUtils(DoNotConstruct object);
-
   enum AlarmType
   {
     LOG_ALARM_ERROR = 0,
@@ -45,26 +37,23 @@ public:
     LOG_ALARM_N_TYPES
   };
 
-  static long timestamp() { return (long)time(0); }
-
-  static int timestamp_to_str(long timestamp, char *buf, int size);
-  static char *timestamp_to_netscape_str(long timestamp);
-  static char *timestamp_to_date_str(long timestamp);
-  static char *timestamp_to_time_str(long timestamp);
-  static unsigned ip_from_host(char *host);
-  static void manager_alarm(AlarmType alarm_type, const char *msg, ...);
-  static void strip_trailing_newline(char *buf);
-  static char *escapify_url(Arena * arena, char *url, size_t len_in, int *len_out, char *dst=NULL,
size_t dst_size=0, const unsigned char *map=NULL);
-  static char *int64_to_str(char *buf, unsigned int buf_size, int64_t val, unsigned int *total_chars,
unsigned int req_width=0, char pad_char='0');
-  static void remove_content_type_attributes(char *type_str, int *type_len);
-  static int timestamp_to_hex_str(unsigned timestamp, char *str, size_t len, size_t * n_chars
= 0);
-  static int seconds_to_next_roll(time_t time_now, int rolling_offset, int rolling_interval);
-  static int file_is_writeable(const char *full_filename,
+  static inline long timestamp() { return (long)time(0); }
+
+  int timestamp_to_str(long timestamp, char *buf, int size);
+  char *timestamp_to_netscape_str(long timestamp);
+  char *timestamp_to_date_str(long timestamp);
+  char *timestamp_to_time_str(long timestamp);
+  unsigned ip_from_host(char *host);
+  void manager_alarm(AlarmType alarm_type, const char *msg, ...) TS_PRINTFLIKE(2, 3);
+  void strip_trailing_newline(char *buf);
+  char *escapify_url(Arena * arena, char *url, size_t len_in, int *len_out, char *dst=NULL,
size_t dst_size=0, const unsigned char *map=NULL);
+  char *int64_to_str(char *buf, unsigned int buf_size, int64_t val, unsigned int *total_chars,
unsigned int req_width=0, char pad_char='0');
+  void remove_content_type_attributes(char *type_str, int *type_len);
+  int timestamp_to_hex_str(unsigned timestamp, char *str, size_t len, size_t * n_chars =
0);
+  int seconds_to_next_roll(time_t time_now, int rolling_offset, int rolling_interval);
+  int file_is_writeable(const char *full_filename,
                                off_t * size_bytes = 0,
                                bool * has_size_limit = 0, uint64_t * current_size_limit_bytes
= 0);
 
-private:
-  LogUtils(const LogUtils &);
-  LogUtils & operator=(const LogUtils &);
 };
 #endif


Mime
View raw message