1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_WEBRTC_WEBRTC_LOGGING_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_WEBRTC_WEBRTC_LOGGING_H_
#include <stdarg.h>
#include <string>
#include "base/compiler_specific.h"
#include "third_party/blink/public/platform/web_common.h"
namespace blink {
// This interface is implemented by a handler in the embedder and used for
// initializing the logging and passing log messages to the handler. The
// purpose is to forward mainly libjingle log messages to embedder (besides
// the ordinary logging stream) that will be used for diagnostic purposes.
class BLINK_PLATFORM_EXPORT WebRtcLogMessageDelegate {
public:
// Pass a diagnostic WebRTC log message.
virtual void LogMessage(const std::string& message) = 0;
protected:
virtual ~WebRtcLogMessageDelegate() {}
};
// Must only be called once, and |delegate| must be non-null.
BLINK_PLATFORM_EXPORT void InitWebRtcLoggingDelegate(
WebRtcLogMessageDelegate* delegate);
// Called to start the diagnostic WebRTC log.
BLINK_PLATFORM_EXPORT void InitWebRtcLogging();
// This function will add |message| to the diagnostic WebRTC log, if started.
// Otherwise it will be ignored. Note that this log may be uploaded to a
// server by the embedder - no sensitive information should be logged. May be
// called on any thread.
void BLINK_PLATFORM_EXPORT WebRtcLogMessage(const std::string& message);
// Helper methods which wraps calls to WebRtcLogMessage() using different
// printf-like inputs allowing the user to create log messages with a similar
// syntax as for printf format specifiers. These mathods use different versions
// of base::StringPrintf() internally and can also prepend the logged string
// with a |prefix| string and/or append a formated this pointer in |thiz|.
// Example: WebRtcLog("%s({foo=%d})", "Foo", 10) <=>
// WebRtcLogMessage("Foo({foo=10})")
void BLINK_PLATFORM_EXPORT WebRtcLog(const char* format, ...)
PRINTF_FORMAT(1, 2);
// Example: WebRtcLog(this, "%s({foo=%d})", "Foo", 10) <=>
// WebRtcLogMessage("Foo({foo=10}) [this=0x24514CB47A0]")
void BLINK_PLATFORM_EXPORT WebRtcLog(void* thiz, const char* format, ...)
PRINTF_FORMAT(2, 3);
// Example: WebRtcLog("RTC::", this, "%s({foo=%d})", "Foo", 10) <=>
// WebRtcLogMessage("RTC::Foo({foo=10}) [this=0x24514CB47A0]")
void BLINK_PLATFORM_EXPORT WebRtcLog(const char* prefix,
void* thiz,
const char* format,
...) PRINTF_FORMAT(3, 4);
} // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_WEBRTC_WEBRTC_LOGGING_H_
|