blob: b9b5665a3cde0208e22631224b1bca82941c936c [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
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.com8a1c16f2008-12-17 15:59:43 +00009
10#include "SkTypes.h"
11
12static const size_t kBufferSize = 256;
13
reed@android.com8a1c16f2008-12-17 15:59:43 +000014#define LOG_TAG "skia"
djsollen@google.com318cf922011-11-08 19:03:43 +000015#include <android/log.h>
reed@android.com8a1c16f2008-12-17 15:59:43 +000016
djsollen@google.com64d294d2012-10-23 17:37:30 +000017static bool gSkDebugToStdOut = false;
18
19extern "C" void AndroidSkDebugToStdOut(bool debugToStdOut) {
20 gSkDebugToStdOut = debugToStdOut;
21}
22
djsollen@google.com318cf922011-11-08 19:03:43 +000023void SkDebugf(const char format[], ...) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000024 va_list args;
25 va_start(args, format);
djsollen@google.com318cf922011-11-08 19:03:43 +000026 __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args);
djsollen@google.com64d294d2012-10-23 17:37:30 +000027
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.com8a1c16f2008-12-17 15:59:43 +000034 va_end(args);
35}