mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
mesa: new MESA_LOG_FILE env var to log errors, warnings, etc., to a file
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
parent
0f530d2dff
commit
9ccf5bffe3
2 changed files with 14 additions and 2 deletions
|
|
@ -42,6 +42,8 @@ sometimes be useful for debugging end-user issues.
|
||||||
printed to stderr.<br>
|
printed to stderr.<br>
|
||||||
If the value of MESA_DEBUG is 'FP' floating point arithmetic errors will
|
If the value of MESA_DEBUG is 'FP' floating point arithmetic errors will
|
||||||
generate exceptions.
|
generate exceptions.
|
||||||
|
<li>MESA_LOG_FILE - specifies a file name for logging all errors, warnings,
|
||||||
|
etc., rather than stderr
|
||||||
<li>MESA_TEX_PROG - if set, implement conventional texture env modes with
|
<li>MESA_TEX_PROG - if set, implement conventional texture env modes with
|
||||||
fragment programs (intended for developers only)
|
fragment programs (intended for developers only)
|
||||||
<li>MESA_TNL_PROG - if set, implement conventional vertex transformation
|
<li>MESA_TNL_PROG - if set, implement conventional vertex transformation
|
||||||
|
|
|
||||||
|
|
@ -801,12 +801,21 @@ output_if_debug(const char *prefixString, const char *outputString,
|
||||||
GLboolean newline)
|
GLboolean newline)
|
||||||
{
|
{
|
||||||
static int debug = -1;
|
static int debug = -1;
|
||||||
|
static FILE *fout = NULL;
|
||||||
|
|
||||||
/* Init the local 'debug' var once.
|
/* Init the local 'debug' var once.
|
||||||
* Note: the _mesa_init_debug() function should have been called
|
* Note: the _mesa_init_debug() function should have been called
|
||||||
* by now so MESA_DEBUG_FLAGS will be initialized.
|
* by now so MESA_DEBUG_FLAGS will be initialized.
|
||||||
*/
|
*/
|
||||||
if (debug == -1) {
|
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
|
#ifdef DEBUG
|
||||||
/* in debug builds, print messages unless MESA_DEBUG="silent" */
|
/* in debug builds, print messages unless MESA_DEBUG="silent" */
|
||||||
if (MESA_DEBUG_FLAGS & 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. */
|
/* Now only print the string if we're required to do so. */
|
||||||
if (debug) {
|
if (debug) {
|
||||||
fprintf(stderr, "%s: %s", prefixString, outputString);
|
fprintf(fout, "%s: %s", prefixString, outputString);
|
||||||
if (newline)
|
if (newline)
|
||||||
fprintf(stderr, "\n");
|
fprintf(fout, "\n");
|
||||||
|
fflush(fout);
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(_WIN32_WCE)
|
#if defined(_WIN32) && !defined(_WIN32_WCE)
|
||||||
/* stderr from windows applications without console is not usually
|
/* stderr from windows applications without console is not usually
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue