[rtmpdump] r180 - in trunk: log.c log.h

hyc subversion at mplayerhq.hu
Mon Jan 4 08:59:06 CET 2010


Author: hyc
Date: Mon Jan  4 08:59:05 2010
New Revision: 180

Log:
More logging cleanup

Modified:
   trunk/log.c
   trunk/log.h

Modified: trunk/log.c
==============================================================================
--- trunk/log.c	Mon Jan  4 07:59:48 2010	(r179)
+++ trunk/log.c	Mon Jan  4 08:59:05 2010	(r180)
@@ -29,12 +29,17 @@
 
 #define MAX_PRINT_LEN	2048
 
-int debuglevel = LOGERROR;
+AMF_LogLevel debuglevel = LOGERROR;
 
 static int neednl;
 
 static FILE *fmsg;
 
+static const char *levels[] = {
+  "CRIT", "ERROR", "WARNING", "INFO",
+  "DEBUG", "DEBUG2"
+};
+
 void LogSetOutput(FILE *file)
 {
 	fmsg = file;
@@ -99,9 +104,7 @@ void Log(int level, const char *format, 
 			putc('\n', fmsg);
 			neednl = 0;
 		}
-		fprintf(fmsg, "\r%s: %s\n", level==LOGDEBUG?"DEBUG":(level==LOGERROR?
-"ERROR":(level==LOGWARNING?"WARNING":(level==LOGCRIT?"CRIT":"INFO"))), str);
-
+		fprintf(fmsg, "%s: %s\n", levels[level], str);
 #ifdef _DEBUG
 		fflush(fmsg);
 #endif

Modified: trunk/log.h
==============================================================================
--- trunk/log.h	Mon Jan  4 07:59:48 2010	(r179)
+++ trunk/log.h	Mon Jan  4 08:59:05 2010	(r180)
@@ -35,13 +35,10 @@ extern "C" {
 #undef NODEBUG
 #endif
 
-#define LOGCRIT         0
-#define LOGERROR        1
-#define LOGWARNING	2
-#define LOGINFO		3
-#define LOGDEBUG	4
-#define LOGDEBUG2	5
-#define LOGALL		6
+typedef enum
+{ LOGCRIT=0, LOGERROR, LOGWARNING, LOGINFO,
+  LOGDEBUG, LOGDEBUG2, LOGALL
+} AMF_LogLevel;
 
 #define Log	AMF_Log
 #define LogHex	AMF_LogHex
@@ -51,7 +48,7 @@ extern "C" {
 #define LogStatus	AMF_LogStatus
 #define debuglevel	AMF_debuglevel
 
-extern int debuglevel;
+extern AMF_LogLevel debuglevel;
 
 void LogSetOutput(FILE *file);
 void LogPrintf(const char *format, ...);


More information about the rtmpdump mailing list