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 "SkTypes.h"
9 #if defined(SK_BUILD_FOR_ANDROID)
10 
11 #include <stdio.h>
12 
13 #define LOG_TAG "skia"
14 #include <android/log.h>
15 
16 // Print debug output to stdout as well.  This is useful for command line
17 // applications (e.g. skia_launcher). To enable, include android_output as a
18 // gyp dependency.
19 bool gSkDebugToStdOut = false;
20 
SkDebugf(const char format[],...)21 void SkDebugf(const char format[], ...) {
22     va_list args1, args2;
23     va_start(args1, format);
24 
25     if (gSkDebugToStdOut) {
26         va_copy(args2, args1);
27         vprintf(format, args2);
28         va_end(args2);
29     }
30 
31     __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args1);
32 
33     va_end(args1);
34 }
35 
36 #endif//defined(SK_BUILD_FOR_ANDROID)
37