Use old native logger as default for now
This commit is contained in:
parent
685c959d2c
commit
977ff5e92e
5 changed files with 34 additions and 42 deletions
|
@ -1192,7 +1192,7 @@ public class LinphonePreferences {
|
||||||
// Advanced settings
|
// Advanced settings
|
||||||
public void setDebugEnabled(boolean enabled) {
|
public void setDebugEnabled(boolean enabled) {
|
||||||
getConfig().setBool("app", "debug", enabled);
|
getConfig().setBool("app", "debug", enabled);
|
||||||
LinphoneUtils.initLoggingService(enabled);
|
LinphoneUtils.initLoggingService(enabled, mContext.getString(R.string.app_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDebugEnabled() {
|
public boolean isDebugEnabled() {
|
||||||
|
|
|
@ -301,7 +301,7 @@ public final class LinphoneService extends Service {
|
||||||
LinphonePreferences.instance().setContext(getBaseContext());
|
LinphonePreferences.instance().setContext(getBaseContext());
|
||||||
Factory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath());
|
Factory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath());
|
||||||
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
||||||
LinphoneUtils.initLoggingService(isDebugEnabled);
|
LinphoneUtils.initLoggingService(isDebugEnabled, getString(R.string.app_name));
|
||||||
|
|
||||||
// Dump some debugging information to the logs
|
// Dump some debugging information to the logs
|
||||||
Log.i(START_LINPHONE_LOGS);
|
Log.i(START_LINPHONE_LOGS);
|
||||||
|
|
|
@ -23,11 +23,9 @@ import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.ContentUris;
|
import android.content.ContentUris;
|
||||||
import android.content.ContentValues;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.CursorLoader;
|
import android.content.CursorLoader;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
|
@ -41,28 +39,22 @@ import android.os.Looper;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.provider.DocumentsContract;
|
import android.provider.DocumentsContract;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.provider.MediaStore.Images;
|
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.TypedValue;
|
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.webkit.MimeTypeMap;
|
import android.webkit.MimeTypeMap;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.linphone.compatibility.Compatibility;
|
import org.linphone.compatibility.Compatibility;
|
||||||
import org.linphone.contacts.ContactsManager;
|
import org.linphone.contacts.ContactsManager;
|
||||||
import org.linphone.core.DialPlan;
|
|
||||||
import org.linphone.core.AccountCreator;
|
import org.linphone.core.AccountCreator;
|
||||||
import org.linphone.core.Address;
|
import org.linphone.core.Address;
|
||||||
import org.linphone.core.Call;
|
import org.linphone.core.Call;
|
||||||
import org.linphone.core.Call.State;
|
import org.linphone.core.Call.State;
|
||||||
import org.linphone.core.ChatMessage;
|
|
||||||
import org.linphone.core.Core;
|
import org.linphone.core.Core;
|
||||||
import org.linphone.core.Factory;
|
import org.linphone.core.Factory;
|
||||||
import org.linphone.core.Friend;
|
import org.linphone.core.Friend;
|
||||||
|
@ -75,8 +67,6 @@ import org.linphone.core.ProxyConfig;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
||||||
|
|
||||||
import java.io.BufferedOutputStream;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
@ -85,7 +75,6 @@ import java.io.FileOutputStream;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
@ -98,8 +87,6 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipOutputStream;
|
|
||||||
|
|
||||||
import static android.view.View.GONE;
|
import static android.view.View.GONE;
|
||||||
import static android.view.View.VISIBLE;
|
import static android.view.View.VISIBLE;
|
||||||
|
@ -115,32 +102,37 @@ public final class LinphoneUtils {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initLoggingService(boolean isDebugEnabled) {
|
public static void initLoggingService(boolean isDebugEnabled, String appName) {
|
||||||
Factory.instance().setDebugMode(isDebugEnabled, "");
|
if (true) {
|
||||||
Factory.instance().enableLogCollection(LogCollectionState.EnabledWithoutPreviousLogHandler);
|
Factory.instance().enableLogCollection(LogCollectionState.Enabled);
|
||||||
Factory.instance().getLoggingService().setListener(new LoggingServiceListener() {
|
Factory.instance().setDebugMode(isDebugEnabled, appName);
|
||||||
@Override
|
} else {
|
||||||
public void onLogMessageWritten(LoggingService logService, String domain, LogLevel lev, String message) {
|
Factory.instance().setDebugMode(isDebugEnabled, appName);
|
||||||
switch (lev) {
|
Factory.instance().enableLogCollection(LogCollectionState.EnabledWithoutPreviousLogHandler);
|
||||||
case Debug:
|
Factory.instance().getLoggingService().setListener(new LoggingServiceListener() {
|
||||||
android.util.Log.d(domain, message);
|
@Override
|
||||||
break;
|
public void onLogMessageWritten(LoggingService logService, String domain, LogLevel lev, String message) {
|
||||||
case Message:
|
switch (lev) {
|
||||||
android.util.Log.i(domain, message);
|
case Debug:
|
||||||
break;
|
android.util.Log.d(domain, message);
|
||||||
case Warning:
|
break;
|
||||||
android.util.Log.w(domain, message);
|
case Message:
|
||||||
break;
|
android.util.Log.i(domain, message);
|
||||||
case Error:
|
break;
|
||||||
android.util.Log.e(domain, message);
|
case Warning:
|
||||||
break;
|
android.util.Log.w(domain, message);
|
||||||
case Fatal:
|
break;
|
||||||
default:
|
case Error:
|
||||||
android.util.Log.wtf(domain, message);
|
android.util.Log.e(domain, message);
|
||||||
break;
|
break;
|
||||||
|
case Fatal:
|
||||||
|
default:
|
||||||
|
android.util.Log.wtf(domain, message);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dispatchOnUIThread(Runnable r) {
|
public static void dispatchOnUIThread(Runnable r) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class DozeReceiver extends android.content.BroadcastReceiver {
|
||||||
if (!LinphoneService.isReady()) return;
|
if (!LinphoneService.isReady()) return;
|
||||||
|
|
||||||
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
||||||
LinphoneUtils.initLoggingService(isDebugEnabled);
|
LinphoneUtils.initLoggingService(isDebugEnabled, context.getString(R.string.app_name));
|
||||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
if (lc == null) return;
|
if (lc == null) return;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
|
||||||
LinphoneUtils.initLoggingService(isDebugEnabled);
|
LinphoneUtils.initLoggingService(isDebugEnabled, context.getString(R.string.app_name));
|
||||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
if (lc == null) return;
|
if (lc == null) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue