本文整理汇总了Java中com.couchbase.lite.util.Log.e方法的典型用法代码示例。如果您正苦于以下问题:Java Log.e方法的具体用法?Java Log.e怎么用?Java Log.e使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.couchbase.lite.util.Log
的用法示例。
在下文中一共展示了Log.e方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loginAsFacebookUser
import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
public void loginAsFacebookUser(Activity activity, String token, String userId, String name) {
setCurrentUserId(userId);
setDatabase(getUserDatabase(userId));
String profileDocID = "p:" + userId;
Document profile = mDatabase.getExistingDocument(profileDocID);
if (profile == null) {
try {
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("type", "profile");
properties.put("user_id", userId);
properties.put("name", name);
profile = mDatabase.getDocument(profileDocID);
profile.putProperties(properties);
// Migrate guest data to user:
UserProfile.migrateGuestData(getUserDatabase(GUEST_DATABASE_NAME), profile);
} catch (CouchbaseLiteException e) {
Log.e(TAG, "Cannot create a new user profile", e);
}
}
startReplication(AuthenticatorFactory.createFacebookAuthenticator(token));
login(activity);
}
示例2: addMember
import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
private void addMember(Document user) {
Map<String, Object> properties = new HashMap<>();
properties.putAll(mList.getProperties());
List<String> members = (List<String>) properties.get("members");
if (members == null) {
members = new ArrayList<String>();
properties.put("members", members);
}
members.add(user.getId());
try {
mList.putProperties(properties);
} catch (CouchbaseLiteException e) {
Log.e(Application.TAG, "Cannot add member to the list", e);
}
}
示例3: createTask
import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
private void createTask(String title, Bitmap image, String listId) {
String currentTimeString = mDateFormatter.format(new Date());
TaskEntity task = TaskEntity.create()
.setType("task")
.setCreatedAt(currentTimeString)
.setTitle(title)
.setChecked(Boolean.FALSE)
.setListId(listId);
if (image != null) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.JPEG, 50, out);
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
task.setImage(in);
}
try {
task.save();
} catch (CouchbaseLiteException e) {
Log.e(Application.TAG, "Cannot create new task", e);
}
}
示例4: attachImage
import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
private void attachImage(TaskEntity task, Bitmap image) {
if (task == null || image == null) return;
ByteArrayOutputStream out = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.JPEG, 50, out);
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
task.setImage(in);
try {
task.save();
} catch (CouchbaseLiteException e) {
Log.e(Application.TAG, "Cannot attach image", e);
}
}
示例5: dispatchTakePhotoIntent
import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
private void dispatchTakePhotoIntent() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(this.getPackageManager()) != null) {
File photoFile = null;
try {
photoFile = createImageFile();
} catch (IOException e) {
Log.e(Application.TAG, "Cannot create a temp image file", e);
}
if (photoFile != null) {
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
}
}
}
示例6: onPostExecute
import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
@Override
protected void onPostExecute(UploadResult uploadResult) {
int responseCode = uploadResult.statusCode;
WritableMap map = Arguments.createMap();
map.putInt("statusCode", responseCode);
if (responseCode == 200 || responseCode == 202) {
try {
JSONObject jsonObject = new JSONObject(uploadResult.response);
map.putMap("resp", convertJsonToMap(jsonObject));
callback.invoke(null, map);
} catch (JSONException e) {
map.putString("error", uploadResult.response);
callback.invoke(map, null);
Log.e(TAG, "Failed to parse response from clb: " + uploadResult.response, e);
}
} else {
map.putString("error", uploadResult.response);
callback.invoke(map, null);
}
}
示例7: onKey
import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
public boolean onKey(View v, int keyCode, KeyEvent event) {
if ((event.getAction() == KeyEvent.ACTION_DOWN)
&& (keyCode == KeyEvent.KEYCODE_ENTER)) {
String inputText = addItemEditText.getText().toString();
// Don't do anything until our liveQuery is initialized.
if(!inputText.equals("") && liveQuery != null) {
try {
createListItem(inputText);
Toast.makeText(getApplicationContext(), "Created new list item!", Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Error creating document, see logs for details", Toast.LENGTH_LONG).show();
Log.e(TAG, "Error creating document.", e);
}
}
addItemEditText.setText("");
return true;
}
return false;
}
示例8: onItemClick
import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
* Handle click on item in list
*/
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
// Step 10 code goes here
// This code handles checkbox touches. Couchbase Lite documents are like versioned-maps.
// To change a Document, add a new Revision.
QueryRow row = (QueryRow) adapterView.getItemAtPosition(position);
Document document = row.getDocument();
Map<String, Object> newProperties = new HashMap<String, Object>(document.getProperties());
boolean checked = ((Boolean) newProperties.get("check")).booleanValue();
newProperties.put("check", !checked);
try {
document.putProperties(newProperties);
kitchenSyncArrayAdapter.notifyDataSetChanged();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Error updating database, see logs for details", Toast.LENGTH_LONG).show();
Log.e(TAG, "Error updating database", e);
}
}
示例9: getInfo
import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
@Override
public String getInfo(String key) {
try {
byte[][] metaNbody = forest.rawGet("info", key);
return new String(metaNbody[1]);
} catch (ForestException e) {
// KEY NOT FOUND
if (e.domain == ForestDBDomain &&
e.code == FDBErrors.FDB_RESULT_KEY_NOT_FOUND) {
Log.i(TAG, "[getInfo()] Key(\"%s\") is not found.", key);
}
// UNEXPECTED ERROR
else {
Log.e(TAG, "[getInfo()] Unexpected Error", e);
}
return null;
}
}
示例10: runInTransaction
import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
* @note Throw RuntimeException if TransactionalTask throw Exception.
* Otherwise return true or false
*/
@Override
public boolean runInTransaction(TransactionalTask task) {
if (inTransaction())
return task.run();
else {
if (!beginTransaction())
return false;
boolean commit = true;
try {
commit = task.run();
} catch (Exception e) {
commit = false;
Log.e(TAG, "[ForestDBStore.runInTransaction()] Error in TransactionalTask", e);
throw new RuntimeException(e);
} finally {
if (!endTransaction(commit))
return false;
}
return commit;
}
}
示例11: getDocumentWithRetry
import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
private Document getDocumentWithRetry(String docID, boolean mustExist, int retry)
throws ForestException {
ForestException ex = null;
for (int i = 0; i < retry; i++) {
try {
Document doc = forest.getDocument(docID, mustExist);
return doc;
} catch (ForestException fe) {
ex = fe;
if (fe.domain == ForestDBDomain && fe.code == FDB_RESULT_HANDLE_BUSY) {
try {
Thread.sleep(300); // 300ms
} catch (InterruptedException e) {
}
continue;
} else {
throw fe;
}
}
}
Log.e(TAG, "Retried %s times. But keep failing ForestDB.getDocument() docID=%s", ex, retry, docID);
throw ex;
}
示例12: getLastSequence
import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
* The latest sequence number used. Every new revision is assigned a new sequence number,
* so this property increases monotonically as changes are made to the storageEngine. It can be
* used to check whether the storageEngine has changed between two points in time.
*/
public long getLastSequence() {
String sql = "SELECT MAX(sequence) FROM revs";
Cursor cursor = null;
long result = 0;
try {
cursor = storageEngine.rawQuery(sql, null);
if (cursor.moveToNext()) {
result = cursor.getLong(0);
}
} catch (SQLException e) {
Log.e(TAG, "Error getting last sequence", e);
} finally {
if (cursor != null) {
cursor.close();
}
}
return result;
}
示例13: getInfo
import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
@Override
public String getInfo(String key) {
String result = null;
Cursor cursor = null;
try {
String[] args = {key};
cursor = storageEngine.rawQuery("SELECT value FROM info WHERE key=?", args);
if (cursor.moveToNext()) {
result = cursor.getString(0);
}
} catch (SQLException e) {
Log.e(TAG, "Error querying " + key, e);
} finally {
if (cursor != null) {
cursor.close();
}
}
return result;
}
示例14: runInTransaction
import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
* @note Throw RuntimeException if TransactionalTask throw Exception.
* Otherwise return true or false
*/
@Override
public boolean runInTransaction(TransactionalTask transactionalTask) {
boolean shouldCommit = true;
if (!beginTransaction())
return false;
try {
shouldCommit = transactionalTask.run();
} catch (Exception e) {
shouldCommit = false;
Log.e(TAG, e.toString(), e);
throw new RuntimeException(e);
} finally {
if (!endTransaction(shouldCommit))
return false;
}
return shouldCommit;
}
示例15: getViewID
import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
private int getViewID() {
if (viewID < 0) {
String sql = "SELECT view_id FROM views WHERE name=?";
String[] args = {name};
Cursor cursor = null;
try {
cursor = store.getStorageEngine().rawQuery(sql, args);
if (cursor.moveToNext()) {
viewID = cursor.getInt(0);
}
} catch (SQLException e) {
Log.e(Log.TAG_VIEW, "Error getting view id", e);
} finally {
if (cursor != null) {
cursor.close();
}
}
}
return viewID;
}