blob: e507ff6bd67ffb02f59545985d870a05a7bc65cd [file] [log] [blame]
John Bauman66b8ab22014-05-06 15:57:45 -04001//
2// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// debug.cpp: Debugging utilities.
8
Nicolas Capenscc863da2015-01-21 15:50:55 -05009#include "debug.h"
John Bauman66b8ab22014-05-06 15:57:45 -040010
11#include <stdarg.h>
12#include <stdio.h>
13
Nicolas Capenscc863da2015-01-21 15:50:55 -050014#include "InitializeParseContext.h"
15#include "ParseHelper.h"
John Bauman66b8ab22014-05-06 15:57:45 -040016
17static const int kTraceBufferLen = 1024;
18
19#ifdef TRACE_ENABLED
20extern "C" {
21void Trace(const char *format, ...) {
22 if (!format) return;
23
24 TParseContext* parseContext = GetGlobalParseContext();
25 if (parseContext) {
26 char buf[kTraceBufferLen];
27 va_list args;
28 va_start(args, format);
29 vsnprintf(buf, kTraceBufferLen, format, args);
30 va_end(args);
31
32 parseContext->trace(buf);
33 }
34}
35} // extern "C"
36#endif // TRACE_ENABLED
37