blob: 70029fbb6db965169e10a41db994d9175fa72bc4 [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"
bungeman@google.com72e83242013-10-11 19:47:36 +000011#include <stdio.h>
reed@android.com8a1c16f2008-12-17 15:59:43 +000012
13static const size_t kBufferSize = 256;
14
reed@android.com8a1c16f2008-12-17 15:59:43 +000015#define LOG_TAG "skia"
djsollen@google.com318cf922011-11-08 19:03:43 +000016#include <android/log.h>
reed@android.com8a1c16f2008-12-17 15:59:43 +000017
djsollen@google.com64d294d2012-10-23 17:37:30 +000018static bool gSkDebugToStdOut = false;
19
20extern "C" void AndroidSkDebugToStdOut(bool debugToStdOut) {
21 gSkDebugToStdOut = debugToStdOut;
22}
23
djsollen@google.com318cf922011-11-08 19:03:43 +000024void SkDebugf(const char format[], ...) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000025 va_list args;
26 va_start(args, format);
djsollen@google.com318cf922011-11-08 19:03:43 +000027 __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args);
djsollen@google.com64d294d2012-10-23 17:37:30 +000028
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.com8a1c16f2008-12-17 15:59:43 +000035 va_end(args);
36}