Toggle logcat on/off
This commit is contained in:
@ -314,15 +314,18 @@ public class Miscellaneous extends Service
|
||||
header = "Automation";
|
||||
}
|
||||
|
||||
if(type.equals("e"))
|
||||
Log.e(header, description);
|
||||
if(Settings.logToConsole)
|
||||
{
|
||||
if (type.equals("e"))
|
||||
Log.e(header, description);
|
||||
|
||||
if (type.equals("w"))
|
||||
Log.w(header, description);
|
||||
|
||||
if (type.equals("i"))
|
||||
Log.i(header, description);
|
||||
}
|
||||
|
||||
if(type.equals("w"))
|
||||
Log.w(header, description);
|
||||
|
||||
if(type.equals("i"))
|
||||
Log.i(header, description);
|
||||
|
||||
if(Settings.writeLogFile && Settings.logLevel >= logLevel)
|
||||
{
|
||||
writeToLogFile(type, header, description);
|
||||
|
@ -30,6 +30,7 @@ public class Settings implements SharedPreferences
|
||||
public static int gpsTimeout;
|
||||
public static long minimumTimeBetweenUpdate;
|
||||
public static boolean startServiceAtSystemBoot;
|
||||
public static boolean logToConsole;
|
||||
public static boolean writeLogFile;
|
||||
public static long logLevel;
|
||||
public static int logFileMaxSize;
|
||||
@ -98,6 +99,7 @@ public class Settings implements SharedPreferences
|
||||
public static final int default_gpsTimeout = 300; // seconds
|
||||
public static final long default_minimumTimeBetweenUpdate = 30000; // in Milliseconds
|
||||
public static final boolean default_startServiceAtSystemBoot = false;
|
||||
public static final boolean default_logToConsole = false;
|
||||
public static final boolean default_writeLogFile = false;
|
||||
public static final long default_logLevel = 2;
|
||||
public static final int default_logFileMaxSize = 10;
|
||||
@ -199,6 +201,7 @@ public class Settings implements SharedPreferences
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
startServiceAtSystemBoot = prefs.getBoolean("startServiceAtSystemBoot", default_startServiceAtSystemBoot);
|
||||
logToConsole = prefs.getBoolean("logToConsole", default_logToConsole);
|
||||
writeLogFile = prefs.getBoolean("writeLogFile", default_writeLogFile);
|
||||
|
||||
boolean useTextToSpeech = false;
|
||||
@ -339,6 +342,9 @@ public class Settings implements SharedPreferences
|
||||
|
||||
if(!prefs.contains("startServiceAtSystemBoot") || force)
|
||||
editor.putBoolean("startServiceAtSystemBoot", default_startServiceAtSystemBoot);
|
||||
|
||||
if(!prefs.contains("logToConsole") || force)
|
||||
editor.putBoolean("logToConsole", default_logToConsole);
|
||||
|
||||
if(!prefs.contains("writeLogFile") || force)
|
||||
editor.putBoolean("writeLogFile", default_writeLogFile);
|
||||
@ -515,6 +521,7 @@ public class Settings implements SharedPreferences
|
||||
Editor editor = prefs.edit();
|
||||
|
||||
editor.putBoolean("startServiceAtSystemBoot", startServiceAtSystemBoot);
|
||||
editor.putBoolean("logToConsole", logToConsole);
|
||||
editor.putBoolean("writeLogFile", writeLogFile);
|
||||
// editor.putBoolean("useTextToSpeech", useTextToSpeech);
|
||||
editor.putBoolean("useTextToSpeechOnNormal", useTextToSpeechOnNormal);
|
||||
|
@ -28,6 +28,11 @@
|
||||
android:summary="@string/showIconWhenServiceIsRunning"
|
||||
android:title="@string/showIcon" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="logToConsole"
|
||||
android:summary="@string/onOff"
|
||||
android:title="@string/logToConsole" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="writeLogFile"
|
||||
android:summary="@string/onOff"
|
||||
|
@ -951,4 +951,5 @@
|
||||
<string name="importChooseFolderNotice">In the following dialog do not try to select specific files, but choose the folder in which the Automation backup files reside. If the choose button is disabled, you have found an Android limitation. In that case try moving the files to a subdirectory first.</string>
|
||||
<string name="matches">matches</string>
|
||||
<string name="doesNotMatch">does not match</string>
|
||||
<string name="logToConsole">Log to console (logcat)</string>
|
||||
</resources>
|
Reference in New Issue
Block a user