aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/errors.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-04-20 21:25:25 +0200
committermarha <marha@users.sourceforge.net>2015-04-20 21:25:25 +0200
commit4ba9be2882d9f1567809edb0a31fcdf11320d41f (patch)
treef796ab7a5044f9dd99aac7cb9a7c836857987635 /mesalib/src/mesa/main/errors.c
parent82c8df11062f72a7d467e26cedbbd8b322ff7a70 (diff)
downloadvcxsrv-4ba9be2882d9f1567809edb0a31fcdf11320d41f.tar.gz
vcxsrv-4ba9be2882d9f1567809edb0a31fcdf11320d41f.tar.bz2
vcxsrv-4ba9be2882d9f1567809edb0a31fcdf11320d41f.zip
randrproto xkeyboard-config fontconfig libX11 libXdmcp libXmu pixman xkbcomp xserver mesa git update 20 Apr 2015
xserver commit b1029716e41e252f149b82124a149da180607c96 xkeyboard-config commit 7d00bcc2d9c3944bbdfcbe472ee3299729dc7687 libX11 commit 748d47e69f5c12d8557d56a8a8ec166588da7b93 libXdmcp commit b10f382e3aa2e86cd5a2bc27d6758da55f0ab1f6 xkbcomp commit 1ae525b3d236b59e6437b2b5433d460e18370973 pixman commit 58e21d3e45c5227c2ca9ac00cf044f22a7975180 randrproto commit 98da0d6e48b7d124d6788ea568e9f9e3dc204322 libXmu commit 4459e6940fe3fdf26a8d5d4c71989498bc400a62 fontconfig commit 07be485a0a84995ce69bf60e3b1bb22cb35f6b0e mesa commit c1485f4b7d044724b3dbc1011f3c3a8a53132010
Diffstat (limited to 'mesalib/src/mesa/main/errors.c')
-rw-r--r--mesalib/src/mesa/main/errors.c43
1 files changed, 36 insertions, 7 deletions
diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c
index 8ffbf413c..2aa1deb63 100644
--- a/mesalib/src/mesa/main/errors.c
+++ b/mesalib/src/mesa/main/errors.c
@@ -1232,12 +1232,14 @@ _mesa_free_errors_data(struct gl_context *ctx)
/** \name Diagnostics */
/*@{*/
+static FILE *LogFile = NULL;
+
+
static void
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
@@ -1249,9 +1251,9 @@ output_if_debug(const char *prefixString, const char *outputString,
*/
const char *logFile = getenv("MESA_LOG_FILE");
if (logFile)
- fout = fopen(logFile, "w");
- if (!fout)
- fout = stderr;
+ LogFile = fopen(logFile, "w");
+ if (!LogFile)
+ LogFile = stderr;
#ifdef DEBUG
/* in debug builds, print messages unless MESA_DEBUG="silent" */
if (MESA_DEBUG_FLAGS & DEBUG_SILENT)
@@ -1266,10 +1268,13 @@ output_if_debug(const char *prefixString, const char *outputString,
/* Now only print the string if we're required to do so. */
if (debug) {
- fprintf(fout, "%s: %s", prefixString, outputString);
+ if (prefixString)
+ fprintf(LogFile, "%s: %s", prefixString, outputString);
+ else
+ fprintf(LogFile, "%s", outputString);
if (newline)
- fprintf(fout, "\n");
- fflush(fout);
+ fprintf(LogFile, "\n");
+ fflush(LogFile);
#if defined(_WIN32)
/* stderr from windows applications without console is not usually
@@ -1285,6 +1290,18 @@ output_if_debug(const char *prefixString, const char *outputString,
/**
+ * Return the file handle to use for debug/logging. Defaults to stderr
+ * unless MESA_LOG_FILE is defined.
+ */
+FILE *
+_mesa_get_log_file(void)
+{
+ assert(LogFile);
+ return LogFile;
+}
+
+
+/**
* When a new type of error is recorded, print a message describing
* previous errors which were accumulated.
*/
@@ -1525,6 +1542,18 @@ _mesa_debug( const struct gl_context *ctx, const char *fmtString, ... )
}
+void
+_mesa_log(const char *fmtString, ...)
+{
+ char s[MAX_DEBUG_MESSAGE_LENGTH];
+ va_list args;
+ va_start(args, fmtString);
+ _mesa_vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args);
+ va_end(args);
+ output_if_debug("", s, GL_FALSE);
+}
+
+
/**
* Report debug information from the shader compiler via GL_ARB_debug_output.
*