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


Java LogUtil类代码示例

本文整理汇总了Java中com.facebook.stetho.common.LogUtil的典型用法代码示例。如果您正苦于以下问题:Java LogUtil类的具体用法?Java LogUtil怎么用?Java LogUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: bindToSocket

import com.facebook.stetho.common.LogUtil; //导入依赖的package包/类
@Nonnull
private static LocalServerSocket bindToSocket(String address) throws IOException {
  int retries = MAX_BIND_RETRIES;
  IOException firstException = null;
  do {
    try {
      if (LogUtil.isLoggable(Log.DEBUG)) {
        LogUtil.d("Trying to bind to @" + address);
      }
      return new LocalServerSocket(address);
    } catch (BindException be) {
      LogUtil.w(be, "Binding error, sleep " + TIME_BETWEEN_BIND_RETRIES_MS + " ms...");
      if (firstException == null) {
        firstException = be;
      }
      Util.sleepUninterruptibly(TIME_BETWEEN_BIND_RETRIES_MS);
    }
  } while (retries-- > 0);

  throw firstException;
}
 
开发者ID:facebook,项目名称:stetho,代码行数:22,代码来源:LocalSocketServer.java

示例2: enforcePermission

import com.facebook.stetho.common.LogUtil; //导入依赖的package包/类
private static void enforcePermission(Context context, LocalSocket peer)
    throws IOException, PeerAuthorizationException {
  Credentials credentials = peer.getPeerCredentials();

  int uid = credentials.getUid();
  int pid = credentials.getPid();

  if (LogUtil.isLoggable(Log.VERBOSE)) {
    LogUtil.v("Got request from uid=%d, pid=%d", uid, pid);
  }

  String requiredPermission = Manifest.permission.DUMP;
  int checkResult = context.checkPermission(requiredPermission, pid, uid);
  if (checkResult != PackageManager.PERMISSION_GRANTED) {
    throw new PeerAuthorizationException(
        "Peer pid=" + pid + ", uid=" + uid + " does not have " + requiredPermission);
  }
}
 
开发者ID:facebook,项目名称:stetho,代码行数:19,代码来源:SecureSocketHandler.java

示例3: closeAll

import com.facebook.stetho.common.LogUtil; //导入依赖的package包/类
private void closeAll(int mostImportantIndex) throws IOException {
  IOException exceptionToThrow = null;
  for (int i = 0; i < mStreams.length; i++) {
    try {
      mStreams[i].close();
    } catch (IOException e) {
      IOException previousException = exceptionToThrow;
      if (i == mostImportantIndex || exceptionToThrow == null) {
        exceptionToThrow = e;
      }
      if (previousException != null && previousException != exceptionToThrow) {
        LogUtil.w(previousException, "Suppressing exception");
      }
    }
  }
}
 
开发者ID:facebook,项目名称:stetho,代码行数:17,代码来源:CompositeInputStream.java

示例4: highlightNode

import com.facebook.stetho.common.LogUtil; //导入依赖的package包/类
@ChromeDevtoolsMethod
public void highlightNode(JsonRpcPeer peer, JSONObject params) {
  final HighlightNodeRequest request =
    mObjectMapper.convertValue(params, HighlightNodeRequest.class);
  if (request.nodeId == null) {
    LogUtil.w("DOM.highlightNode was not given a nodeId; JS objectId is not supported");
    return;
  }

  final RGBAColor contentColor = request.highlightConfig.contentColor;
  if (contentColor == null) {
    LogUtil.w("DOM.highlightNode was not given a color to highlight with");
    return;
  }

  mDocument.postAndWait(new Runnable() {
    @Override
    public void run() {
      Object element = mDocument.getElementForNodeId(request.nodeId);
      if (element != null) {
        mDocument.highlightElement(element, contentColor.getColor());
      }
    }
  });
}
 
开发者ID:facebook,项目名称:stetho,代码行数:26,代码来源:DOM.java

示例5: getSearchResults

