本文整理匯總了Java中timber.log.Timber類的典型用法代碼示例。如果您正苦於以下問題:Java Timber類的具體用法?Java Timber怎麽用?Java Timber使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Timber類屬於timber.log包,在下文中一共展示了Timber類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onThreadDetailsChanged
import timber.log.Timber; //導入依賴的package包/類
@Override
public boolean onThreadDetailsChanged(final String threadId) {
if (DEBUG) Timber.i("onThreadDetailsChanged");
for (Event e : events.values())
{
if (e == null)
continue;
if (StringUtils.isNotEmpty(e.getEntityId()) && !threadId.equals(e.getEntityId()))
continue;
if(e instanceof BatchedEvent)
((BatchedEvent) e).add(Event.Type.ThreadEvent, threadId);
e.onThreadDetailsChanged(threadId);
}
return false;
}
示例2: removeEventByTag
import timber.log.Timber; //導入依賴的package包/類
/** Removes an app event by tag.*/
@Override
public boolean removeEventByTag(String tag){
if (DEBUG) Timber.v("removeEventByTag, Tag: %s", tag);
if (StringUtils.isEmpty(tag)){
return false;
}
Event e = events.remove(tag);
if (e != null)
{
if (DEBUG) Timber.i("killing event, Tag: %s", e.getTag());
e.kill();
}
return e != null;
}
示例3: setSpeed
import timber.log.Timber; //導入依賴的package包/類
private void setSpeed(Integer left, Integer right) {
Integer leftSpeed = left==null || left==mLastLeftSpeed? null:left;
Integer rightSpeed = right==null || right==mLastRightSpeed? null:right;
if(leftSpeed!=null) mLeftSpeedTextView.setText(""+left);
if(rightSpeed!=null) mRightSpeedTextView.setText(""+right);
try {
com.zugaldia.robocar.mobile.client.RobocarClient service= new RobocarRestClient("http://"+this.mBaseUrl);
service.setSpeed(leftSpeed, rightSpeed);
if(left!=null) mLastLeftSpeed = left;
if(right!=null) mLastRightSpeed = right;
}catch(Exception e) {
Toast.makeText(this, "Unable to communicate with Robocar: "+e.getMessage(), Toast.LENGTH_SHORT).show();
Timber.d(e.getMessage());
}
}
示例4: convert
import timber.log.Timber; //導入依賴的package包/類
/**
* Convert settings from the internal representation to the string representation used in the
* preference storage.
*
* @param settings
* The map of settings to convert.
* @param settingDescriptions
* The structure containing the {@link SettingsDescription} objects that will be used
* to convert the setting values.
*
* @return The settings converted to the string representation used in the preference storage.
*/
public static Map<String, String> convert(Map<String, Object> settings,
Map<String, TreeMap<Integer, SettingsDescription>> settingDescriptions) {
Map<String, String> serializedSettings = new HashMap<>();
for (Entry<String, Object> setting : settings.entrySet()) {
String settingName = setting.getKey();
Object internalValue = setting.getValue();
TreeMap<Integer, SettingsDescription> versionedSetting = settingDescriptions.get(settingName);
Integer highestVersion = versionedSetting.lastKey();
SettingsDescription settingDesc = versionedSetting.get(highestVersion);
if (settingDesc != null) {
String stringValue = settingDesc.toString(internalValue);
serializedSettings.put(settingName, stringValue);
} else {
Timber.w("Settings.convert() called with a setting that should have been removed: %s", settingName);
}
}
return serializedSettings;
}
示例5: onLoadMore
import timber.log.Timber; //導入依賴的package包/類
@Override
public void onLoadMore() {
if (response.size() == 25){
try {
currentPage += 1;
loadNextPage();
progressBar.setVisibility(View.GONE);
isLoading = true;
} catch (Exception e) {
e.printStackTrace();
}
} else {
Timber.d("nothing");
}
}
示例6: handleTemporaryFailure
import timber.log.Timber; //導入依賴的package包/類
private void handleTemporaryFailure(String username, NegativeSmtpReplyException negativeResponseFromOldToken)
throws IOException, MessagingException {
// Token was invalid
//We could avoid this double check if we had a reasonable chance of knowing
//if a token was invalid before use (e.g. due to expiry). But we don't
//This is the intended behaviour per AccountManager
Timber.v(negativeResponseFromOldToken, "Authentication exception, re-trying with new token");
try {
attemptXoauth2(username);
} catch (NegativeSmtpReplyException negativeResponseFromNewToken) {
if (negativeResponseFromNewToken.getReplyCode() != SMTP_AUTHENTICATION_FAILURE_ERROR_CODE) {
throw negativeResponseFromNewToken;
}
//Okay, we failed on a new token.
//Invalidate the token anyway but assume it's permanent.
Timber.v(negativeResponseFromNewToken, "Authentication exception for new token, permanent error assumed");
oauthTokenProvider.invalidateToken(username);
handlePermanentFailure(negativeResponseFromNewToken);
}
}
示例7: engineSetSeed
import timber.log.Timber; //導入依賴的package包/類
@Override
protected void engineSetSeed(byte[] bytes) {
try {
OutputStream out;
synchronized (sLock) {
out = getUrandomOutputStream();
}
out.write(bytes);
out.flush();
} catch (IOException e) {
// On a small fraction of devices /dev/urandom is not writable.
// Log and ignore.
Timber.w("Failed to mix seed into " + URANDOM_FILE);
} finally {
mSeeded = true;
}
}
示例8: getChangePayload
import timber.log.Timber; //導入依賴的package包/類
public static Object getChangePayload(User oldUser, User newUser) {
Bundle bundle = new Bundle();
if (!TextUtils.equals(oldUser.getAvatar(), newUser.getAvatar())) {
bundle.putString(KEY_AVATAR, newUser.getAvatar());
}
if (!TextUtils.equals(oldUser.getName(), newUser.getName())) {
bundle.putString(KEY_NAME, newUser.getName());
}
if (!TextUtils.equals(oldUser.getDesc(), newUser.getDesc())) {
bundle.putString(KEY_DESC, newUser.getDesc());
}
if (bundle.size() == 0) {
return null;
}
Timber.d("getChangePayload | size: %d", bundle.size());
return bundle;
}
示例9: handleIntent
import timber.log.Timber; //導入依賴的package包/類
void handleIntent(Context context, @NonNull Intent intent) {
String intentAction = intent.getAction();
if (intentAction == null || !PR_NOTIFICATION.equals(intentAction)) {
return;
}
Timber.d("processing " + PR_NOTIFICATION);
Bundle extras = intent.getExtras();
if (extras == null) {
return;
}
final String username = extras.getString("username");
Timber.d("username " + username);
IntentUtils.triggerPRNotification(context, username);
}
示例10: parse
import timber.log.Timber; //導入依賴的package包/類
/**
* Parse a comma separated list of addresses in RFC-822 format and return an
* array of Address objects.
*
* @param addressList
* @return An array of 0 or more Addresses.
*/
public static Address[] parse(String addressList) {
if (TextUtils.isEmpty(addressList)) {
return EMPTY_ADDRESS_ARRAY;
}
List<Address> addresses = new ArrayList<>();
try {
MailboxList parsedList = DefaultAddressParser.DEFAULT.parseAddressList(addressList).flatten();
for (int i = 0, count = parsedList.size(); i < count; i++) {
Mailbox mailbox = parsedList.get(i);
addresses.add(new Address(mailbox.getLocalPart() + "@" + mailbox.getDomain(), mailbox.getName(), false));
}
} catch (MimeException pe) {
Timber.e(pe, "MimeException in Address.parse()");
//but we do an silent failover : we just use the given string as name with empty address
addresses.add(new Address(null, addressList, false));
}
return addresses.toArray(EMPTY_ADDRESS_ARRAY);
}
示例11: render
import timber.log.Timber; //導入依賴的package包/類
@Override public void render(SearchViewState viewState) {
Timber.d("render %s", viewState);
if (viewState instanceof SearchViewState.SearchNotStartedYet) {
renderSearchNotStarted();
} else if (viewState instanceof SearchViewState.Loading) {
renderLoading();
} else if (viewState instanceof SearchViewState.SearchResult) {
renderResult(((SearchViewState.SearchResult) viewState).getResult());
} else if (viewState instanceof SearchViewState.EmptyResult) {
renderEmptyResult();
} else if (viewState instanceof SearchViewState.Error) {
Timber.e(((SearchViewState.Error) viewState).getError());
renderError();
} else {
throw new IllegalArgumentException("Don't know how to render viewState " + viewState);
}
}
示例12: onResumeFragment
import timber.log.Timber; //導入依賴的package包/類
@Override
public void onResumeFragment() {
super.onResumeFragment();
Timber.d("onResumeFragment()");
Helper.hideKeyboard(getActivity());
final TxData txData = sendListener.getTxData();
tvTxAddress.setText(txData.getDestinationAddress());
String paymentId = txData.getPaymentId();
if ((paymentId != null) && (!paymentId.isEmpty())) {
tvTxPaymentId.setText(txData.getPaymentId());
} else {
tvTxPaymentId.setText("-");
}
final PendingTx committedTx = sendListener.getCommittedTx();
if (committedTx != null) {
tvTxId.setText(committedTx.txId);
bCopyTxId.setEnabled(true);
bCopyTxId.setImageResource(R.drawable.ic_content_copy_black_24dp);
tvTxAmount.setText(getString(R.string.send_amount, Helper.getDisplayAmount(committedTx.amount)));
tvTxFee.setText(getString(R.string.send_fee, Helper.getDisplayAmount(committedTx.fee)));
}
sendListener.enableDone();
}
示例13: getNextPage
import timber.log.Timber; //導入依賴的package包/類
public Integer getNextPage() {
String next = links.get(NEXT_LINK);
if (next == null) {
return null;
}
Matcher matcher = PAGE_PATTERN.matcher(next);
if (!matcher.find() || matcher.groupCount() != 1) {
return null;
}
try {
return Integer.parseInt(matcher.group(1));
} catch (NumberFormatException ex) {
Timber.w("cannot parse next page from %s", next);
return null;
}
}
示例14: deleteFileOrDirectory
import timber.log.Timber; //導入依賴的package包/類
private static void deleteFileOrDirectory(File file) {
if (file.isDirectory()) {
File[] subFiles = file.listFiles();
// subFiles is null on some devices, despite this being a directory
int length = subFiles == null ? 0 : subFiles.length;
for (int i = 0; i < length; i++) {
File sf = subFiles[i];
if (sf.isFile()) {
if (!sf.delete()) {
Timber.e("Error deleting %s", sf.getPath());
}
} else {
deleteFileOrDirectory(sf);
}
}
}
if (!file.delete()) {
Timber.e("Error deleting %s", file.getPath());
}
}
示例15: initializeData
import timber.log.Timber; //導入依賴的package包/類
private void initializeData() {
application.getWebService()
.getInteractionPosts(likeCounter, MySharedPreferences.getUserId(preferences), MySharedPreferences.getUserToken(preferences))
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.retryWhen(new RetryWithDelay(3,2000))
.subscribe(new BaseSubscriber<PostSuperUserListModel>() {
@Override
public void onNext(PostSuperUserListModel response) {
showRecycleWithDataFilled(response);
progressFrame.setVisibility(View.GONE);
}
@Override
public void onError(Throwable e) {
progressFrame.setVisibility(View.GONE);
try {
Timber.e(e.getMessage());
// Toast.makeText(UserHugCounterActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}catch (Exception ex){
ex.printStackTrace();
}
}
});
}