1 /* 2 * Copyright 2006 The Android Open Source Project 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "include/private/base/SkDebug.h" 9 #include "include/private/base/SkFeatures.h" 10 11 #if defined(SK_BUILD_FOR_ANDROID) 12 13 #include <stdio.h> 14 15 #ifdef LOG_TAG 16 #undef LOG_TAG 17 #endif 18 #define LOG_TAG "skia" 19 #include <android/log.h> 20 21 // Print debug output to stdout as well. This is useful for command line 22 // applications 23 bool gSkDebugToStdOut = false; 24 SkDebugf(const char format[],...)25void SkDebugf(const char format[], ...) { 26 va_list args1, args2; 27 va_start(args1, format); 28 29 if (gSkDebugToStdOut) { 30 va_copy(args2, args1); 31 vprintf(format, args2); 32 va_end(args2); 33 fflush(stdout); 34 } 35 36 __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args1); 37 38 va_end(args1); 39 } 40 41 #endif // defined(SK_BUILD_FOR_ANDROID) 42