Skip to content

Commit 237eb3f

Browse files
Slash333Igor Ponomarenko
andauthored
add removeLogSink func to LibWebRTCLogging (#118)
Co-authored-by: Igor Ponomarenko <[email protected]>
1 parent 041996d commit 237eb3f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

include/rtc_logging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ namespace libwebrtc {
1919
public:
2020
LIB_WEBRTC_API static void setMinDebugLogLevel(RTCLoggingSeverity severity);
2121
LIB_WEBRTC_API static void setLogSink(RTCLoggingSeverity severity, RTCCallbackLoggerMessageHandler callbackHandler);
22+
LIB_WEBRTC_API static void removeLogSink();
2223
};
2324
} // namespace libwebrtc
2425

src/rtc_logging.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ namespace libwebrtc {
4242
}
4343

4444
void LibWebRTCLogging::setLogSink(RTCLoggingSeverity severity, RTCCallbackLoggerMessageHandler callbackHandler) {
45+
removeLogSink();
4546
log_sink.reset(new CallbackLogSink(callbackHandler));
4647
rtc::LogMessage::AddLogToStream(log_sink.get(), getNativeLoggingSeverity(severity));
4748
}
49+
50+
void LibWebRTCLogging::removeLogSink() {
51+
if(log_sink)
52+
rtc::LogMessage::RemoveLogToStream(log_sink.get());
53+
}
4854
} // namespace libwebrtc

0 commit comments

Comments
 (0)