use of com.birbit.android.jobqueue.log.CustomLogger in project android-priority-jobqueue by yigit.
the class TwitterApplication method configureJobManager.
private void configureJobManager() {
Configuration.Builder builder = new Configuration.Builder(this).customLogger(new CustomLogger() {
private static final String TAG = "JOBS";
@Override
public boolean isDebugEnabled() {
return true;
}
@Override
public void d(String text, Object... args) {
Log.d(TAG, String.format(text, args));
}
@Override
public void e(Throwable t, String text, Object... args) {
Log.e(TAG, String.format(text, args), t);
}
@Override
public void e(String text, Object... args) {
Log.e(TAG, String.format(text, args));
}
@Override
public void v(String text, Object... args) {
}
}).minConsumerCount(//always keep at least one consumer alive
1).maxConsumerCount(//up to 3 consumers at a time
3).loadFactor(//3 jobs per consumer
3).consumerKeepAlive(//wait 2 minute
120);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder.scheduler(FrameworkJobSchedulerService.createSchedulerFor(this, MyJobService.class), true);
} else {
int enableGcm = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this);
if (enableGcm == ConnectionResult.SUCCESS) {
builder.scheduler(GcmJobSchedulerService.createSchedulerFor(this, MyGcmJobService.class), true);
}
}
jobManager = new JobManager(builder.build());
}
use of com.birbit.android.jobqueue.log.CustomLogger in project android-priority-jobqueue by yigit.
the class TestBase method enableDebug.
protected void enableDebug() {
ShadowLog.stream = System.out;
JqLog.setCustomLogger(new CustomLogger() {
private String TAG = "test_logger";
@Override
public boolean isDebugEnabled() {
return true;
}
@Override
public void d(String text, Object... args) {
Log.d(TAG, prefix() + String.format(text, args));
}
@Override
public void e(Throwable t, String text, Object... args) {
Log.e(TAG, prefix() + String.format(text, args), t);
}
@Override
public void e(String text, Object... args) {
Log.e(TAG, prefix() + String.format(text, args));
}
@Override
public void v(String text, Object... args) {
Log.v(TAG, prefix() + String.format(text, args));
}
private String prefix() {
return Thread.currentThread().getName() + "[" + System.currentTimeMillis() + "]";
}
});
}
Aggregations