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" |
bungeman@google.com | 72e8324 | 2013-10-11 19:47:36 +0000 | [diff] [blame^] | 11 | #include <stdio.h> |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 12 | |
| 13 | static const size_t kBufferSize = 256; |
| 14 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 15 | #define LOG_TAG "skia" |
djsollen@google.com | 318cf92 | 2011-11-08 19:03:43 +0000 | [diff] [blame] | 16 | #include <android/log.h> |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 17 | |
djsollen@google.com | 64d294d | 2012-10-23 17:37:30 +0000 | [diff] [blame] | 18 | static bool gSkDebugToStdOut = false; |
| 19 | |
| 20 | extern "C" void AndroidSkDebugToStdOut(bool debugToStdOut) { |
| 21 | gSkDebugToStdOut = debugToStdOut; |
| 22 | } |
| 23 | |
djsollen@google.com | 318cf92 | 2011-11-08 19:03:43 +0000 | [diff] [blame] | 24 | void SkDebugf(const char format[], ...) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 25 | va_list args; |
| 26 | va_start(args, format); |
djsollen@google.com | 318cf92 | 2011-11-08 19:03:43 +0000 | [diff] [blame] | 27 | __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args); |
djsollen@google.com | 64d294d | 2012-10-23 17:37:30 +0000 | [diff] [blame] | 28 | |
| 29 | // Print debug output to stdout as well. This is useful for command |
| 30 | // line applications (e.g. skia_launcher) |
| 31 | if (gSkDebugToStdOut) { |
| 32 | vprintf(format, args); |
| 33 | } |
| 34 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 35 | va_end(args); |
| 36 | } |