本文整理汇总了Java中timber.log.Timber.w方法的典型用法代码示例。如果您正苦于以下问题:Java Timber.w方法的具体用法?Java Timber.w怎么用?Java Timber.w使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timber.log.Timber
的用法示例。
在下文中一共展示了Timber.w方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseServerSettings
import timber.log.Timber; //导入方法依赖的package包/类
private static ImportedServer parseServerSettings(XmlPullParser xpp, String endTag)
throws XmlPullParserException, IOException {
ImportedServer server = new ImportedServer();
server.type = xpp.getAttributeValue(null, SettingsExporter.TYPE_ATTRIBUTE);
int eventType = xpp.next();
while (!(eventType == XmlPullParser.END_TAG && endTag.equals(xpp.getName()))) {
if (eventType == XmlPullParser.START_TAG) {
String element = xpp.getName();
if (SettingsExporter.HOST_ELEMENT.equals(element)) {
server.host = getText(xpp);
} else if (SettingsExporter.PORT_ELEMENT.equals(element)) {
server.port = getText(xpp);
} else if (SettingsExporter.CONNECTION_SECURITY_ELEMENT.equals(element)) {
server.connectionSecurity = getText(xpp);
} else if (SettingsExporter.AUTHENTICATION_TYPE_ELEMENT.equals(element)) {
String text = getText(xpp);
server.authenticationType = AuthType.valueOf(text);
} else if (SettingsExporter.USERNAME_ELEMENT.equals(element)) {
server.username = getText(xpp);
} else if (SettingsExporter.CLIENT_CERTIFICATE_ALIAS_ELEMENT.equals(element)) {
server.clientCertificateAlias = getText(xpp);
} else if (SettingsExporter.PASSWORD_ELEMENT.equals(element)) {
server.password = getText(xpp);
} else if (SettingsExporter.EXTRA_ELEMENT.equals(element)) {
server.extras = parseSettings(xpp, SettingsExporter.EXTRA_ELEMENT);
} else {
Timber.w("Unexpected start tag: %s", xpp.getName());
}
}
eventType = xpp.next();
}
return server;
}
示例2: onMount
import timber.log.Timber; //导入方法依赖的package包/类
/**
* @param path
* @param readOnly
*/
public void onMount(final String path, final boolean readOnly) {
Timber.i("storage path \"%s\" mounted readOnly=%s", path, readOnly);
if (readOnly) {
return;
}
final StorageProvider provider = resolveProvider(path);
if (provider == null) {
return;
}
for (final StorageListener listener : mListeners) {
try {
listener.onMount(provider.getId());
} catch (Exception e) {
Timber.w(e, "Error while notifying StorageListener");
}
}
// XXX we should reset mail service ONLY if there are accounts using the storage (this is not done in a regular listener because it has to be invoked afterward)
QMail.setServicesEnabled(context);
}
示例3: parseIdentities
import timber.log.Timber; //导入方法依赖的package包/类
private static List<ImportedIdentity> parseIdentities(XmlPullParser xpp)
throws XmlPullParserException, IOException {
List<ImportedIdentity> identities = null;
int eventType = xpp.next();
while (!(eventType == XmlPullParser.END_TAG && SettingsExporter.IDENTITIES_ELEMENT.equals(xpp.getName()))) {
if (eventType == XmlPullParser.START_TAG) {
String element = xpp.getName();
if (SettingsExporter.IDENTITY_ELEMENT.equals(element)) {
if (identities == null) {
identities = new ArrayList<>();
}
ImportedIdentity identity = parseIdentity(xpp);
identities.add(identity);
} else {
Timber.w("Unexpected start tag: %s", xpp.getName());
}
}
eventType = xpp.next();
}
return identities;
}
示例4: onFragmentCreated
import timber.log.Timber; //导入方法依赖的package包/类
@Override
public void onFragmentCreated(FragmentManager fm, Fragment f, Bundle savedInstanceState) {
super.onFragmentCreated(fm, f, savedInstanceState);
Timber.w(f.toString() + " - onFragmentCreated");
FragmentDelegate fragmentDelegate = fetchFragmentDelegate(f);
if (fragmentDelegate != null) {
fragmentDelegate.onCreate(savedInstanceState);
}
}
示例5: onFragmentStopped
import timber.log.Timber; //导入方法依赖的package包/类
@Override
public void onFragmentStopped(FragmentManager fm, Fragment f) {
super.onFragmentStopped(fm, f);
Timber.w(f.toString() + " - onFragmentStopped");
FragmentDelegate fragmentDelegate = fetchFragmentDelegate(f);
if (fragmentDelegate != null) {
fragmentDelegate.onStop();
}
}
示例6: onFragmentStopped
import timber.log.Timber; //导入方法依赖的package包/类
@Override
public void onFragmentStopped(FragmentManager fm, Fragment f) {
Timber.w(f.toString() + " - onFragmentStopped");
FragmentDelegate fragmentDelegate = fetchFragmentDelegate(f);
if (fragmentDelegate != null) {
fragmentDelegate.onStop();
}
}
示例7: startService
import timber.log.Timber; //导入方法依赖的package包/类
@Override
public int startService(Intent intent, int startId) {
Timber.i("NotificationActionService started with startId = %d", startId);
String accountUuid = intent.getStringExtra(EXTRA_ACCOUNT_UUID);
Preferences preferences = Preferences.getPreferences(this);
Account account = preferences.getAccount(accountUuid);
if (account == null) {
Timber.w("Could not find account for notification action.");
return START_NOT_STICKY;
}
MessagingController controller = MessagingController.getInstance(getApplication());
String action = intent.getAction();
if (ACTION_MARK_AS_READ.equals(action)) {
markMessagesAsRead(intent, account, controller);
} else if (ACTION_DELETE.equals(action)) {
deleteMessages(intent, controller);
} else if (ACTION_ARCHIVE.equals(action)) {
archiveMessages(intent, account, controller);
} else if (ACTION_SPAM.equals(action)) {
markMessageAsSpam(intent, account, controller);
} else if (ACTION_DISMISS.equals(action)) {
Timber.i("Notification dismissed");
}
cancelNotifications(intent, account, controller);
return START_NOT_STICKY;
}
示例8: onFragmentViewDestroyed
import timber.log.Timber; //导入方法依赖的package包/类
@Override
public void onFragmentViewDestroyed(FragmentManager fm, Fragment f) {
super.onFragmentViewDestroyed(fm, f);
Timber.w(f.toString() + " - onFragmentViewDestroyed");
FragmentDelegate fragmentDelegate = fetchFragmentDelegate(f);
if (fragmentDelegate != null) {
fragmentDelegate.onDestroyView();
}
}
示例9: onFragmentStopped
import timber.log.Timber; //导入方法依赖的package包/类
@Override
public void onFragmentStopped(FragmentManager fm, Fragment f) {
super.onFragmentStopped(fm, f);
Timber.w(f.toString() +"onFragmentStopped");
FragmentDelegate fragmentDelegate = fetchFragmentDelegate(f);
if (fragmentDelegate != null) {
fragmentDelegate.onStop();
}
}
示例10: onFragmentActivityCreated
import timber.log.Timber; //导入方法依赖的package包/类
@Override
public void onFragmentActivityCreated(FragmentManager fm, Fragment f, Bundle savedInstanceState) {
Timber.w(f.toString() + " - onFragmentActivityCreated");
FragmentDelegate fragmentDelegate = fetchFragmentDelegate(f);
if (fragmentDelegate != null) {
fragmentDelegate.onActivityCreate(savedInstanceState);
}
}
示例11: onFragmentStarted
import timber.log.Timber; //导入方法依赖的package包/类
@Override
public void onFragmentStarted(FragmentManager fm, Fragment f) {
super.onFragmentStarted(fm, f);
Timber.w(f.toString() + " - onFragmentStarted");
FragmentDelegate fragmentDelegate = fetchFragmentDelegate(f);
if (fragmentDelegate != null) {
fragmentDelegate.onStart();
}
}
示例12: uploadDirty
import timber.log.Timber; //导入方法依赖的package包/类
/**
* Uploads dirty records to the server, using a PUT request for each record.
* Checks Thread.interrupted() before each request to allow quick sync cancellation.
*/
protected void uploadDirty() throws IOException, HttpException, CalendarStorageException {
// upload dirty contacts
for (final LocalResource local : localCollection.getDirty()) {
if (Thread.interrupted()) {
return;
}
final String fileName = local.getFileName();
final DavResource remote =
new DavResource(httpClient, collectionURL.newBuilder().addPathSegment(fileName).build());
// generate entity to upload (VCard, iCal, whatever)
RequestBody body = prepareUpload(local);
try {
if (local.getETag() == null) {
remote.put(body, null, true);
} else {
remote.put(body, local.getETag(), false);
}
} catch (ConflictException | PreconditionFailedException e) {
// we can't interact with the user to resolve the conflict, so we treat 409 like 412
Timber.w("Resource has been modified on the server before upload, ignoring", e);
}
String eTag = null;
GetETag newETag = (GetETag) remote.properties.get(GetETag.NAME);
if (newETag != null) {
eTag = newETag.eTag;
} else {
Timber.d("Didn't receive new ETag after uploading, setting to null");
}
local.clearDirty(eTag);
}
}
示例13: onDestroyView
import timber.log.Timber; //导入方法依赖的package包/类
@Override
public void onDestroyView() {
if (mUnbinder != null && mUnbinder != mUnbinder.EMPTY) {
try {
mUnbinder.unbind();
} catch (IllegalStateException e) {
e.printStackTrace();
//fix Bindings already cleared
Timber.w("onDestroyView: " + e.getMessage());
}
}
}
示例14: delete
import timber.log.Timber; //导入方法依赖的package包/类
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
if (QMail.app == null) {
return 0;
}
Timber.v("MessageProvider/delete: %s", uri);
// Note: can only delete a message
List<String> segments = uri.getPathSegments();
int accountId = Integer.parseInt(segments.get(1));
String folderName = segments.get(2);
String msgUid = segments.get(3);
// get account
Account myAccount = null;
for (Account account : Preferences.getPreferences(getContext()).getAccounts()) {
if (account.getAccountNumber() == accountId) {
myAccount = account;
if (!account.isAvailable(getContext())) {
Timber.w("not deleting messages because account is unavailable at the moment");
return 0;
}
}
}
if (myAccount == null) {
Timber.e("Could not find account with id %d", accountId);
}
if (myAccount != null) {
MessageReference messageReference = new MessageReference(myAccount.getUuid(), folderName, msgUid, null);
MessagingController controller = MessagingController.getInstance(getContext());
controller.deleteMessage(messageReference, null);
}
// FIXME return the actual number of deleted messages
return 0;
}
示例15: intercept
import timber.log.Timber; //导入方法依赖的package包/类
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
boolean logRequest = printLevel == Level.ALL || (printLevel != Level.NONE && printLevel == Level.REQUEST);
if (logRequest) {
boolean hasRequestBody = request.body() != null;
//打印请求信息
Timber.tag(getTag(request, "Request_Info")).w("Params : 「 %s 」%nConnection : 「 %s 」%nHeaders : %n「 %s 」"
, hasRequestBody ? parseParams(request.newBuilder().build().body()) : "Null"
, chain.connection()
, request.headers());
}
boolean logResponse = printLevel == Level.ALL || (printLevel != Level.NONE && printLevel == Level.RESPONSE);
long t1 = logResponse ? System.nanoTime() : 0;
Response originalResponse;
try {
originalResponse = chain.proceed(request);
} catch (Exception e) {
Timber.w("Http Error: " + e);
throw e;
}
long t2 = logResponse ? System.nanoTime() : 0;
if (logResponse) {
String bodySize = originalResponse.body().contentLength() != -1 ? originalResponse.body().contentLength() + "-byte" : "unknown-length";
//打印响应时间以及响应头
Timber.tag(getTag(request, "Response_Info")).w("Received response in [ %d-ms ] , [ %s ]%n%s"
, TimeUnit.NANOSECONDS.toMillis(t2 - t1), bodySize, originalResponse.headers());
}
//打印响应结果
String bodyString = printResult(request, originalResponse.newBuilder().build(), logResponse);
if (mHandler != null)//这里可以比客户端提前一步拿到服务器返回的结果,可以做一些操作,比如token超时,重新获取
return mHandler.onHttpResultResponse(bodyString, chain, originalResponse);
return originalResponse;
}