blob: 5e32174797ca45a4ef9c9a5144510e40e8ec1e6d [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
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "include/core/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
Mike Klein160907f2017-02-06 12:26:51 -050017// applications (e.g. skia_launcher).
scroggo6cfce1b2014-12-10 10:23:04 -080018bool gSkDebugToStdOut = false;
djsollen@google.com64d294d2012-10-23 17:37:30 +000019
djsollen@google.com318cf922011-11-08 19:03:43 +000020void SkDebugf(const char format[], ...) {
qiankun.miaocd27a412014-07-15 19:51:41 -070021 va_list args1, args2;
22 va_start(args1, format);
djsollen@google.com64d294d2012-10-23 17:37:30 +000023
djsollen@google.com64d294d2012-10-23 17:37:30 +000024 if (gSkDebugToStdOut) {
scroggo6cfce1b2014-12-10 10:23:04 -080025 va_copy(args2, args1);
qiankun.miaocd27a412014-07-15 19:51:41 -070026 vprintf(format, args2);
scroggo6cfce1b2014-12-10 10:23:04 -080027 va_end(args2);
djsollen@google.com64d294d2012-10-23 17:37:30 +000028 }
29
scroggo6cfce1b2014-12-10 10:23:04 -080030 __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args1);
31
qiankun.miaocd27a412014-07-15 19:51:41 -070032 va_end(args1);
reed@android.com8a1c16f2008-12-17 15:59:43 +000033}
mtklein1ee76512015-11-02 10:20:27 -080034
35#endif//defined(SK_BUILD_FOR_ANDROID)