本文整理匯總了Java中org.apache.maven.plugin.logging.Log.isInfoEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java Log.isInfoEnabled方法的具體用法?Java Log.isInfoEnabled怎麽用?Java Log.isInfoEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.maven.plugin.logging.Log
的用法示例。
在下文中一共展示了Log.isInfoEnabled方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testLog
import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
public void testLog()
{
Log log = new DependencySilentLog();
String text = new String( "Text" );
Throwable e = new RuntimeException();
log.debug( text );
log.debug( text, e );
log.debug( e );
log.info( text );
log.info( text, e );
log.info( e );
log.warn( text );
log.warn( text, e );
log.warn( e );
log.error( text );
log.error( text, e );
log.error( e );
log.isDebugEnabled();
log.isErrorEnabled();
log.isWarnEnabled();
log.isInfoEnabled();
}
示例2: download
import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
public boolean download(Log log) throws MojoExecutionException {
isValid(ImmutableMap.of("localRepositoryDirectory", localRepositoryDirectory, "repositoryUrl", repositoryUrl));
boolean downloaded = false;
File localPath = new File(getFile(localRepositoryDirectory).getAbsolutePath(), getLocalPath());
File localPathSha1 = new File(getFile(localRepositoryDirectory).getAbsolutePath(), getLocalPath() + SUFFIX_SHA1);
if (localPath.exists() && localPathSha1.exists()) {
if (!assertSha1(log, localPath, localPathSha1, true)) {
localPath.delete();
localPathSha1.delete();
}
} else if (localPath.exists() && !localPathSha1.exists()) {
localPath.delete();
} else if (!localPath.exists() && localPathSha1.exists()) {
localPathSha1.delete();
}
if (!localPath.exists() && !localPathSha1.exists()) {
if (log.isInfoEnabled()) {
log.info("Downloading: " + getRemoteUrl(repositoryUrl));
}
try {
String remoteUrl = getRemoteUrl(repositoryUrl);
String remoteUrlSha1 = getRemoteUrl(repositoryUrl) + SUFFIX_SHA1;
long time = System.currentTimeMillis();
if (downloaded = downloadHttpResource(log, remoteUrl, localPath) && downloadHttpResource(log, remoteUrlSha1, localPathSha1)) {
if (!(downloaded = assertSha1(log, localPath, localPathSha1, true))) {
localPath.delete();
localPathSha1.delete();
throw new MojoExecutionException("Downloaded file from [" + remoteUrl + "] failed to match checksum [" + remoteUrlSha1 + "]");
}
if (log.isInfoEnabled()) {
log.info(
"Downloaded: " + remoteUrl + " (" + FileUtils.byteCountToDisplaySize(localPath.length() + localPathSha1.length()) + " at "
+ String.format("%.2f", (localPath.length() + localPathSha1.length()) / ((System.currentTimeMillis() - time) * 1000D))
+ " MB/sec)");
}
}
} catch (Exception exception) {
if (log.isDebugEnabled()) {
log.debug("Error encountered downlaoding parcel [" + getArtifactName() + "]", exception);
}
}
if (!downloaded) {
throw new MojoExecutionException("Could not find parcel [" + getArtifactName() + "] in remote repositories, "
+ "see above for download attemps and try a mvn -X invocation for DEBUG logs showing transport exceptions");
}
}
return downloaded;
}