这是indexloc提供的服务,不要输入任何密码
Skip to content

Commit 599aace

Browse files
Changed: Set DEFAULT_LOG_TAG at application startup as per termux/termux-app@1b794b35 and termux/termux-app@6ff55729
1 parent f701f3c commit 599aace

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

app/src/main/java/com/termux/window/TermuxFloatActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ public class TermuxFloatActivity extends Activity {
1111
@Override
1212
protected void onResume() {
1313
super.onResume();
14+
15+
// Set log level for the app
16+
TermuxFloatApplication.setLogConfig(this, false);
17+
1418
startService(new Intent(this, TermuxFloatService.class));
1519
finish();
1620
}

app/src/main/java/com/termux/window/TermuxFloatApplication.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.app.Application;
44
import android.content.Context;
5+
import android.util.Log;
56

67
import com.termux.shared.logger.Logger;
78
import com.termux.shared.termux.TermuxConstants;
@@ -10,20 +11,24 @@
1011

1112
public class TermuxFloatApplication extends Application {
1213

14+
public static final String LOG_TAG = "TermuxFloatApplication";
15+
1316
public void onCreate() {
1417
super.onCreate();
1518

19+
Log.i(LOG_TAG, "AppInit");
20+
21+
Context context = getApplicationContext();
22+
1623
// Set crash handler for the app
17-
TermuxCrashUtils.setCrashHandler(this);
24+
TermuxCrashUtils.setCrashHandler(context);
1825

1926
// Set log config for the app
20-
setLogConfig(getApplicationContext(), true);
21-
22-
Logger.logDebug("Starting Application");
27+
setLogConfig(context, true);
2328
}
2429

2530
public static void setLogConfig(Context context, boolean commitToFile) {
26-
//Logger.setDefaultLogTag(TermuxConstants.TERMUX_FLOAT_APP_NAME);
31+
Logger.setDefaultLogTag(TermuxConstants.TERMUX_FLOAT_APP_NAME.replaceAll("[: ]", ""));
2732

2833
// Load the log level from shared preferences and set it to the {@link Logger.CURRENT_LOG_LEVEL}
2934
TermuxFloatAppSharedPreferences preferences = TermuxFloatAppSharedPreferences.build(context);

0 commit comments

Comments
 (0)