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

This commit is contained in:
Juha Heinanen
2020-02-19 23:21:35 +02:00
parent 336bfa1ceb
commit a888c0cac8
3 changed files with 8 additions and 6 deletions

View File

@ -386,7 +386,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
JNIEXPORT void JNICALL
Java_com_tutpro_baresip_BaresipService_baresipStart(JNIEnv *env, jobject instance,
jstring javaPath, jstring javaIpV4Addr, jstring javaIpV6Addr,
jstring javaNetInterface, jint javaNetAf) {
jstring javaNetInterface, jint javaNetAf, jint javaLogLevel) {
LOGD("starting baresip\n");
@ -421,7 +421,7 @@ Java_com_tutpro_baresip_BaresipService_baresipStart(JNIEnv *env, jobject instanc
conf_path_set(path);
log_enable_debug(true);
log_level_set((enum log_level)javaLogLevel);
err = conf_configure();
if (err) {

View File

@ -304,7 +304,7 @@ class BaresipService: Service() {
if ((ipV4Addr == "") && (ipV6Addr == ""))
Log.w(LOG_TAG, "Starting baresip without IP addresses")
Thread(Runnable { baresipStart(filesPath, ipV4Addr, ipV6Addr, "",
Api.AF_UNSPEC)
Api.AF_UNSPEC, logLevel)
}).start()
isServiceRunning = true
@ -1058,7 +1058,7 @@ class BaresipService: Service() {
}
external fun baresipStart(path: String, ipV4Addr: String, ipV6Addr: String, netInterface: String,
netAf: Int)
netAf: Int, logLevel: Int)
external fun baresipStop(force: Boolean)
companion object {
@ -1092,6 +1092,7 @@ class BaresipService: Service() {
var netInterface = ""
var filesPath = ""
var downloadsPath = ""
var logLevel = 2
val uas = ArrayList<UserAgent>()
val status = ArrayList<Int>()

View File

@ -49,12 +49,13 @@ object Config {
if (!config.contains("log_level")) {
config = "${config}log_level 2\n"
Api.log_level_set(2)
Log.logLevel = Log.LogLevel.WARN
BaresipService.logLevel = 2
} else {
val ll = variable("log_level")[0].toInt()
Api.log_level_set(ll)
replaceVariable("log_level", "$ll")
Log.logLevelSet(ll)
BaresipService.logLevel = ll
}
if (config.contains("net_interface")) {