blob: 0a1b59a2cd0a2cba4f27b6607d4712925a0a3345 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001/*
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.com8a1c16f2008-12-17 15:59:43 +00008#include "SkTypes.h"
mtklein1ee76512015-11-02 10:20:27 -08009#if defined(SK_BUILD_FOR_ANDROID)
10
bungeman@google.com72e83242013-10-11 19:47:36 +000011#include <stdio.h>
reed@android.com8a1c16f2008-12-17 15:59:43 +000012
reed@android.com8a1c16f2008-12-17 15:59:43 +000013#define LOG_TAG "skia"
djsollen@google.com318cf922011-11-08 19:03:43 +000014#include <android/log.h>
reed@android.com8a1c16f2008-12-17 15:59:43 +000015
scroggo6cfce1b2014-12-10 10:23:04 -080016// Print debug output to stdout as well. This is useful for command line
17// applications (e.g. skia_launcher). To enable, include android_output as a
18// gyp dependency.
19bool gSkDebugToStdOut = false;
djsollen@google.com64d294d2012-10-23 17:37:30 +000020
djsollen@google.com318cf922011-11-08 19:03:43 +000021void SkDebugf(const char format[], ...) {
qiankun.miaocd27a412014-07-15 19:51:41 -070022 va_list args1, args2;
23 va_start(args1, format);
djsollen@google.com64d294d2012-10-23 17:37:30 +000024
djsollen@google.com64d294d2012-10-23 17:37:30 +000025 if (gSkDebugToStdOut) {
scroggo6cfce1b2014-12-10 10:23:04 -080026 va_copy(args2, args1);
qiankun.miaocd27a412014-07-15 19:51:41 -070027 vprintf(format, args2);
scroggo6cfce1b2014-12-10 10:23:04 -080028 va_end(args2);
djsollen@google.com64d294d2012-10-23 17:37:30 +000029 }
30
scroggo6cfce1b2014-12-10 10:23:04 -080031 __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args1);
32
qiankun.miaocd27a412014-07-15 19:51:41 -070033 va_end(args1);
reed@android.com8a1c16f2008-12-17 15:59:43 +000034}
mtklein1ee76512015-11-02 10:20:27 -080035
36#endif//defined(SK_BUILD_FOR_ANDROID)