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


Java LogUtil.e方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: onGetStyles

import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
@Override
protected void onGetStyles(View element, String ruleName, StyleAccumulator accumulator) {
    if (VIEW_STYLE_RULE_NAME.equals(ruleName)) {
        List<ViewCSSProperty> properties = getViewProperties();
        for (int i = 0, size = properties.size(); i < size; i++) {
            ViewCSSProperty property = properties.get(i);
            try {
                getStyleFromValue(
                        element,
                        property.getCSSName(),
                        property.getValue(element),
                        property.getAnnotation(),
                        accumulator);
            } catch (Exception e) {
                if (e instanceof IllegalAccessException || e instanceof InvocationTargetException) {
                    LogUtil.e(e, "failed to get style property " + property.getCSSName() +
                            " of element= " + element.toString());
                } else {
                    throw ExceptionUtil.propagate(e);
                }
            }
        }
    } else if (ACCESSIBILITY_STYLE_RULE_NAME.equals(ruleName)) {
        if (sHasSupportNodeInfo) {
            boolean ignored = AccessibilityNodeInfoWrapper.getIgnored(element);
            getStyleFromValue(
                    element,
                    "ignored",
                    ignored,
                    null,
                    accumulator);

            if (ignored) {
                getStyleFromValue(
                        element,
                        "ignored-reasons",
                        AccessibilityNodeInfoWrapper.getIgnoredReasons(element),
                        null,
                        accumulator);
            }

            getStyleFromValue(
                    element,
                    "focusable",
                    !ignored,
                    null,
                    accumulator);

            if (!ignored) {
                getStyleFromValue(
                        element,
                        "focusable-reasons",
                        AccessibilityNodeInfoWrapper.getFocusableReasons(element),
                        null,
                        accumulator);

                getStyleFromValue(
                        element,
                        "focused",
                        AccessibilityNodeInfoWrapper.getIsAccessibilityFocused(element),
                        null,
                        accumulator);

                getStyleFromValue(
                        element,
                        "description",
                        AccessibilityNodeInfoWrapper.getDescription(element),
                        null,
                        accumulator);

                getStyleFromValue(
                        element,
                        "actions",
                        AccessibilityNodeInfoWrapper.getActions(element),
                        null,
                        accumulator);
            }
        }
    }
}
 
开发者ID:nekocode,项目名称:ResourceInspector,代码行数:81,代码来源:RIViewDescriptor.java

示例5: getStylesFromObject

import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
private void getStylesFromObject(
        View view,
        String name,
        Object value,
        @Nullable ViewDebug.ExportedProperty annotation,
        StyleAccumulator styles) {
    if (annotation == null || !annotation.deepExport() || value == null) {
        return;
    }

    Field[] fields = value.getClass().getFields();

    for (Field field : fields) {
        int modifiers = field.getModifiers();
        if (Modifier.isStatic(modifiers)) {
            continue;
        }

        Object propertyValue;
        try {
            field.setAccessible(true);
            propertyValue = field.get(value);
        } catch (IllegalAccessException e) {
            LogUtil.e(
                    e,
                    "failed to get property of name: \"" + name + "\" of object: " + String.valueOf(value));
            return;
        }

        String propertyName = field.getName();

        switch (propertyName) {
            case "bottomMargin":
                propertyName = "margin-bottom";
                break;
            case "topMargin":
                propertyName = "margin-top";
                break;
            case "leftMargin":
                propertyName = "margin-left";
                break;
            case "rightMargin":
                propertyName = "margin-right";
                break;
            default:
                String annotationPrefix = annotation.prefix();
                propertyName = convertViewPropertyNameToCSSName(
                        (annotationPrefix == null) ? propertyName : (annotationPrefix + propertyName));
                break;
        }

        ViewDebug.ExportedProperty subAnnotation =
                field.getAnnotation(ViewDebug.ExportedProperty.class);

        getStyleFromValue(
                view,
                propertyName,
                propertyValue,
                subAnnotation,
                styles);
    }
}
 
开发者ID:nekocode,项目名称:ResourceInspector,代码行数:63,代码来源:RIViewDescriptor.java

示例6: createShadowDocumentUpdate