import com.facebook.stetho.common.LogUtil; //导入依赖的package包/类
@ChromeDevtoolsMethod
public GetSearchResultsResponse getSearchResults(JsonRpcPeer peer, JSONObject params) {
  final GetSearchResultsRequest request = mObjectMapper.convertValue(
      params,
      GetSearchResultsRequest.class);

  if (request.searchId == null) {
    LogUtil.w("searchId may not be null");
    return null;
  }

  final List<Integer> results = mSearchResults.get(request.searchId);

  if (results == null) {
    LogUtil.w("\"" + request.searchId + "\" is not a valid reference to a search result");
    return null;
  }

  final List<Integer> resultsRange = results.subList(request.fromIndex, request.toIndex);

  final GetSearchResultsResponse response = new GetSearchResultsResponse();
  response.nodeIds = resultsRange;

  return response;
}
 
开发者ID:facebook,项目名称:stetho,代码行数:26,代码来源:DOM.java

示例6: updateTree

import com.facebook.stetho.common.LogUtil; //导入依赖的package包/类
private void updateTree() {
  long startTimeMs = SystemClock.elapsedRealtime();

  ShadowDocument.Update docUpdate = createShadowDocumentUpdate();
  boolean isEmpty = docUpdate.isEmpty();
  if (isEmpty) {
    docUpdate.abandon();
  } else {
    applyDocumentUpdate(docUpdate);
  }

  long deltaMs = SystemClock.elapsedRealtime() - startTimeMs;
  LogUtil.d(
      "Document.updateTree() completed in %s ms%s",
      Long.toString(deltaMs),
      isEmpty ? " (no changes)" : "");
}
 
开发者ID:facebook,项目名称:stetho,代码行数:18,代码来源:Document.java

示例7: initJsScope

import com.facebook.stetho.common.LogUtil; //导入依赖的package包/类
private @NonNull ScriptableObject initJsScope(@NonNull Context jsContext) {
  // Set the main Rhino goodies
  ImporterTopLevel importerTopLevel = new ImporterTopLevel(jsContext);
  ScriptableObject scope = jsContext.initStandardObjects(importerTopLevel, false);

  ScriptableObject.putProperty(scope, "context", Context.javaToJS(mContext, scope));

  try {
    importClasses(jsContext, scope);
    importPackages(jsContext, scope);
    importConsole(scope);
    importVariables(scope);
    importFunctions(scope);
  } catch (StethoJsException e) {
    String message = String.format("%s\n%s", e.getMessage(), Log.getStackTraceString(e));
    LogUtil.e(e, message);
    CLog.writeToConsole(Console.MessageLevel.ERROR, Console.MessageSource.JAVASCRIPT, message);
  }

  return scope;
}
 
开发者ID:facebook,项目名称:stetho,代码行数:22,代码来源:JsRuntimeReplFactoryBuilder.java

示例8: maybeRegister

import com.facebook.stetho.common.LogUtil; //导入依赖的package包/类
private static void maybeRegister(DescriptorMap map, @Nullable FragmentCompat compat) {
    if (compat != null) {
        Class<?> fragmentClass = compat.getFragmentClass();
        LogUtil.d("Adding support for %s", fragmentClass.getName());
        map.registerDescriptor(fragmentClass, new RIFragmentDescriptor(compat));
    }
}
 
开发者ID:nekocode,项目名称:ResourceInspector,代码行数:8,代码来源:RIFragmentDescriptor.java

示例9: getAppVersion

import com.facebook.stetho.common.LogUtil; //导入依赖的package包/类
public static String getAppVersion() {
    String appVersion = null;
    PackageManager packageManager = AndroidApplication.getInstance().getPackageManager();
    try {
        PackageInfo info = packageManager.getPackageInfo(AndroidApplication.getInstance().getPackageName(), 0);
        appVersion = String.valueOf(info.versionCode);
        return appVersion;
    } catch (Throwable e) {
        LogUtil.d("PhoneInfoUtils.getAppVersion()", e.toString());
    }
    return appVersion;
}
 
