1cb93a386Sopenharmony_ci/*
2cb93a386Sopenharmony_ci * Copyright 2006 The Android Open Source Project
3cb93a386Sopenharmony_ci *
4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be
5cb93a386Sopenharmony_ci * found in the LICENSE file.
6cb93a386Sopenharmony_ci */
7cb93a386Sopenharmony_ci
8cb93a386Sopenharmony_ci#include "include/core/SkTypes.h"
9cb93a386Sopenharmony_ci#if defined(SK_BUILD_FOR_ANDROID)
10cb93a386Sopenharmony_ci
11cb93a386Sopenharmony_ci#include <stdio.h>
12cb93a386Sopenharmony_ci
13cb93a386Sopenharmony_ci#define LOG_TAG "skia"
14cb93a386Sopenharmony_ci#include <android/log.h>
15cb93a386Sopenharmony_ci
16cb93a386Sopenharmony_ci// Print debug output to stdout as well.  This is useful for command line
17cb93a386Sopenharmony_ci// applications (e.g. skia_launcher).
18cb93a386Sopenharmony_cibool gSkDebugToStdOut = false;
19cb93a386Sopenharmony_ci
20cb93a386Sopenharmony_civoid SkDebugf(const char format[], ...) {
21cb93a386Sopenharmony_ci    va_list args1, args2;
22cb93a386Sopenharmony_ci    va_start(args1, format);
23cb93a386Sopenharmony_ci
24cb93a386Sopenharmony_ci    if (gSkDebugToStdOut) {
25cb93a386Sopenharmony_ci        va_copy(args2, args1);
26cb93a386Sopenharmony_ci        vprintf(format, args2);
27cb93a386Sopenharmony_ci        va_end(args2);
28cb93a386Sopenharmony_ci    }
29cb93a386Sopenharmony_ci
30cb93a386Sopenharmony_ci    __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args1);
31cb93a386Sopenharmony_ci
32cb93a386Sopenharmony_ci    va_end(args1);
33cb93a386Sopenharmony_ci}
34cb93a386Sopenharmony_ci
35cb93a386Sopenharmony_ci#endif//defined(SK_BUILD_FOR_ANDROID)
36