epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2006 The Android Open Source Project |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 9 | |
| 10 | #include "SkTypes.h" |
| 11 | |
| 12 | static const size_t kBufferSize = 256; |
| 13 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 14 | #define LOG_TAG "skia" |
djsollen@google.com | 318cf92 | 2011-11-08 19:03:43 +0000 | [diff] [blame] | 15 | #include <android/log.h> |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 16 | |
djsollen@google.com | 64d294d | 2012-10-23 17:37:30 +0000 | [diff] [blame] | 17 | static bool gSkDebugToStdOut = false; |
| 18 | |
| 19 | extern "C" void AndroidSkDebugToStdOut(bool debugToStdOut) { |
| 20 | gSkDebugToStdOut = debugToStdOut; |
| 21 | } |
| 22 | |
djsollen@google.com | 318cf92 | 2011-11-08 19:03:43 +0000 | [diff] [blame] | 23 | void SkDebugf(const char format[], ...) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 24 | va_list args; |
| 25 | va_start(args, format); |
djsollen@google.com | 318cf92 | 2011-11-08 19:03:43 +0000 | [diff] [blame] | 26 | __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args); |
djsollen@google.com | 64d294d | 2012-10-23 17:37:30 +0000 | [diff] [blame] | 27 | |
| 28 | // Print debug output to stdout as well. This is useful for command |
| 29 | // line applications (e.g. skia_launcher) |
| 30 | if (gSkDebugToStdOut) { |
| 31 | vprintf(format, args); |
| 32 | } |
| 33 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 34 | va_end(args); |
| 35 | } |