当前位置: 首页>>代码示例>>Java>>正文


Java Timber.e方法代码示例

本文整理汇总了Java中timber.log.Timber.e方法的典型用法代码示例。如果您正苦于以下问题:Java Timber.e方法的具体用法?Java Timber.e怎么用?Java Timber.e使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在timber.log.Timber的用法示例。


在下文中一共展示了Timber.e方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readMountsFile

import timber.log.Timber; //导入方法依赖的package包/类
/**
 * Read /proc/mounts. This is a set of hacks for versions below Kitkat.
 * @return list of mounts based on the mounts file.
 */
private static List<String> readMountsFile() {
  String sdcardPath = Environment.getExternalStorageDirectory().getAbsolutePath();
  List<String> mounts = new ArrayList<>();
  mounts.add(sdcardPath);

  Timber.d("reading mounts file begin");
  try {
    File mountFile = new File("/proc/mounts");
    if (mountFile.exists()) {
      Timber.d("mounts file exists");
      Scanner scanner = new Scanner(mountFile);
      while (scanner.hasNext()) {
        String line = scanner.nextLine();
        Timber.d("line: %s", line);
        if (line.startsWith("/dev/block/vold/")) {
          String[] lineElements = line.split(" ");
          String element = lineElements[1];
          Timber.d("mount element is: %s", element);
          if (!sdcardPath.equals(element)) {
            mounts.add(element);
          }
        } else {
          Timber.d("skipping mount line: %s", line);
        }
      }
    } else {
      Timber.d("mounts file doesn't exist");
    }

    Timber.d("reading mounts file end.. list is: %s", mounts);
  } catch (Exception e) {
    Timber.e(e, "Error reading mounts file");
  }
  return mounts;
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:40,代码来源:StorageUtils.java

示例2: moveAppFiles

import timber.log.Timber; //导入方法依赖的package包/类
public static boolean moveAppFiles(Context context, String newLocation) {
  if (QuranSettings.getInstance(context).getAppCustomLocation().equals(newLocation)) {
    return true;
  }
  final String baseDir = getQuranBaseDirectory(context);
  if (baseDir == null) {
    return false;
  }
  File currentDirectory = new File(baseDir);
  File newDirectory = new File(newLocation, QURAN_BASE);
  if (!currentDirectory.exists()) {
    // No files to copy, so change the app directory directly
    return true;
  } else if (newDirectory.exists() || newDirectory.mkdirs()) {
    try {
      copyFileOrDirectory(currentDirectory, newDirectory);
      deleteFileOrDirectory(currentDirectory);
      return true;
    } catch (IOException e) {
      Timber.e(e, "error moving app files");
    }
  }
  return false;
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:25,代码来源:QuranFileUtils.java

示例3: delete

import timber.log.Timber; //导入方法依赖的package包/类
public void delete(File file) {
  ensureNotNull(file, "Attempt to delete null file");

  if (file.isDirectory()) {
    File[] files = file.listFiles();

    if (files != null) {
      for (File c : files) {
        delete(c);
      }
    }
  }

  if (!file.delete()) {
    Timber.e("failed to delete file %s", file);
  }
}
 
开发者ID:philipphager,项目名称:disclosure-android-app,代码行数:18,代码来源:FileUtils.java

示例4: log

import timber.log.Timber; //导入方法依赖的package包/类
static void log(LogType logType, String message, Throwable throwable) {
    switch (logType) {
        case VERBOSE:
            Timber.v(throwable, message);
            break;

        case DEBUG:
            Timber.d(throwable, message);
            break;

        case INFO:
            Timber.i(throwable, message);
            break;

        case WARN:
            Timber.w(throwable, message);
            break;

        case ERROR:
            Timber.e(throwable, message);
            break;
    }
}
 
开发者ID:LachlanMcKee,项目名称:timber-junit-rule,代码行数:24,代码来源:LogTester.java

示例5: getPageContentByPageId

import timber.log.Timber; //导入方法依赖的package包/类
public String getPageContentByPageId(int pageId) {

        Cursor c = getReadableDatabase().query(BookDatabaseContract.PageEntry.TABLE_NAME
                , new String[]{BookDatabaseContract.PageEntry.COLUMN_NAME_PAGE},
                BookDatabaseContract.PageEntry.COLUMN_NAME_PAGE_ID + " = ?",
                new String[]{String.valueOf(pageId)},
                null, null, null
        );
        try {
            c.moveToFirst();
            String page_content = c.getString(0);
            c.close();
            return page_content;
        } catch (Exception e) {
            Timber.e("getPageContentByPageId(" + pageId + ")" + "from book" + mBookPath, e);
        } finally {
            c.close();
        }

        return "Error getPageContentByPageId(" + pageId + ")" + "from book" + mBookPath;

    }
 
开发者ID:fekracomputers,项目名称:IslamicLibraryAndroid,代码行数:23,代码来源:BookDatabaseHelper.java

示例6: 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);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:SearchFragment.java

示例7: exchange

import timber.log.Timber; //导入方法依赖的package包/类
public void exchange(ExchangeRate exchangeRate) {
    hideProgress();
    // first, make sure this is what we want
    String enteredCurrencyA = (String) sCurrencyA.getSelectedItem();
    String enteredCurrencyB = (String) sCurrencyB.getSelectedItem();
    if (!exchangeRate.getBaseCurrency().equals(enteredCurrencyA)
            || !exchangeRate.getQuoteCurrency().equals(enteredCurrencyB)) {
        // something's wrong
        Timber.e("Currencies don't match!");
        return;
    }
    assetPair = enteredCurrencyA + enteredCurrencyB;
    assetRate = exchangeRate.getRate();
    if (prepareExchange()) {
        exchange(exchangeRate.getRate());
    }
}
 
开发者ID:m2049r,项目名称:xmrwallet,代码行数:18,代码来源:ExchangeTextView.java

示例8: refreshFolder

import timber.log.Timber; //导入方法依赖的package包/类
private void refreshFolder(Account account, String folderId) {
    // There has to be a cheaper way to get at the localFolder object than this
    LocalFolder localFolder = null;
    try {
        if (account != null && folderId != null) {
            if (!account.isAvailable(FolderList.this)) {
                Timber.i("not refreshing folder of unavailable account");
                return;
            }
            localFolder = account.getLocalStore().getFolder(folderId);
            FolderInfoHolder folderHolder = getFolder(folderId);
            if (folderHolder != null) {
                folderHolder.populate(context, localFolder, mAccount, -1);
                folderHolder.flaggedMessageCount = -1;

                mHandler.dataChanged();
            }
        }
    } catch (Exception e) {
        Timber.e(e, "Exception while populating folder");
    } finally {
        if (localFolder != null) {
            localFolder.close();
        }
    }

}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:28,代码来源:FolderList.java

示例9: removeBond

import timber.log.Timber; //导入方法依赖的package包/类
/**
 * Remove bond with the specific device.
 */
public void removeBond(BluetoothDevice device) {
  try {
    Timber.w("Removing bond.");
    Method m = device.getClass().getMethod("removeBond", (Class[]) null);
    m.invoke(device, (Object[]) null);
  } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
    Timber.e(e, "Failed to remove bond.");
  }
}
 
