From 3afe38168c44b59f1732f2d55ec08b8f81d879bc Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期五, 17 七月 2020 11:54:08 +0800
Subject: [PATCH] commit -a

---
 queue/include/shm_socket.h     |   13 ------
 queue/libshm_queue.a           |    0 
 lib/libusgcommon.a             |    0 
 queue/include/mod_socket.h     |   27 +++++++++++++
 queue/shm_socket.c             |    5 +-
 queue/mod_socket.c             |    2 +
 include/usgcommon/usg_common.h |    6 ++
 include/usgcommon/logger.h     |   57 ++++++++++++++--------------
 test/communication             |    0 
 lib/libusgcommon.so            |    0 
 10 files changed, 66 insertions(+), 44 deletions(-)

diff --git a/include/usgcommon/logger.h b/include/usgcommon/logger.h
index 4afb855..a9e4de4 100644
--- a/include/usgcommon/logger.h
+++ b/include/usgcommon/logger.h
@@ -5,40 +5,39 @@
 #include "usg_typedef.h"
 
 class Logger {
-	std::string configFile;
-	int level;
+  std::string configFile;
+  int level;
 
-	void dolog(const char *fmt, va_list ap)
-	{
-		char	buf[MAXBUF];
-		vsnprintf(buf, MAXBUF-1, fmt, ap);
-		strcat(buf, "\n");
-		fflush(stdout);		/* in case stdout and stderr are the same */
-		fputs(buf, stdout);
-		fflush(NULL);		/* flushes all stdio output streams */
-	}
+  void dolog(const char *fmt, va_list ap) {
+    char buf[MAXBUF];
+
+    struct timeval tv;
+    struct tm *info;
+    gettimeofday(&tv, NULL);
+    info = localtime(&tv.tv_sec);
+    strftime(buf, MAXLINE - 1, "%Y-%d-%m %H:%M:%S ", info);
+    snprintf(buf + strlen(buf), MAXLINE - strlen(buf) - 1, "(%ld) ", tv.tv_sec * 1000000 + tv.tv_usec);
+
+    vsnprintf(buf + strlen(buf), MAXLINE - strlen(buf) - 1, fmt, ap);
+    strcat(buf, "\n");
+    fflush(stdout); /* in case stdout and stderr are the same */
+    fputs(buf, stdout);
+    fflush(NULL); /* flushes all stdio output streams */
+  }
+
 public:
-	enum {
-		ALL ,
-		DEBUG ,
-		INFO ,
-		WARN ,
-		ERROR ,
-		FATAL ,
-		OFF
-	};
+  enum { ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF };
 
-	Logger(int l = INFO): level(l) {}
-	Logger(std::string cf);
-	
+  Logger(int l = INFO) : level(l) {}
+  Logger(std::string cf);
 
-	void log(int _level,  const char *fmt,  ...);
+  void log(int _level, const char *fmt, ...);
 
-	void debug(const char *fmt, ...);
-	void info(const char *fmt, ...);
-	void warn(const char *fmt, ...);
-	void error(const char *fmt, ...);
-	void fatal(const char *fmt, ...);
+  void debug(const char *fmt, ...);
+  void info(const char *fmt, ...);
+  void warn(const char *fmt, ...);
+  void error(const char *fmt, ...);
+  void fatal(const char *fmt, ...);
 };
 
 #endif
\ No newline at end of file
diff --git a/include/usgcommon/usg_common.h b/include/usgcommon/usg_common.h
index ad509ed..7bcef86 100644
--- a/include/usgcommon/usg_common.h
+++ b/include/usgcommon/usg_common.h
@@ -59,14 +59,18 @@
 #include <fstream>
 #include <sstream>
 #include <string>
+
 #include <cstdlib>
 #include <atomic>
 #include <algorithm>
 #include <iomanip>
 #include <limits>
-#include <map>
+
 #include <initializer_list>
 #include <vector>
+#include <map>
+#include <set>
+
 #include <thread>
  
 #endif
diff --git a/lib/libusgcommon.a b/lib/libusgcommon.a
index d32be3a..f03c816 100644
--- a/lib/libusgcommon.a
+++ b/lib/libusgcommon.a
Binary files differ
diff --git a/lib/libusgcommon.so b/lib/libusgcommon.so
index dd862b0..1106ad9 100644
--- a/lib/libusgcommon.so
+++ b/lib/libusgcommon.so
Binary files differ
diff --git a/queue/include/mod_socket.h b/queue/include/mod_socket.h
new file mode 100644
index 0000000..27d076f
--- /dev/null
+++ b/queue/include/mod_socket.h
@@ -0,0 +1,27 @@
+#ifndef __MOD_SOCKET_H__
+#define __MOD_SOCKET_H__
+
+#include "shm_socket.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum shm_mod_t
+{
+	PULL_PUSH = 1,
+	REQ_REP = 2,
+	PAIR = 3,
+	PUB_SUB = 4,
+	SURVEY = 5,
+	BUS = 6
+	
+};
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
diff --git a/queue/include/socket.h b/queue/include/shm_socket.h
similarity index 94%
rename from queue/include/socket.h
rename to queue/include/shm_socket.h
index b7e2807..f14dbc6 100644
--- a/queue/include/socket.h
+++ b/queue/include/shm_socket.h
@@ -9,21 +9,10 @@
 #include "mem_pool.h"
 #include "hashtable.h"
 #include "sem_util.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
-
-enum shm_mod_t
-{
-	PULL_PUSH = 1,
-	REQ_REP = 2,
-	PAIR = 3,
-	PUB_SUB = 4,
-	SURVEY = 5,
-	BUS = 6
-	
-};
-
 
 enum shm_msg_type_t
 {
diff --git a/queue/libshm_queue.a b/queue/libshm_queue.a
index f1b3525..6b03423 100644
--- a/queue/libshm_queue.a
+++ b/queue/libshm_queue.a
Binary files differ
diff --git a/queue/mod_socket.c b/queue/mod_socket.c
new file mode 100644
index 0000000..f73dcba
--- /dev/null
+++ b/queue/mod_socket.c
@@ -0,0 +1,2 @@
+#include "mod_socket.h"
+
diff --git a/queue/socket.c b/queue/shm_socket.c
similarity index 98%
rename from queue/socket.c
rename to queue/shm_socket.c
index 29b94d4..f896e33 100644
--- a/queue/socket.c
+++ b/queue/shm_socket.c
@@ -1,9 +1,10 @@
-
-#include "socket.h"
+#include "shm_socket.h"
+#include "logger_factory.h"
 #include <map>
 
 
 
+static Logger logger = LoggerFactory::getLogger();
 
 void print_msg(char *head, shm_msg_t& msg) {
 	//err_msg(0, "%s: port=%d, type=%d\n", head, msg.port, msg.type);
diff --git a/test/communication b/test/communication
index 1f9adb7..f6fda73 100755
--- a/test/communication
+++ b/test/communication
Binary files differ

--
Gitblit v1.8.0