开发者ID:jacklongway,项目名称:LiteSDK,代码行数:13,代码来源:PhoneInfoUtils.java

示例10: handleSuppression

import com.facebook.stetho.common.LogUtil; //导入依赖的package包/类
private static <T extends Throwable> T handleSuppression(@Nullable T previous, T current) {
  if (previous == null) {
    return current;
  } else {
    LogUtil.i(TAG, current, "Suppressed while handling " + previous);
    return previous;
  }
}
 
开发者ID:facebook,项目名称:stetho,代码行数:9,代码来源:Framer.java

示例11: listenOnAddress

import com.facebook.stetho.common.LogUtil; //导入依赖的package包/类
private void listenOnAddress(String address) throws IOException {
  mServerSocket = bindToSocket(address);
  LogUtil.i("Listening on @" + address);

  while (!Thread.interrupted()) {
    try {
      // Use previously accepted socket the first time around, otherwise wait to
      // accept another.
      LocalSocket socket = mServerSocket.accept();

      // Start worker thread
      Thread t = new WorkerThread(socket, mSocketHandler);
      t.setName(
          WORKER_THREAD_NAME_PREFIX +
          "-" + mFriendlyName +
          "-" + mThreadId.incrementAndGet());
      t.setDaemon(true);
      t.start();
    } catch (SocketException se) {
      // ignore exception if interrupting the thread
      if (Thread.interrupted()) {
        break;
      }
      LogUtil.w(se, "I/O error");
    } catch (InterruptedIOException ex) {
      break;
    } catch (IOException e) {
      LogUtil.w(e, "I/O error initialising connection thread");
      break;
    }
  }

  LogUtil.i("Server shutdown on @" + address);
}
 
开发者ID:facebook,项目名称:stetho,代码行数:35,代码来源:LocalSocketServer.java

示例12: run

import com.facebook.stetho.common.LogUtil; //导入依赖的package包/类
@Override
public void run() {
  try {
    mSocketHandler.onAccepted(mSocket);
  } catch (IOException ex) {
    LogUtil.w("I/O error: %s", ex);
  } finally {
    try {
      mSocket.close();
    } catch (IOException ignore) {
    }
  }
}
 
开发者ID:facebook,项目名称:stetho,代码行数:14,代码来源:LocalSocketServer.java

示例13: startServer

import com.facebook.stetho.common.LogUtil; //导入依赖的package包/类
private void startServer(final LocalSocketServer server) {
  Thread listener = new Thread(THREAD_PREFIX + "-" + server.getName()) {
    @Override
    public void run() {
      try {
        server.run();
      } catch (IOException e) {
        LogUtil.e(e, "Could not start Stetho server: %s", server.getName());
      }
    }
  };
  listener.start();
}
 
开发者ID:facebook,项目名称:stetho,代码行数:14,代码来源:ServerManager.java

示例14: onAccepted

import com.facebook.stetho.common.LogUtil; //导入依赖的package包/类
@Override
public final void onAccepted(LocalSocket socket) throws IOException {
  try {
    enforcePermission(mContext, socket);
    onSecured(socket);
  } catch (PeerAuthorizationException e) {
    LogUtil.e("Unauthorized request: " + e.getMessage());
  }
}
 
开发者ID:facebook,项目名称:stetho,代码行数:10,代码来源:SecureSocketHandler.java

示例15: getIdStringQuietly

import com.facebook.stetho.common.LogUtil; //导入依赖的package包/类
@Nonnull
public static String getIdStringQuietly(Object idContext, @Nullable Resources r, int resourceId) {
  try {
    return getIdString(r, resourceId);
  } catch (Resources.NotFoundException e) {
    String idString = getFallbackIdString(resourceId);
    LogUtil.w("Unknown identifier encountered on " + idContext + ": " + idString);
    return idString;
  }
}
 
开发者ID:facebook,项目名称:stetho,代码行数:11,代码来源:ResourcesUtil.java


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