Java Code Examples for com.android.utils.ILogger#verbose()

The following examples show how to use com.android.utils.ILogger#verbose() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MergingReport.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * dumps all logging records to a logger.
 */
public void log(ILogger logger) {
    for (Record record : mRecords) {
        switch(record.mSeverity) {
            case WARNING:
                logger.warning(record.toString());
                break;
            case ERROR:
                logger.error(null /* throwable */, record.toString());
                break;
            case INFO:
                logger.verbose(record.toString());
                break;
            default:
                logger.error(null /* throwable */, "Unhandled record type " + record.mSeverity);
        }
    }
    mActions.log(logger);
}
 
Example 2
Source File: CircleDependencyCheck.java    From atlas with Apache License 2.0 6 votes vote down vote up
/**
 * Fill a dependent tree
 * @param logger
 * @param node
 * @param dependenciesMap
 * @param identifierMap
 * @param indent
 */
private void fillDepenciesMap(ILogger logger, DependencyNode node, Multimap<String, String> dependenciesMap,
                              Map<String, String> identifierMap, int indent) {
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < indent; i++) {
        sb.append(" ");
    }
    sb.append(node.name);
    if (null != logger) {
        logger.verbose(sb.toString());
    }

    dependenciesMap.put(node.name, node.identifier);
    identifierMap.put(node.identifier, node.name);
    for (DependencyNode child : node.children) {
        fillDepenciesMap(logger, child, dependenciesMap, identifierMap, indent + 1);
    }
}
 
Example 3
Source File: MergingReport.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * dumps all logging records to a logger.
 */
public void log(ILogger logger) {
    for (Record record : mRecords) {
        switch(record.mSeverity) {
            case WARNING:
                logger.warning(record.toString());
                break;
            case ERROR:
                logger.error(null /* throwable */, record.toString());
                break;
            case INFO:
                logger.verbose(record.toString());
                break;
            default:
                logger.error(null /* throwable */, "Unhandled record type " + record.mSeverity);
        }
    }
    mActions.log(logger);

    if (!mResult.isSuccess()) {
        logger.warning("\nSee http://g.co/androidstudio/manifest-merger for more information"
                + " about the manifest merger.\n");
    }
}
 
