From 9e5babf9db52e64bdae60137be7696e56241fca6 Mon Sep 17 00:00:00 2001
From: xingzilong <xingzilong@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期五, 18 八月 2017 18:12:17 +0800
Subject: [PATCH] H264 NALU解析  并在RTSPServer判断

---
 RtspFace/logger.h |   52 +++++++++++++---------------------------------------
 1 files changed, 13 insertions(+), 39 deletions(-)

diff --git a/RtspFace/logger.h b/RtspFace/logger.h
index fe50d00..202b088 100644
--- a/RtspFace/logger.h
+++ b/RtspFace/logger.h
@@ -1,49 +1,23 @@
-/* ---------------------------------------------------------------------------
-** This software is in the public domain, furnished "as is", without technical
-** support, and with no warranty, express or implied, as to its usefulness for
-** any purpose.
-**
-** logger.h
-** 
-** -------------------------------------------------------------------------*/
-
 #ifndef LOGGER_H
 #define LOGGER_H
 
+#include "Logger/src/logger.hpp"
+#include <string.h>
 #include <unistd.h>
 
-#include "log4cpp/Category.hh"
-#include "log4cpp/FileAppender.hh"
-#include "log4cpp/PatternLayout.hh"
+extern Logger g_logger;
 
+#define LOG_ENDL     std::endl
+#define WARN         WARNING
 
-#define LOG(__level)  log4cpp::Category::getRoot() << log4cpp::Priority::__level << __FILE__ << ":" << __LINE__ << "\t" 
-#define LOGP(__level, __format, arg...) log4cpp::Category::getRoot().log(log4cpp::Priority::__level, "%s:%d\t" __format, __FILE__, __LINE__, ##arg);
+#define LOG(__level)  g_logger << __level << __FILE__ << ":" << __LINE__ << "\t"
+#define LOGP(__level, __format, arg...)  { char msg[1024]; sprintf(msg, "%s:%d\t" __format, __FILE__, __LINE__, ##arg); g_logger << __level << msg << LOG_ENDL; }
 
-inline void initLogger(int verbose)
-{
-	// initialize log4cpp
-	log4cpp::Category &log = log4cpp::Category::getRoot();
-	log4cpp::Appender *app = new log4cpp::FileAppender("root", fileno(stdout));
-	if (app)
-	{
-		log4cpp::PatternLayout *plt = new log4cpp::PatternLayout();
-		if (plt)
-		{
-			plt->setConversionPattern("%d [%-6p] - %m%n");
-			app->setLayout(plt);
-		}
-		log.addAppender(app);
-	}
-	switch (verbose)
-	{
-		case 2: log.setPriority(log4cpp::Priority::DEBUG); break;
-		case 1: log.setPriority(log4cpp::Priority::INFO); break;
-		default: log.setPriority(log4cpp::Priority::NOTICE); break;
-		
-	}
-	LOG(INFO) << "level:" << log4cpp::Priority::getPriorityName(log.getPriority()); 
-}
-	
+#define LOG_DEBUG    LOG(DEBUG) // Debug message do not care in any production environment
+#define LOG_INFO     LOG(INFO) // Not significant event but useful for deal with online problem
+#define LOG_NOTICE   LOG(NOTICE) // Important event
+#define LOG_WARN     LOG(WARNING) // Important event or input which will lead to errors
+#define LOG_ERROR    LOG(ERROR) // Error message means program running in an abnormal (not expected) way
+
 #endif
 

--
Gitblit v1.8.0