blob: 4ab9ad24d3f1f1edc06fbc7c5699394286bed991 [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"
bungeman@google.com72e83242013-10-11 19:47:36 +00009#include <stdio.h>
reed@android.com8a1c16f2008-12-17 15:59:43 +000010
reed@android.com8a1c16f2008-12-17 15:59:43 +000011#define LOG_TAG "skia"
djsollen@google.com318cf922011-11-08 19:03:43 +000012#include <android/log.h>
reed@android.com8a1c16f2008-12-17 15:59:43 +000013
scroggo6cfce1b2014-12-10 10:23:04 -080014// Print debug output to stdout as well. This is useful for command line
15// applications (e.g. skia_launcher). To enable, include android_output as a
16// gyp dependency.
17bool gSkDebugToStdOut = false;
djsollen@google.com64d294d2012-10-23 17:37:30 +000018
djsollen@google.com318cf922011-11-08 19:03:43 +000019void SkDebugf(const char format[], ...) {
qiankun.miaocd27a412014-07-15 19:51:41 -070020 va_list args1, args2;
21 va_start(args1, format);
djsollen@google.com64d294d2012-10-23 17:37:30 +000022
djsollen@google.com64d294d2012-10-23 17:37:30 +000023 if (gSkDebugToStdOut) {
scroggo6cfce1b2014-12-10 10:23:04 -080024 va_copy(args2, args1);
qiankun.miaocd27a412014-07-15 19:51:41 -070025 vprintf(format, args2);
scroggo6cfce1b2014-12-10 10:23:04 -080026 va_end(args2);
djsollen@google.com64d294d2012-10-23 17:37:30 +000027 }
28
scroggo6cfce1b2014-12-10 10:23:04 -080029 __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args1);
30
qiankun.miaocd27a412014-07-15 19:51:41 -070031 va_end(args1);
reed@android.com8a1c16f2008-12-17 15:59:43 +000032}