auxilary/os: allow appending to GALLIUM_LOG_FILE
If the log file specified by the GALLIUM_LOG_FILE begins with '+', open the file in append mode. This is useful to log all gallium output for an entire piglit run, for example. v2: put GALLIUM_LOG_FILE support inside an #ifdef DEBUG block. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
parent
c99a0a8bce
commit
bb1292e226
|
@ -69,10 +69,21 @@ os_log_message(const char *message)
|
||||||
static FILE *fout = NULL;
|
static FILE *fout = NULL;
|
||||||
|
|
||||||
if (!fout) {
|
if (!fout) {
|
||||||
|
#ifdef DEBUG
|
||||||
/* one-time init */
|
/* one-time init */
|
||||||
const char *filename = os_get_option("GALLIUM_LOG_FILE");
|
const char *filename = os_get_option("GALLIUM_LOG_FILE");
|
||||||
if (filename)
|
if (filename) {
|
||||||
fout = fopen(filename, "w");
|
const char *mode = "w";
|
||||||
|
if (filename[0] == '+') {
|
||||||
|
/* If the filename is prefixed with '+' then open the file for
|
||||||
|
* appending instead of normal writing.
|
||||||
|
*/
|
||||||
|
mode = "a";
|
||||||
|
filename++; /* skip the '+' */
|
||||||
|
}
|
||||||
|
fout = fopen(filename, mode);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (!fout)
|
if (!fout)
|
||||||
fout = stderr;
|
fout = stderr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue