Update code documentation for enum in EWK headers
[platform/framework/web/chromium-efl.git] / chrome / notification_helper / trace_util.cc
1 // Copyright 2018 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <windows.h>
6
7 #include <stdarg.h>
8 #include <stdio.h>
9
10 #include <string>
11
12 #if !defined(NDEBUG)
13 // Sends string |format| to the debugger for display.
14 //
15 // This is for developers only; we don't use this in circumstances
16 // (like release builds) where users could see it.
17 void TraceImpl(const wchar_t* format, ...) {
18   constexpr int kMaxLogBufferSize = 1024;
19   wchar_t buffer[kMaxLogBufferSize] = {};
20
21   va_list args = {};
22
23   va_start(args, format);
24   if (vswprintf(buffer, std::size(buffer), format, args) > 0) {
25     OutputDebugString(buffer);
26   } else {
27     std::wstring error_string(L"Format error for string: ");
28     OutputDebugString(error_string.append(format).c_str());
29   }
30   va_end(args);
31 }
32 #endif  // !defined(NDEBUG)