开发者ID:zugaldia,项目名称:android-robocar,代码行数:13,代码来源:Nes30Connection.java

示例10: createFtsSearchTable

import timber.log.Timber; //导入方法依赖的package包/类
static void createFtsSearchTable(SQLiteDatabase db, MigrationsHelper migrationsHelper) {
    MessageFulltextCreator fulltextCreator = MessageFulltextCreator.newInstance();
    ContentValues cv = new ContentValues();
    db.execSQL("CREATE VIRTUAL TABLE messages_fulltext USING fts4 (fulltext)");

    try {
        List<Long> folders = fetchFolders(db);

        for (Long folderDatabaseId : folders) {
            List<String> messageUids = fetchAllMessageUids(db, folderDatabaseId);
            for (String messageUid : messageUids) {
                LocalMessageData localMessageData = getMessage(db, messageUid, folderDatabaseId);
                loadMessageParts(db, localMessageData, migrationsHelper.getAccount().getUuid(),
                        migrationsHelper.getLocalStore());

                String fulltext = fulltextCreator.createFulltext(localMessageData);
                if (!TextUtils.isEmpty(fulltext)) {
                    Timber.d("fulltext for msg id %d is %d chars long", localMessageData.getDatabaseId(),
                            fulltext.length());
                    cv.clear();
                    cv.put("docid", localMessageData.getDatabaseId());
                    cv.put("fulltext", fulltext);
                    db.insert("messages_fulltext", null, cv);
                } else {
                    Timber.d("no fulltext for msg id %d :(", localMessageData.getDatabaseId());
                }
            }
        }
    } catch (MessagingException e) {
        Timber.e(e, "error indexing fulltext - skipping rest, fts index is incomplete!");
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:33,代码来源:MigrationTo55.java

示例11: ApiResponse

import timber.log.Timber; //导入方法依赖的package包/类
public ApiResponse(Response<T> response) {
    code = response.code();
    if (response.isSuccessful()) {
        body = response.body();
        errorMessage = null;
    } else {
        String message = null;
        if (response.errorBody() != null) {
            try {
                message = response.errorBody().string();
            } catch (IOException ignored) {
                Timber.e(ignored, "error while parsing response");
            }
        }
        if (message == null || message.trim().length() == 0) {
            message = response.message();
        }
        errorMessage = message;
        body = null;
    }
    String linkHeader = response.headers().get("link");
    if (linkHeader == null) {
        links = Collections.emptyMap();
    } else {
        links = new ArrayMap<>();
        Matcher matcher = LINK_PATTERN.matcher(linkHeader);

        while (matcher.find()) {
            int count = matcher.groupCount();
            if (count == 2) {
                links.put(matcher.group(2), matcher.group(1));
            }
        }
    }
}
 
开发者ID:xiaobailong24,项目名称:MVVMArms,代码行数:36,代码来源:ApiResponse.java

示例12: deleteThreadsSynchronous

import timber.log.Timber; //导入方法依赖的package包/类
private void deleteThreadsSynchronous(Account account, String folderId, String folderName, List<? extends Message> messages) {
    try {
        List<Message> messagesToDelete = collectMessagesInThreads(account, messages);

        deleteMessagesSynchronous(account, folderId, folderName,
                messagesToDelete, null);
    } catch (MessagingException e) {
        Timber.e(e, "Something went wrong while deleting threads");
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:11,代码来源:MessagingController.java

示例13: firebaseAuthWithFacebook

import timber.log.Timber; //导入方法依赖的package包/类
private void firebaseAuthWithFacebook(AccessToken token) {
    Timber.e("firebaseAuthWithFacebook:" + token);

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, mAuthCompleteListener);
}
 
开发者ID:hbmartin,项目名称:firebase-chat-android-architecture-components,代码行数:8,代码来源:ProfileActivity.java

示例14: clearAllPending

import timber.log.Timber; //导入方法依赖的package包/类
public void clearAllPending(final Account account) {
    try {
        Timber.w("Clearing pending commands!");
        LocalStore localStore = account.getLocalStore();
        localStore.removePendingCommands();
    } catch (MessagingException me) {
        Timber.e(me, "Unable to clear pending command");
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:10,代码来源:MessagingController.java

示例15: failure

import timber.log.Timber; //导入方法依赖的package包/类
private void failure(Exception use) {
    Timber.e(use, "Failure");
    String toastText = getString(R.string.account_setup_bad_uri, use.getMessage());

    Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG);
    toast.show();
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:8,代码来源:AccountSetupOutgoing.java


注:本文中的timber.log.Timber.e方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。