Java源码示例:com.j256.ormlite.logger.LocalLog
示例1
private void createDB() throws Exception
{
PacketProxyUtility util = PacketProxyUtility.getInstance();
if (! Files.exists(databaseDir)) {
util.packetProxyLog(databaseDir.toAbsolutePath() + " directory is not found...");
util.packetProxyLog("creating the directory...");
Files.createDirectories(databaseDir);
System.out.println("success!");
} else {
if (! Files.isDirectory(databaseDir)) {
util.packetProxyLogErr(databaseDir.toAbsolutePath() + " file is not directory...");
util.packetProxyLogErr("Must be a directory");
System.exit(1);
}
}
System.setProperty(LocalLog.LOCAL_LOG_LEVEL_PROPERTY, "error");
source = new JdbcConnectionSource(getDatabaseURL());
DatabaseConnection conn = source.getReadWriteConnection();
conn.executeStatement("pragma auto_vacuum = full", DatabaseConnection.DEFAULT_RESULT_FLAGS);
}
示例2
@Override
public void onCreate() {
super.onCreate();
app = this;
// init toast utils
ToastUtils.init(getApplicationContext());
initVariable();
if (!BuildConfig.DEBUG) {
java.lang.System.setProperty(LocalLog.LOCAL_LOG_LEVEL_PROPERTY, "ERROR");
}
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
checkChineseLocale(getResources().getConfiguration());
TagManager tm = TagManager.getInstance(this);
PendingResult<ContainerHolder> pending = tm.loadContainerPreferNonDefault("GTM-NT8WS8", R.raw.gtm_default_container);
ResultCallback<ContainerHolder> callback = new ResultCallback<ContainerHolder>() {
@Override
public void onResult(@NonNull ContainerHolder holder) {
if (!holder.getStatus().isSuccess()) {
return;
}
containerHolder = holder;
Container container = holder.getContainer();
container.registerFunctionCallMacroCallback(SIG_FUNC, new Container.FunctionCallMacroCallback() {
@Override
public Object getValue(String functionName, Map<String, Object> parameters) {
if (SIG_FUNC.equals(functionName)) {
return Utils.getSignature(getApplicationContext());
} else {
return null;
}
}
});
}
};
pending.setResultCallback(callback, 2, TimeUnit.SECONDS);
JobManager.create(this).addJobCreator(new DonaldTrump());
if (settings.getBoolean(Constants.Key.tfo, false) && TcpFastOpen.supported()) {
mThreadPool.execute(new Runnable() {
@Override
public void run() {
TcpFastOpen.enabled(settings.getBoolean(Constants.Key.tfo, false));
}
});
}
}
示例3
@Override
public void onCreate() {
super.onCreate();
app = this;
// init toast utils
ToastUtils.init(getApplicationContext());
initVariable();
if (!BuildConfig.DEBUG) {
java.lang.System.setProperty(LocalLog.LOCAL_LOG_LEVEL_PROPERTY, "ERROR");
}
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
checkChineseLocale(getResources().getConfiguration());
TagManager tm = TagManager.getInstance(this);
PendingResult<ContainerHolder> pending = tm.loadContainerPreferNonDefault("GTM-NT8WS8", R.raw.gtm_default_container);
ResultCallback<ContainerHolder> callback = new ResultCallback<ContainerHolder>() {
@Override
public void onResult(@NonNull ContainerHolder holder) {
if (!holder.getStatus().isSuccess()) {
return;
}
containerHolder = holder;
Container container = holder.getContainer();
container.registerFunctionCallMacroCallback(SIG_FUNC, new Container.FunctionCallMacroCallback() {
@Override
public Object getValue(String functionName, Map<String, Object> parameters) {
if (SIG_FUNC.equals(functionName)) {
return Utils.getSignature(getApplicationContext());
} else {
return null;
}
}
});
}
};
pending.setResultCallback(callback, 2, TimeUnit.SECONDS);
JobManager.create(this).addJobCreator(new DonaldTrump());
if (settings.getBoolean(Constants.Key.tfo, false) && TcpFastOpen.supported()) {
mThreadPool.execute(new Runnable() {
@Override
public void run() {
TcpFastOpen.enabled(settings.getBoolean(Constants.Key.tfo, false));
}
});
}
}
示例4
private DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
System.setProperty(LocalLog.LOCAL_LOG_LEVEL_PROPERTY, "FATAL");
}