epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 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 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 8 | #include "SkTypes.h" |
bungeman@google.com | 72e8324 | 2013-10-11 19:47:36 +0000 | [diff] [blame] | 9 | #include <stdio.h> |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 10 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 11 | #define LOG_TAG "skia" |
djsollen@google.com | 318cf92 | 2011-11-08 19:03:43 +0000 | [diff] [blame] | 12 | #include <android/log.h> |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 13 | |
scroggo | 6cfce1b | 2014-12-10 10:23:04 -0800 | [diff] [blame^] | 14 | // Print debug output to stdout as well. This is useful for command line |
| 15 | // applications (e.g. skia_launcher). To enable, include android_output as a |
| 16 | // gyp dependency. |
| 17 | bool gSkDebugToStdOut = false; |
djsollen@google.com | 64d294d | 2012-10-23 17:37:30 +0000 | [diff] [blame] | 18 | |
djsollen@google.com | 318cf92 | 2011-11-08 19:03:43 +0000 | [diff] [blame] | 19 | void SkDebugf(const char format[], ...) { |
qiankun.miao | cd27a41 | 2014-07-15 19:51:41 -0700 | [diff] [blame] | 20 | va_list args1, args2; |
| 21 | va_start(args1, format); |
djsollen@google.com | 64d294d | 2012-10-23 17:37:30 +0000 | [diff] [blame] | 22 | |
djsollen@google.com | 64d294d | 2012-10-23 17:37:30 +0000 | [diff] [blame] | 23 | if (gSkDebugToStdOut) { |
scroggo | 6cfce1b | 2014-12-10 10:23:04 -0800 | [diff] [blame^] | 24 | va_copy(args2, args1); |
qiankun.miao | cd27a41 | 2014-07-15 19:51:41 -0700 | [diff] [blame] | 25 | vprintf(format, args2); |
scroggo | 6cfce1b | 2014-12-10 10:23:04 -0800 | [diff] [blame^] | 26 | va_end(args2); |
djsollen@google.com | 64d294d | 2012-10-23 17:37:30 +0000 | [diff] [blame] | 27 | } |
| 28 | |
scroggo | 6cfce1b | 2014-12-10 10:23:04 -0800 | [diff] [blame^] | 29 | __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args1); |
| 30 | |
qiankun.miao | cd27a41 | 2014-07-15 19:51:41 -0700 | [diff] [blame] | 31 | va_end(args1); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 32 | } |