1 // 2 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // debug.cpp: Debugging utilities. 8 9 #include "common/debug.h" 10 11 #include <stdio.h> 12 #include <stdarg.h> 13 14 #ifndef TRACE_OUTPUT_FILE 15 #define TRACE_OUTPUT_FILE "debug.txt" 16 #endif 17 18 static bool trace_on = true; 19 20 namespace gl 21 { 22 void trace(const char *format, ...) 23 { 24 #if !defined(ANGLE_DISABLE_TRACE) 25 if (trace_on) 26 { 27 if (format) 28 { 29 FILE *file = fopen(TRACE_OUTPUT_FILE, "a"); 30 31 if (file) 32 { 33 va_list vararg; 34 va_start(vararg, format); 35 vfprintf(file, format, vararg); 36 va_end(vararg); 37 38 fclose(file); 39 } 40 } 41 } 42 #endif // !defined(ANGLE_DISABLE_TRACE) 43 } 44 } 45