aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/errors.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-06-28 08:08:21 +0200
committermarha <marha@users.sourceforge.net>2012-06-28 08:08:21 +0200
commit67551627d34fff4a0fbe719bce33a3bacb55ccef (patch)
tree37b58281a1186148a56dbb3b9eed6eaf759cbe7b /mesalib/src/mesa/main/errors.c
parent7baa3d795c87c11550f1686488c968320428cbf9 (diff)
downloadvcxsrv-67551627d34fff4a0fbe719bce33a3bacb55ccef.tar.gz
vcxsrv-67551627d34fff4a0fbe719bce33a3bacb55ccef.tar.bz2
vcxsrv-67551627d34fff4a0fbe719bce33a3bacb55ccef.zip
xkeyboard-config mesa fontconfig randrproto git update 28 Jun 2012
Diffstat (limited to 'mesalib/src/mesa/main/errors.c')
-rw-r--r--mesalib/src/mesa/main/errors.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c
index 69dbb65cf..8b96319ce 100644
--- a/mesalib/src/mesa/main/errors.c
+++ b/mesalib/src/mesa/main/errors.c
@@ -718,11 +718,11 @@ _mesa_DebugMessageControlARB(GLenum source, GLenum type, GLenum severity,
}
static void GLAPIENTRY
-_mesa_DebugMessageCallbackARB(GLDEBUGPROCARB callback, GLvoid *userParam)
+_mesa_DebugMessageCallbackARB(GLDEBUGPROCARB callback, const GLvoid *userParam)
{
GET_CURRENT_CONTEXT(ctx);
ctx->Debug.Callback = callback;
- ctx->Debug.CallbackData = userParam;
+ ctx->Debug.CallbackData = (void *) userParam;
}
void
@@ -801,12 +801,21 @@ output_if_debug(const char *prefixString, const char *outputString,
GLboolean newline)
{
static int debug = -1;
+ static FILE *fout = NULL;
/* Init the local 'debug' var once.
* Note: the _mesa_init_debug() function should have been called
* by now so MESA_DEBUG_FLAGS will be initialized.
*/
if (debug == -1) {
+ /* If MESA_LOG_FILE env var is set, log Mesa errors, warnings,
+ * etc to the named file. Otherwise, output to stderr.
+ */
+ const char *logFile = _mesa_getenv("MESA_LOG_FILE");
+ if (logFile)
+ fout = fopen(logFile, "w");
+ if (!fout)
+ fout = stderr;
#ifdef DEBUG
/* in debug builds, print messages unless MESA_DEBUG="silent" */
if (MESA_DEBUG_FLAGS & DEBUG_SILENT)
@@ -821,9 +830,10 @@ output_if_debug(const char *prefixString, const char *outputString,
/* Now only print the string if we're required to do so. */
if (debug) {
- fprintf(stderr, "%s: %s", prefixString, outputString);
+ fprintf(fout, "%s: %s", prefixString, outputString);
if (newline)
- fprintf(stderr, "\n");
+ fprintf(fout, "\n");
+ fflush(fout);
#if defined(_WIN32) && !defined(_WIN32_WCE)
/* stderr from windows applications without console is not usually