- Only show baresip lib debug messages when Debug has been enabled.

This commit is contained in:
Juha Heinanen
2020-02-21 02:58:49 +02:00
parent 336bfa1ceb
commit a888c0cac8
3 changed files with 8 additions and 6 deletions
+2 -2
View File
@@ -386,7 +386,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_com_tutpro_baresip_BaresipService_baresipStart(JNIEnv *env, jobject instance, Java_com_tutpro_baresip_BaresipService_baresipStart(JNIEnv *env, jobject instance,
jstring javaPath, jstring javaIpV4Addr, jstring javaIpV6Addr, jstring javaPath, jstring javaIpV4Addr, jstring javaIpV6Addr,
jstring javaNetInterface, jint javaNetAf) { jstring javaNetInterface, jint javaNetAf, jint javaLogLevel) {
LOGD("starting baresip\n"); LOGD("starting baresip\n");
@@ -421,7 +421,7 @@ Java_com_tutpro_baresip_BaresipService_baresipStart(JNIEnv *env, jobject instanc
conf_path_set(path); conf_path_set(path);
log_enable_debug(true); log_level_set((enum log_level)javaLogLevel);
err = conf_configure(); err = conf_configure();
if (err) { if (err) {
@@ -304,7 +304,7 @@ class BaresipService: Service() {
if ((ipV4Addr == "") && (ipV6Addr == "")) if ((ipV4Addr == "") && (ipV6Addr == ""))
Log.w(LOG_TAG, "Starting baresip without IP addresses") Log.w(LOG_TAG, "Starting baresip without IP addresses")
Thread(Runnable { baresipStart(filesPath, ipV4Addr, ipV6Addr, "", Thread(Runnable { baresipStart(filesPath, ipV4Addr, ipV6Addr, "",
Api.AF_UNSPEC) Api.AF_UNSPEC, logLevel)
}).start() }).start()
isServiceRunning = true isServiceRunning = true
@@ -1058,7 +1058,7 @@ class BaresipService: Service() {
} }
external fun baresipStart(path: String, ipV4Addr: String, ipV6Addr: String, netInterface: String, external fun baresipStart(path: String, ipV4Addr: String, ipV6Addr: String, netInterface: String,
netAf: Int) netAf: Int, logLevel: Int)
external fun baresipStop(force: Boolean) external fun baresipStop(force: Boolean)
companion object { companion object {
@@ -1092,6 +1092,7 @@ class BaresipService: Service() {
var netInterface = "" var netInterface = ""
var filesPath = "" var filesPath = ""
var downloadsPath = "" var downloadsPath = ""
var logLevel = 2
val uas = ArrayList<UserAgent>() val uas = ArrayList<UserAgent>()
val status = ArrayList<Int>() val status = ArrayList<Int>()
@@ -49,12 +49,13 @@ object Config {
if (!config.contains("log_level")) { if (!config.contains("log_level")) {
config = "${config}log_level 2\n" config = "${config}log_level 2\n"
Api.log_level_set(2)
Log.logLevel = Log.LogLevel.WARN Log.logLevel = Log.LogLevel.WARN
BaresipService.logLevel = 2
} else { } else {
val ll = variable("log_level")[0].toInt() val ll = variable("log_level")[0].toInt()
Api.log_level_set(ll) replaceVariable("log_level", "$ll")
Log.logLevelSet(ll) Log.logLevelSet(ll)
BaresipService.logLevel = ll
} }
if (config.contains("net_interface")) { if (config.contains("net_interface")) {