Example 4
Source File: BuildToolsServiceLoader.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Return the first service instance for the requested service type or
 * {@link Optional#absent()} if none exist.
 *
 * @param logger      to log resolution.
 * @param serviceType the requested service type encapsulation.
 * @param <T>         the requested service class type.
 * @return the instance of T or null of none exist in this context.
 * @throws ClassNotFoundException
 */
@NonNull
public synchronized <T> Optional<T> getSingleService(
        ILogger logger,
        Service<T> serviceType) throws ClassNotFoundException {
    logger.verbose("Looking for %1$s", serviceType);
    ServiceLoader<T> serviceLoader = getServiceLoader(serviceType);
    logger.verbose("Got a serviceLoader %1$d",
            Integer.toHexString(System.identityHashCode(serviceLoader)));
    Iterator<T> serviceIterator = serviceLoader.iterator();
    logger.verbose("Service Iterator =  %1$s ", serviceIterator);
    if (serviceIterator.hasNext()) {
        T service = serviceIterator.next();
        logger.verbose("Got it from %1$s, loaded service = %2$s, type = %3$s",
                serviceIterator, service, service.getClass());
        return Optional.of(service);
    } else {
        logger.info("Cannot find service implementation %1$s" + serviceType);
        return Optional.absent();
    }
}
 
Example 5
Source File: XmlElement.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
private void mergeChild(XmlElement lowerPriorityChild, MergingReport.Builder mergingReport) {

        ILogger logger = mergingReport.getLogger();

        // If this a custom element, we just blindly merge it in.
        if (lowerPriorityChild.getType() == ManifestModel.NodeTypes.CUSTOM) {
            handleCustomElement(lowerPriorityChild, mergingReport);
            return;
        }

        Optional<XmlElement> thisChildOptional =
                getNodeByTypeAndKey(lowerPriorityChild.getType(),lowerPriorityChild.getKey());

        // only in the lower priority document ?
        if (!thisChildOptional.isPresent()) {
            addElement(lowerPriorityChild, mergingReport);
            return;
        }
        // it's defined in both files.
        logger.verbose(lowerPriorityChild.getId() + " defined in both files...");

        XmlElement thisChild = thisChildOptional.get();
        switch (thisChild.getType().getMergeType()) {
            case CONFLICT:
                addMessage(mergingReport, MergingReport.Record.Severity.ERROR, String.format(
                        "Node %1$s cannot be present in more than one input file and it's "
                                + "present at %2$s and %3$s",
                        thisChild.getType(),
                        thisChild.printPosition(),
                        lowerPriorityChild.printPosition()
                ));
                break;
            case ALWAYS:

                // no merging, we consume the lower priority node unmodified.
                // if the two elements are equal, just skip it.

                // but check first that we are not supposed to replace or remove it.
                NodeOperationType operationType =
                        calculateNodeOperationType(thisChild, lowerPriorityChild);
                if (operationType == NodeOperationType.REMOVE ||
                        operationType == NodeOperationType.REPLACE) {
                    mergingReport.getActionRecorder().recordNodeAction(thisChild,
                            Actions.ActionType.REJECTED, lowerPriorityChild);
                    break;
                }

                if (thisChild.getType().areMultipleDeclarationAllowed()) {
                    mergeChildrenWithMultipleDeclarations(lowerPriorityChild, mergingReport);
                } else {
                    if (!thisChild.isEquals(lowerPriorityChild)) {
                        addElement(lowerPriorityChild, mergingReport);
                    }
                }
                break;
            default:
                // 2 nodes exist, some merging need to happen
                handleTwoElementsExistence(thisChild, lowerPriorityChild, mergingReport);
                break;
        }
    }
 
Example 6
Source File: XmlElement.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
private void mergeChild(XmlElement lowerPriorityChild, MergingReport.Builder mergingReport) {

        ILogger logger = mergingReport.getLogger();

        // If this a custom element, we just blindly merge it in.
        if (lowerPriorityChild.getType() == ManifestModel.NodeTypes.CUSTOM) {
            handleCustomElement(lowerPriorityChild, mergingReport);
            return;
        }

        Optional<XmlElement> thisChildOptional =
                getNodeByTypeAndKey(lowerPriorityChild.getType(),lowerPriorityChild.getKey());

        // only in the lower priority document ?
        if (!thisChildOptional.isPresent()) {
            addElement(lowerPriorityChild, mergingReport);
            return;
        }
        // it's defined in both files.
        logger.verbose(lowerPriorityChild.getId() + " defined in both files...");

        XmlElement thisChild = thisChildOptional.get();
        switch (thisChild.getType().getMergeType()) {
            case CONFLICT:
                addMessage(mergingReport, MergingReport.Record.Severity.ERROR, String.format(
                        "Node %1$s cannot be present in more than one input file and it's "
                                + "present at %2$s and %3$s",
                        thisChild.getType(),
                        thisChild.printPosition(),
                        lowerPriorityChild.printPosition()
                ));
                break;
            case ALWAYS:

                // no merging, we consume the lower priority node unmodified.
                // if the two elements are equal, just skip it.

                // but check first that we are not supposed to replace or remove it.
                NodeOperationType operationType =
                        calculateNodeOperationType(thisChild, lowerPriorityChild);
                if (operationType == NodeOperationType.REMOVE ||
                        operationType == NodeOperationType.REPLACE) {
                    mergingReport.getActionRecorder().recordNodeAction(thisChild,
                            Actions.ActionType.REJECTED, lowerPriorityChild);
                    break;
                }

                if (thisChild.getType().areMultipleDeclarationAllowed()) {
                    mergeChildrenWithMultipleDeclarations(lowerPriorityChild, mergingReport);
                } else {
                    if (!thisChild.isEquals(lowerPriorityChild)) {
                        addElement(lowerPriorityChild, mergingReport);
                    }
                }
                break;
            default:
                // 2 nodes exist, some merging need to happen
                handleTwoElementsExistence(thisChild, lowerPriorityChild, mergingReport);
                break;
        }
    }
 
Example 7
Source File: Actions.java    From java-n-IDE-for-Android with Apache License 2.0 2 votes vote down vote up
/**
 * Initial dump of the merging tool actions, need to be refined and spec'ed out properly.
 * @param logger logger to log to at INFO level.
 */
void log(ILogger logger) {
    logger.verbose(getLogs());
}
 
Example 8
Source File: Actions.java    From javaide with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Initial dump of the merging tool actions, need to be refined and spec'ed out properly.
 * @param logger logger to log to at INFO level.
 */
void log(ILogger logger) {
    logger.verbose(getLogs());
}