import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
private ShadowDocument.Update createShadowDocumentUpdate() {
  verifyThreadAccess();

  if (mDocumentProvider.getRootElement() != mShadowDocument.getRootElement()) {
    throw new IllegalStateException();
  }

  ArrayListAccumulator<Object> childrenAccumulator = acquireChildrenAccumulator();

  ShadowDocument.UpdateBuilder updateBuilder = mShadowDocument.beginUpdate();
  mCachedUpdateQueue.add(mDocumentProvider.getRootElement());

  while (!mCachedUpdateQueue.isEmpty()) {
    final Object element = mCachedUpdateQueue.remove();
    NodeDescriptor descriptor = mDocumentProvider.getNodeDescriptor(element);
    mObjectIdMapper.putObject(element);
    descriptor.getChildren(element, childrenAccumulator);

    for (int i = 0, size = childrenAccumulator.size(); i < size; ++i) {
      Object child = childrenAccumulator.get(i);
      if (child != null) {
        mCachedUpdateQueue.add(child);
      } else {
        // This could be indicative of a bug in Stetho code, but could also be caused by a
        // custom element of some kind, e.g. ViewGroup. Let's not allow it to kill the hosting
        // app.
        LogUtil.e(
            "%s.getChildren() emitted a null child at position %s for element %s",
            descriptor.getClass().getName(),
            Integer.toString(i),
            element);

        childrenAccumulator.remove(i);
        --i;
        --size;
      }
    }

    updateBuilder.setElementChildren(element, childrenAccumulator);
    childrenAccumulator.clear();
  }

  releaseChildrenAccumulator(childrenAccumulator);

  return updateBuilder.build();
}
 
开发者ID:facebook,项目名称:stetho,代码行数:47,代码来源:Document.java

示例7: onGetStyles

import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
@Override
protected void onGetStyles(View element, String ruleName, StyleAccumulator accumulator) {
  if (VIEW_STYLE_RULE_NAME.equals(ruleName)) {
    List<ViewCSSProperty> properties = getViewProperties();
    for (int i = 0, size = properties.size(); i < size; i++) {
      ViewCSSProperty property = properties.get(i);
      try {
        getStyleFromValue(
            element,
            property.getCSSName(),
            property.getValue(element),
            property.getAnnotation(),
            accumulator);
      } catch (Exception e) {
        if (e instanceof IllegalAccessException || e instanceof InvocationTargetException) {
          LogUtil.e(e, "failed to get style property " + property.getCSSName() +
                  " of element= " + element.toString());
        } else {
          throw ExceptionUtil.propagate(e);
        }
      }
    }
  } else if (ACCESSIBILITY_STYLE_RULE_NAME.equals(ruleName)) {
    if (sHasSupportNodeInfo) {
      boolean ignored = AccessibilityNodeInfoWrapper.getIgnored(element);
      getStyleFromValue(
          element,
          "ignored",
          ignored,
          null,
          accumulator);

      if (ignored) {
        getStyleFromValue(
            element,
            "ignored-reasons",
            AccessibilityNodeInfoWrapper.getIgnoredReasons(element),
            null,
            accumulator);
      }

      getStyleFromValue(
          element,
          "focusable",
          !ignored,
          null,
          accumulator);

      if (!ignored) {
        getStyleFromValue(
            element,
            "focusable-reasons",
            AccessibilityNodeInfoWrapper.getFocusableReasons(element),
            null,
            accumulator);

        getStyleFromValue(
            element,
            "focused",
            AccessibilityNodeInfoWrapper.getIsAccessibilityFocused(element),
            null,
            accumulator);

        getStyleFromValue(
            element,
            "description",
            AccessibilityNodeInfoWrapper.getDescription(element),
            null,
            accumulator);

        getStyleFromValue(
            element,
            "actions",
            AccessibilityNodeInfoWrapper.getActions(element),
            null,
            accumulator);
      }
    }
  }
}
 
开发者ID:facebook,项目名称:stetho,代码行数:81,代码来源:ViewDescriptor.java

示例8: getStylesFromObject

import com.facebook.stetho.common.LogUtil; //导入方法依赖的package包/类
private void getStylesFromObject(
    View view,
    String name,
    Object value,
    @Nullable ViewDebug.ExportedProperty annotation,
    StyleAccumulator styles) {
  if (annotation == null || !annotation.deepExport() || value == null) {
    return;
  }

  Field[] fields = value.getClass().getFields();

  for (Field field : fields) {
    int modifiers = field.getModifiers();
    if (Modifier.isStatic(modifiers)) {
      continue;
    }

    Object propertyValue;
    try {
        field.setAccessible(true);
        propertyValue = field.get(value);
    } catch (IllegalAccessException e) {
      LogUtil.e(
          e,
          "failed to get property of name: \"" + name + "\" of object: " + String.valueOf(value));
      return;
    }

    String propertyName = field.getName();

    switch (propertyName) {
      case "bottomMargin":
        propertyName = "margin-bottom";
        break;
      case "topMargin":
        propertyName = "margin-top";
        break;
      case "leftMargin":
        propertyName = "margin-left";
        break;
      case "rightMargin":
        propertyName = "margin-right";
        break;
      default:
        String annotationPrefix = annotation.prefix();
        propertyName = convertViewPropertyNameToCSSName(
            (annotationPrefix == null) ? propertyName : (annotationPrefix + propertyName));
        break;
    }

    ViewDebug.ExportedProperty subAnnotation =
        field.getAnnotation(ViewDebug.ExportedProperty.class);

    getStyleFromValue(
        view,
        propertyName,
        propertyValue,
        subAnnotation,
        styles);
  }
}
 
开发者ID:facebook,项目名称:stetho,代码行数:63,代码来源:ViewDescriptor.java


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