Commit e0828dcb authored by Yiwei Zhang's avatar Yiwei Zhang
Browse files

mesa: redirect mesa_log to mesa-log



tail -f /proc/$(ps -eL|grep virtio_gpu|awk '{print $1}'|head -n 1)/root/mesa-log
Signed-off-by: Yiwei Zhang's avatarYiwei Zhang <zzyiwei@chromium.org>
parent 18d48c01
Pipeline #334276 waiting for manual action with stages
......@@ -22,6 +22,7 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#ifdef ANDROID
#include <android/log.h>
......@@ -62,14 +63,53 @@ level_to_str(enum mesa_log_level l)
}
#endif
static FILE *LogFile = NULL;
static void
output_if_debug(const char *prefix, const char *output)
{
static int 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 = getenv("MESA_LOG_FILE");
if (logFile)
LogFile = fopen(logFile, "w");
if (!LogFile)
LogFile = stderr;
#ifndef NDEBUG
debug = 1;
#else
const char *env = getenv("MESA_DEBUG");
debug = env != NULL;
#endif
}
/* Now only print the string if we're required to do so. */
if (debug) {
if (prefix)
fprintf(LogFile, "%s: %s\n", prefix, output);
else
fprintf(LogFile, "%s\n", output);
fflush(LogFile);
}
}
#define MAX_DEBUG_MESSAGE_LENGTH 4096
void
mesa_log(enum mesa_log_level level, const char *tag, const char *format, ...)
{
char s[MAX_DEBUG_MESSAGE_LENGTH];
va_list va;
va_start(va, format);
mesa_log_v(level, tag, format, va);
vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, format, va);
va_end(va);
output_if_debug("MESA", s);
}
void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment