So be nice and bare with me, this is all new (at least from a tool perspective).. I'm just going to post the patch text below.. I've added a TRACELOG macro that gets compiled out in anything other than debug. There were a few of the logging bits I wasn't overly sure about so I just gave it a stab. Nothing seems broken at least.
What's the preferred method? I see some people post it to sourceforge, but I thought I read somewhere the whole, changed files are easier.
Code:
Index: log.h
===================================================================
--- log.h (revision 13269)
+++ log.h (working copy)
@@ -1,26 +1,5 @@
#pragma once
-/*
- * Copyright (C) 2005-2008 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
#include <stdio.h>
#define LOG_LEVEL_NONE -1 // nothing at all is logged
@@ -28,17 +7,19 @@
#define LOG_LEVEL_DEBUG 1 // shows all
#define LOG_LEVEL_DEBUG_FREEMEM 2 // shows all + shows freemem on screen
#define LOG_LEVEL_DEBUG_SAMBA 3 // shows all + freemem on screen + samba debugging
-#define LOG_LEVEL_MAX LOG_LEVEL_DEBUG_SAMBA
+#define LOG_LEVEL_TRACE 4
+#define LOG_LEVEL_MAX LOG_LEVEL_TRACE
// ones we use in the code
-#define LOGDEBUG 0
-#define LOGINFO 1
-#define LOGNOTICE 2
-#define LOGWARNING 3
-#define LOGERROR 4
-#define LOGSEVERE 5
-#define LOGFATAL 6
-#define LOGNONE 7
+#define LOGTRACE 0
+#define LOGDEBUG 1
+#define LOGINFO 2
+#define LOGNOTICE 3
+#define LOGWARNING 4
+#define LOGERROR 5
+#define LOGSEVERE 6
+#define LOGFATAL 7
+#define LOGNONE 8
#ifdef __GNUC__
#define ATTRIB_LOG_FORMAT __attribute__((format(printf,2,3)))
@@ -59,6 +40,12 @@
static void DebugLogMemory();
};
+#ifdef _DEBUG
+ #define TRACELOG() CLog::Log(LOGTRACE, "%s(%d)", __PRETTY_FUNCTION__, __LINE__);
+#else
+ #define TRACELOG()
+#endif
+
// GL Error checking macro
// this function is useful for tracking down GL errors, which otherwise
// just result in undefined behavior and can be difficult to track down.
Index: log.cpp
===================================================================
--- log.cpp (revision 13269)
+++ log.cpp (working copy)
@@ -1,43 +1,3 @@
-/*
- * Copyright (C) 2005-2008 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-/*
- * Copyright (C) 2005-2008 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
#include "stdafx.h"
#include "log.h"
@@ -54,8 +14,8 @@
static CCriticalSection critSec;
-static char levelNames[][8] =
-{"DEBUG", "INFO", "NOTICE", "WARNING", "ERROR", "SEVERE", "FATAL", "NONE"};
+static char levelNames[][9] =
+{"TRACE", "DEBUG", "INFO", "NOTICE", "WARNING", "ERROR", "SEVERE", "FATAL", "NONE"};
CLog::CLog()