1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-05 01:37:03 +01:00
Gadgetbridge/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java

42 lines
1.2 KiB
Java
Raw Normal View History

2015-05-01 09:36:10 +02:00
package nodomain.freeyourgadget.gadgetbridge;
import android.app.Application;
import android.content.Context;
import java.io.File;
2015-05-01 09:36:10 +02:00
public class GBApplication extends Application {
private static GBApplication context;
public GBApplication() {
context = this;
}
@Override
public void onCreate() {
super.onCreate();
setupLogFileDir();
// For debugging problems with the logback configuration
// LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
// print logback's internal status
// StatusPrinter.print(lc);
// String dataDir = lc.getProperty(CoreConstants.DATA_DIR_KEY);
// String filename = FileUtil.prefixRelativePath(dataDir, "gadgetbridge.log");
// Logger logger = LoggerFactory.getLogger(GBApplication.class);
}
private void setupLogFileDir() {
File dir = getExternalFilesDir(null);
if (dir != null && !dir.exists()) {
dir.mkdirs();
}
// used by assets/logback.xml since the location cannot be statically determined
System.setProperty("GB_LOGFILES_DIR", dir.getAbsolutePath());
}
2015-05-01 09:36:10 +02:00
public static Context getContext() {
return context;
}
}