blob: fe28ee27b1ce4bd080a0f7c4de56b784e88ed0c8 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
reed@google.combaf7a072011-05-02 19:11:37 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2010 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
reed@google.combaf7a072011-05-02 19:11:37 +00007 */
8
9
epoger@google.comec3ed6a2011-07-28 14:26:00 +000010
reed@google.combaf7a072011-05-02 19:11:37 +000011#include "SkTypes.h"
12
13static const size_t kBufferSize = 2048;
14
15#include <stdarg.h>
16#include <stdio.h>
bungeman@google.com0d9e3da2013-12-03 15:23:37 +000017#include <windows.h>
reed@google.combaf7a072011-05-02 19:11:37 +000018
19void SkDebugf(const char format[], ...) {
20 char buffer[kBufferSize + 1];
21 va_list args;
bsalomon@google.com8890af32013-03-07 18:44:34 +000022
23 va_start(args, format);
24 vprintf(format, args);
25 va_end(args);
commit-bot@chromium.orgaadb4d92013-10-09 15:09:42 +000026 // When we crash on Windows we often are missing a lot of prints. Since we don't really care
27 // about SkDebugf performance we flush after every print.
28 fflush(stdout);
bsalomon@google.com8890af32013-03-07 18:44:34 +000029
reed@google.combaf7a072011-05-02 19:11:37 +000030 va_start(args, format);
31 vsnprintf(buffer, kBufferSize, format, args);
32 va_end(args);
33
reed@google.com59d2f632011-05-02 19:36:59 +000034 OutputDebugStringA(buffer);
reed@google.combaf7a072011-05-02 19:11:37 +000035}