Use new Android logger

This commit is contained in:
Sylvain Berfini 2016-05-11 14:19:18 +02:00
parent 35a233462d
commit 06089a8ed8
6 changed files with 6 additions and 23 deletions

View file

@ -46,9 +46,6 @@ public class LinphoneLauncherActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Used to change for the lifetime of the app the name used to tag the logs
new Log(getResources().getString(R.string.app_name), !getResources().getBoolean(R.bool.disable_every_log));
// Hack to avoid to draw twice LinphoneActivity on tablets
if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

View file

@ -588,9 +588,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
try {
copyAssetsFromPackage();
//traces alway start with traces enable to not missed first initialization
boolean isDebugLogEnabled = !(mR.getBoolean(R.bool.disable_every_log));
LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name));
LinphoneCoreFactory.instance().enableLogCollection(isDebugLogEnabled);
mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, mLinphoneConfigFile, mLinphoneFactoryConfigFile, null, c);
@ -619,9 +616,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
private synchronized void initLiblinphone(LinphoneCore lc) throws LinphoneCoreException {
mLc = lc;
boolean isDebugLogEnabled = !(mR.getBoolean(R.bool.disable_every_log)) && mPrefs.isDebugEnabled();
LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name));
LinphoneCoreFactory.instance().enableLogCollection(isDebugLogEnabled);
PreferencesMigrator prefMigrator = new PreferencesMigrator(mServiceContext);
prefMigrator.migrateRemoteProvisioningUriIfNeeded();

View file

@ -81,7 +81,6 @@ public class LinphonePreferences {
}
if (!LinphoneManager.isInstanciated()) {
Log.w("LinphoneManager not instanciated yet...");
return LinphoneCoreFactory.instance().createLpConfig(mContext.getFilesDir().getAbsolutePath() + "/.linphonerc");
}
@ -1198,14 +1197,6 @@ public class LinphonePreferences {
return getConfig().getString("app", "debug_popup_magic", null);
}
public void enableDebugLogs(Boolean debugMode){
getConfig().setBool("app", "debug_logs_enabled", debugMode);
}
public Boolean isDebugLogsEnabled(){
return getConfig().getBool("app", "debug_logs_enabled", false);
}
public Boolean audioPermAsked(){
return getConfig().getBool("app", "audio_perm", false);
}

View file

@ -135,8 +135,9 @@ public final class LinphoneService extends Service {
mNotificationTitle = getString(R.string.service_name);
// Needed in order for the two next calls to succeed, libraries must have been loaded first
LinphonePreferences.instance().setContext(getApplicationContext());
LinphoneCoreFactory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath());
LinphoneCoreFactory.instance().enableLogCollection(!(getResources().getBoolean(R.bool.disable_every_log)));
LinphoneCoreFactory.instance().enableLogCollection(LinphonePreferences.instance().isDebugEnabled());
// Dump some debugging information to the logs
Log.i(START_LINPHONE_LOGS);

View file

@ -132,11 +132,11 @@ public class Digit extends Button implements AddressAware {
public void displayDebugPopup(){
AlertDialog.Builder alertDialog = new AlertDialog.Builder(getContext());
alertDialog.setTitle(getContext().getString(R.string.debug_popup_title));
if(LinphonePreferences.instance().isDebugLogsEnabled()) {
if(LinphonePreferences.instance().isDebugEnabled()) {
alertDialog.setItems(getContext().getResources().getStringArray(R.array.popup_send_log), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if(which == 0){
LinphonePreferences.instance().enableDebugLogs(false);
LinphonePreferences.instance().setDebugEnabled(false);
LinphoneCoreFactory.instance().enableLogCollection(false);
}
if(which == 1) {
@ -152,7 +152,7 @@ public class Digit extends Button implements AddressAware {
alertDialog.setItems(getContext().getResources().getStringArray(R.array.popup_enable_log), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if(which == 0) {
LinphonePreferences.instance().enableDebugLogs(true);
LinphonePreferences.instance().setDebugEnabled(true);
LinphoneCoreFactory.instance().enableLogCollection(true);
}
}

@ -1 +1 @@
Subproject commit fa00efddbb22cda2dabf6e0629de27ad40bbe45b
Subproject commit 5872dddc3c49838899a1eec80cbb61eaa0fbf299