Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Godot primitives for logging, change default log level #141

Merged
merged 1 commit into from
Apr 12, 2024
Merged
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
22 changes: 21 additions & 1 deletion src/WebRTCLibPeerConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,31 @@ using namespace godot_webrtc;
#define FAILED Error::FAILED
#define ERR_UNCONFIGURED Error::ERR_UNCONFIGURED
#define ERR_INVALID_PARAMETER Error::ERR_INVALID_PARAMETER
#define VERBOSE_PRINT(str) Godot::print(str)
#else
#include <godot_cpp/variant/utility_functions.hpp>
#define VERBOSE_PRINT(str) UtilityFunctions::print_verbose(str)
#endif
void LogCallback(rtc::LogLevel level, std::string message) {
switch (level) {
case rtc::LogLevel::Fatal:
case rtc::LogLevel::Error:
ERR_PRINT(message.c_str());
return;
case rtc::LogLevel::Warning:
WARN_PRINT(message.c_str());
return;
default:
VERBOSE_PRINT(message.c_str());
Faless marked this conversation as resolved.
Show resolved Hide resolved
return;
}
}

void WebRTCLibPeerConnection::initialize_signaling() {
#ifdef DEBUG_ENABLED
rtc::InitLogger(rtc::LogLevel::Debug);
rtc::InitLogger(rtc::LogLevel::Debug, LogCallback);
#else
rtc::InitLogger(rtc::LogLevel::Warning, LogCallback);
#endif
}

Expand Down