本文整理了Java中org.robolectric.util.Logger
类的一些代码示例,展示了Logger
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger
类的具体详情如下:
包路径:org.robolectric.util.Logger
类名称:Logger
[英]Logger for Robolectric. For now, it simply prints messages to stdout. Logging can be enabled by setting the property: robolectric.logging.enabled = true.
[中]机器人分子记录器。现在,它只是将消息打印到stdout。可以通过设置属性:robolectric来启用日志记录。登录中。启用=真。
代码示例来源:origin: robolectric/robolectric
private void log(final String message) {
org.robolectric.util.Logger.debug(message);
}
代码示例来源:origin: robolectric/robolectric
public CachedMavenDependencyResolver() {
// cacheDir bumped to 'robolectric-2' to invalidate caching of bad URLs on windows prior
// to fix for https://github.com/robolectric/robolectric/issues/3955
File cacheDir = new File(new File(System.getProperty("java.io.tmpdir")), "robolectric-2");
DependencyResolver dependencyResolver = new MavenDependencyResolver();
if (cacheDir.exists() || cacheDir.mkdir()) {
Logger.info("Dependency cache location: %s", cacheDir.getAbsolutePath());
this.delegate = new CachedDependencyResolver(dependencyResolver, cacheDir,
60 * 60 * 24 * 1000);
} else {
this.delegate = dependencyResolver;
}
}
代码示例来源:origin: robolectric/robolectric
private void strictError(String message, Object... args) {
if (strictErrors) {
throw new RuntimeException(String.format(message, args));
} else {
Logger.strict(message, args);
}
}
代码示例来源:origin: robolectric/robolectric
public TypedResource pick(ResName resName, ResTable_config toMatch) {
List<TypedResource> values = map.get(resName);
if (values == null || values.size() == 0) return null;
TypedResource bestMatchSoFar = null;
for (TypedResource candidate : values) {
ResTable_config candidateConfig = candidate.getConfig();
if (candidateConfig.match(toMatch)) {
if (bestMatchSoFar == null || candidateConfig.isBetterThan(bestMatchSoFar.getConfig(), toMatch)) {
bestMatchSoFar = candidate;
}
}
}
if (Logger.loggingEnabled()) {
Logger.debug("Picked '%s' for %s for qualifiers '%s' (%d candidates)",
bestMatchSoFar == null ? "<none>" : bestMatchSoFar.getXmlContext().getQualifiers().toString(),
resName.getFullyQualifiedName(),
toMatch,
values.size());
}
return bestMatchSoFar;
}
代码示例来源:origin: robospock/RoboSpock
Logger.error("Field 'constants' not specified in @Config annotation");
Logger.error("This is required when using RobolectricGradleTestRunner!");
throw new RuntimeException("No 'constants' field in @Config annotation!");
Logger.debug("Robolectric assets directory: " + assets.getPath());
Logger.debug(" Robolectric res directory: " + res.getPath());
Logger.debug(" Robolectric manifest path: " + manifest.getPath());
Logger.debug(" Robolectric package name: " + packageName);
return new AndroidManifest(manifest, res, assets, packageName);
代码示例来源:origin: robolectric/robolectric
private static Implementation getImplementationAnnotation(Method method) {
if (method == null) {
return null;
}
Implementation implementation = method.getAnnotation(Implementation.class);
if (implementation == null) {
Logger.warn("No @Implementation annotation on " + method);
}
return implementation == null
? IMPLEMENTATION_DEFAULTS
: implementation;
}
代码示例来源:origin: robolectric/robolectric
/**
* Log a warning message.
*
* @param message Message text.
* @param args Message arguments.
*/
public static void warn(String message, Object... args) {
if (loggingEnabled()) {
System.out.print("WARN: ");
System.out.println(String.format(message, args));
}
}
代码示例来源:origin: ACRA/acra
@Override
public int e(String tag, String msg) {
Logger.error(msg.replace("%","%%"));
return 0;
}
代码示例来源:origin: org.robolectric/resources
public TypedResource pick(ResName resName, ResTable_config toMatch) {
List<TypedResource> values = map.get(resName);
if (values == null || values.size() == 0) return null;
TypedResource bestMatchSoFar = null;
for (TypedResource candidate : values) {
ResTable_config candidateConfig = candidate.getConfig();
if (candidateConfig.match(toMatch)) {
if (bestMatchSoFar == null || candidateConfig.isBetterThan(bestMatchSoFar.getConfig(), toMatch)) {
bestMatchSoFar = candidate;
}
}
}
if (Logger.loggingEnabled()) {
Logger.debug("Picked '%s' for %s for qualifiers '%s' (%d candidates)",
bestMatchSoFar == null ? "<none>" : bestMatchSoFar.getXmlContext().getQualifiers().toString(),
resName.getFullyQualifiedName(),
toMatch,
values.size());
}
return bestMatchSoFar;
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Override
protected AndroidManifest getAppManifest(Config config) {
final String cwd = System.getProperty("user.dir");
Logger.debug("Current working directory: " + cwd);
Logger.error("Field 'constants' not specified in @Config annotation");
Logger.error("This is required when using RobolectricGradleTestRunner!");
throw new RuntimeException("No 'constants' field in @Config annotation!");
Logger.debug("Robolectric assets directory: " + assets.getPath());
Logger.debug(" Robolectric res directory: " + res.getPath());
Logger.debug(" Robolectric manifest path: " + manifest.getPath());
Logger.debug(" Robolectric package name: " + packageName);
return new AndroidManifest(manifest, res, assets, packageName);
代码示例来源:origin: ACRA/acra
@Override
public int w(String tag, Throwable tr) {
Logger.warn("", tr);
return 0;
}
代码示例来源:origin: robolectric/robolectric
/**
* Log a debug message.
*
* @param message Message text.
* @param args Message arguments.
*/
public static void debug(String message, Object... args) {
if (loggingEnabled()) {
System.out.print("DEBUG: ");
System.out.println(String.format(message, args));
}
}
代码示例来源:origin: ACRA/acra
@Override
public int e(String tag, String msg, Throwable tr) {
Logger.error(msg.replace("%","%%"), tr);
return 0;
}
代码示例来源:origin: ACRA/acra
@Override
public int v(String tag, String msg, Throwable tr) {
Logger.debug(msg.replace("%","%%"), tr);
return 0;
}
代码示例来源:origin: ACRA/acra
@Override
public int i(String tag, String msg, Throwable tr) {
Logger.info(msg.replace("%","%%"), tr);
return 0;
}
代码示例来源:origin: robolectric/robolectric
private static URL[] parseJavaClassPath() {
ImmutableList.Builder<URL> urls = ImmutableList.builder();
for (String entry : Splitter.on(PATH_SEPARATOR.value()).split(JAVA_CLASS_PATH.value())) {
try {
try {
urls.add(new File(entry).toURI().toURL());
} catch (SecurityException e) { // File.toURI checks to see if the file is a directory
urls.add(new URL("file", null, new File(entry).getAbsolutePath()));
}
} catch (MalformedURLException e) {
Logger.strict("malformed classpath entry: " + entry, e);
}
}
return urls.build().toArray(new URL[0]);
}
代码示例来源:origin: ACRA/acra
@Override
public int w(String tag, String msg) {
Logger.warn(msg.replace("%","%%"));
return 0;
}
代码示例来源:origin: robolectric/robolectric
/**
* Log an info message.
*
* @param message Message text.
* @param args Message arguments.
*/
public static void info(String message, Object... args) {
if (loggingEnabled()) {
System.out.print("INFO: ");
System.out.println(String.format(message, args));
}
}
代码示例来源:origin: ACRA/acra
@Override
public int d(String tag, String msg) {
Logger.debug(msg.replace("%","%%"));
return 0;
}
代码示例来源:origin: ACRA/acra
@Override
public int i(String tag, String msg) {
Logger.info(msg.replace("%","%%"));
return 0;
}
内容来源于网络,如有侵权,请联系作者删除!