Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions docs/guide/monitoring/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,13 @@ try {

### Configuring Logging Behavior

You can configure various aspects of the logging system:
Thread IDs are included in log messages by default. You can configure the output
severity and enable timestamps:

```java
// Configure logging to debug output with minimum severity level
Logging.logToDebug(Logging.Severity.INFO);

// Enable/disable thread ID in log messages
Logging.logThreads(true);

// Enable/disable timestamps in log messages
Logging.logTimestamps(true);
```
Expand Down Expand Up @@ -132,4 +130,4 @@ Logging.addLogSink(Logging.Severity.VERBOSE, new Slf4jLogSink());
This approach allows you to integrate WebRTC's native logging with your application's existing logging infrastructure.

## Conclusion
By using the provided methods and custom log sinks, you can effectively capture, process, and manage log messages to aid in debugging and monitoring your application. Whether you choose to use the native logging capabilities or integrate with existing logging frameworks, the WebRTC logging system is designed to be adaptable to your needs.
By using the provided methods and custom log sinks, you can effectively capture, process, and manage log messages to aid in debugging and monitoring your application. Whether you choose to use the native logging capabilities or integrate with existing logging frameworks, the WebRTC logging system is designed to be adaptable to your needs.
8 changes: 0 additions & 8 deletions webrtc-jni/src/main/cpp/include/JNI_Logging.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions webrtc-jni/src/main/cpp/src/JNI_Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,8 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_logging_Logging_logToDebug
}
}

JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_logging_Logging_logThreads
(JNIEnv * env, jclass caller, jboolean enable)
{
webrtc::LogMessage::LogThreads(static_cast<bool>(enable));
}

JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_logging_Logging_logTimestamps
(JNIEnv * env, jclass caller, jboolean enable)
{
webrtc::LogMessage::LogTimestamps(static_cast<bool>(enable));
}
}
1 change: 1 addition & 0 deletions webrtc-jni/src/main/cpp/src/JNI_WebRTC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM * vm, void * reserved)
// can log, so nothing is written unless the application asks for it through
// Logging.logToDebug or a log sink.
webrtc::LoggingConfig loggingConfig;
loggingConfig.set_log_thread(true);
loggingConfig.set_min_severity(webrtc::LS_NONE);
loggingConfig.set_debug_severity(webrtc::LS_NONE);
webrtc::InitializeLogging(std::move(loggingConfig));
Expand Down
2 changes: 0 additions & 2 deletions webrtc/src/main/java/dev/onvoid/webrtc/logging/Logging.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ public enum Severity {

public static native void logToDebug(Severity severity);

public static native void logThreads(boolean enable);

public static native void logTimestamps(boolean enable);

public static void verbose(String message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ class LoggingTests {

@Test
void logToDebug() {
Logging.logToDebug(Severity.ERROR);
Logging.error("logToDebug at ERROR");
Logging.logToDebug(Severity.INFO);
Logging.info("logToDebug at INFO");
Logging.logToDebug(Severity.NONE);
Logging.info("logToDebug at NONE must not print this");
}
Expand Down
Loading