Browse Source

Merge pull request #179 from paullouisageneau/enhance-juice-log

Enhance libjuice logging
Paul-Louis Ageneau 4 years ago
parent
commit
98048a178e
2 changed files with 25 additions and 2 deletions
  1. 1 1
      deps/libjuice
  2. 24 1
      src/icetransport.cpp

+ 1 - 1
deps/libjuice

@@ -1 +1 @@
-Subproject commit ddc30648908181f6e6222a2fd648d35c2c28b724
+Subproject commit b20db5daf5728bd3a27f8a1d8841602777578027

+ 24 - 1
src/icetransport.cpp

@@ -58,8 +58,31 @@ IceTransport::IceTransport(const Configuration &config, Description::Role role,
 	if (config.enableIceTcp) {
 	if (config.enableIceTcp) {
 		PLOG_WARNING << "ICE-TCP is not supported with libjuice";
 		PLOG_WARNING << "ICE-TCP is not supported with libjuice";
 	}
 	}
+
+	juice_log_level_t level;
+	switch (plog::get()->getMaxSeverity()) {
+	case plog::none:
+		level = JUICE_LOG_LEVEL_NONE;
+		break;
+	case plog::fatal:
+		level = JUICE_LOG_LEVEL_VERBOSE;
+		break;
+	case plog::error:
+		level = JUICE_LOG_LEVEL_ERROR;
+		break;
+	case plog::warning:
+		level = JUICE_LOG_LEVEL_WARN;
+		break;
+	case plog::info:
+	case plog::debug: // juice debug is output as verbose
+		level = JUICE_LOG_LEVEL_INFO;
+		break;
+	default:
+		level = JUICE_LOG_LEVEL_VERBOSE;
+		break;
+	}
 	juice_set_log_handler(IceTransport::LogCallback);
 	juice_set_log_handler(IceTransport::LogCallback);
-	juice_set_log_level(JUICE_LOG_LEVEL_VERBOSE);
+	juice_set_log_level(level);
 
 
 	juice_config_t jconfig = {};
 	juice_config_t jconfig = {};
 	jconfig.cb_state_changed = IceTransport::StateChangeCallback;
 	jconfig.cb_state_changed = IceTransport::StateChangeCallback;