org.gradle.api.logging.Logger.isWarnEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(205)

本文整理了Java中org.gradle.api.logging.Logger.isWarnEnabled()方法的一些代码示例,展示了Logger.isWarnEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.isWarnEnabled()方法的具体详情如下:
包路径:org.gradle.api.logging.Logger
类名称:Logger
方法名:isWarnEnabled

Logger.isWarnEnabled介绍

暂无

代码示例

代码示例来源:origin: com.liferay/com.liferay.gradle.plugins.node

private void _npmCacheVerify() {
  Logger logger = getLogger();
  try {
    _npmCacheVerify = true;
    super.executeNode();
  }
  catch (Exception e) {
    if (logger.isWarnEnabled()) {
      String message = "Unable to run \"npm cache verify\"";
      if (Validator.isNotNull(e.getMessage())) {
        message = e.getMessage() + ". " + message;
      }
      logger.warn(message);
    }
  }
  finally {
    _npmCacheVerify = false;
  }
}

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-node

private void _npmCacheVerify() {
  Logger logger = getLogger();
  try {
    _npmCacheVerify = true;
    super.executeNode();
  }
  catch (Exception e) {
    if (logger.isWarnEnabled()) {
      String message = "Unable to run \"npm cache verify\"";
      if (Validator.isNotNull(e.getMessage())) {
        message = e.getMessage() + ". " + message;
      }
      logger.warn(message);
    }
  }
  finally {
    _npmCacheVerify = false;
  }
}

代码示例来源:origin: steffenschaefer/gwt-gradle-plugin

private LogLevel getLogLevel() {
  if(logger.isTraceEnabled()) {
    return LogLevel.TRACE;
  } else if(logger.isDebugEnabled()) {
    return LogLevel.DEBUG;
  } else if(logger.isInfoEnabled()) {
    return LogLevel.INFO;
  } else if(logger.isLifecycleEnabled() || logger.isWarnEnabled()) {
    return LogLevel.WARN;
  }
  // QUIET or ERROR
  return LogLevel.ERROR;
}

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-lang-builder

private List<String> _getCompleteArgs() {
  List<String> args = new ArrayList<>(getArgs());
  args.add(
    "lang.dir=" + FileUtil.relativize(getLangDir(), getWorkingDir()));
  args.add(
    "lang.excluded.language.ids=" +
      StringUtil.merge(getExcludedLanguageIds(), ","));
  args.add("lang.file=" + getLangFileName());
  args.add("lang.title.capitalization=" + isTitleCapitalization());
  boolean translate = isTranslate();
  if (translate) {
    String translateSubscriptionKey = getTranslateSubscriptionKey();
    if (Validator.isNull(translateSubscriptionKey)) {
      if (_logger.isWarnEnabled()) {
        _logger.warn(
          "Translation is disabled because credentials are not " +
            "specified");
      }
      translate = false;
    }
    else {
      args.add(
        "lang.translate.subscription.key=" +
          translateSubscriptionKey);
    }
  }
  args.add("lang.translate=" + translate);
  return args;
}

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-node

private static String _getNodeModulesCacheDigest(
  NpmInstallTask npmInstallTask) {
  Logger logger = npmInstallTask.getLogger();
  JsonSlurper jsonSlurper = new JsonSlurper();
  File jsonFile = npmInstallTask.getPackageLockJsonFile();
  if (jsonFile == null) {
    if (logger.isInfoEnabled()) {
      logger.info(
        "Unable to find package-lock.json for {}, using " +
          "npm-shrinkwrap.json instead",
        npmInstallTask.getProject());
    }
    jsonFile = npmInstallTask.getShrinkwrapJsonFile();
  }
  if (jsonFile == null) {
    if (logger.isWarnEnabled()) {
      logger.warn(
        "Unable to find npm-shrinkwrap.json for {}, using " +
          "package.json instead",
        npmInstallTask.getProject());
    }
    jsonFile = npmInstallTask.getPackageJsonFile();
  }
  Map<String, Object> map = (Map<String, Object>)jsonSlurper.parse(
    jsonFile);
  map.remove("name");
  map.remove("version");
  return String.valueOf(map.hashCode());
}

代码示例来源:origin: com.liferay/com.liferay.gradle.plugins.node

private static String _getNodeModulesCacheDigest(
  NpmInstallTask npmInstallTask) {
  Logger logger = npmInstallTask.getLogger();
  JsonSlurper jsonSlurper = new JsonSlurper();
  File jsonFile = npmInstallTask.getPackageLockJsonFile();
  if (jsonFile == null) {
    if (logger.isInfoEnabled()) {
      logger.info(
        "Unable to find package-lock.json for {}, using " +
          "npm-shrinkwrap.json instead",
        npmInstallTask.getProject());
    }
    jsonFile = npmInstallTask.getShrinkwrapJsonFile();
  }
  if (jsonFile == null) {
    if (logger.isWarnEnabled()) {
      logger.warn(
        "Unable to find npm-shrinkwrap.json for {}, using " +
          "package.json instead",
        npmInstallTask.getProject());
    }
    jsonFile = npmInstallTask.getPackageJsonFile();
  }
  Map<String, Object> map = (Map<String, Object>)jsonSlurper.parse(
    jsonFile);
  map.remove("name");
  map.remove("version");
  return String.valueOf(map.hashCode());
}

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-node

@Override
public String call() throws Exception {
  String logLevel = null;
  Logger logger = getLogger();
  if (logger.isTraceEnabled()) {
    logLevel = "silly";
  }
  else if (logger.isDebugEnabled()) {
    logLevel = "verbose";
  }
  else if (logger.isInfoEnabled()) {
    logLevel = "info";
  }
  else if (logger.isWarnEnabled()) {
    logLevel = "warn";
  }
  else if (logger.isErrorEnabled()) {
    logLevel = "error";
  }
  return logLevel;
}

代码示例来源:origin: com.liferay/com.liferay.gradle.plugins.node

@Override
public String call() throws Exception {
  String logLevel = null;
  Logger logger = getLogger();
  if (logger.isTraceEnabled()) {
    logLevel = "silly";
  }
  else if (logger.isDebugEnabled()) {
    logLevel = "verbose";
  }
  else if (logger.isInfoEnabled()) {
    logLevel = "info";
  }
  else if (logger.isWarnEnabled()) {
    logLevel = "warn";
  }
  else if (logger.isErrorEnabled()) {
    logLevel = "error";
  }
  return logLevel;
}

代码示例来源:origin: com.liferay/com.liferay.gradle.plugins.node

private void _npmInstall(boolean reset) throws Exception {
  Logger logger = getLogger();
  int npmInstallRetries = getNpmInstallRetries();
  Project project = getProject();
  for (int i = 0; i < (npmInstallRetries + 1); i++) {
    if (reset || (i > 0)) {
      project.delete(getNodeModulesDir());
    }
    try {
      super.executeNode();
      break;
    }
    catch (IOException ioe) {
      if (i == npmInstallRetries) {
        throw ioe;
      }
      if (logger.isWarnEnabled()) {
        logger.warn(
          ioe.getMessage() + ". Running \"npm install\" again");
      }
      _npmCacheVerify();
    }
  }
}

代码示例来源:origin: com.liferay/com.liferay.gradle.plugins.node

@TaskAction
public void executeNode() throws Exception {
  int npmInstallRetries = getNpmInstallRetries();
  NpmInstallTask npmInstallTask = GradleUtil.fetchTask(
    getProject(), NodePlugin.NPM_INSTALL_TASK_NAME,
    NpmInstallTask.class);
  if ((this instanceof ExecuteNpmTask) || (npmInstallRetries <= 0) ||
    (npmInstallTask == null)) {
    _result = _nodeExecutor.execute();
    return;
  }
  Logger logger = getLogger();
  for (int i = 1; i <= npmInstallRetries; i++) {
    try {
      _result = _nodeExecutor.execute();
      break;
    }
    catch (IOException ioe) {
      if (i == npmInstallRetries) {
        throw ioe;
      }
      if (logger.isWarnEnabled()) {
        logger.warn(
          ioe.getMessage() + ". Running \"npm install\" again");
      }
      npmInstallTask.executeNpmInstall(true);
    }
  }
}

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-node

@TaskAction
public void executeNode() throws Exception {
  int npmInstallRetries = getNpmInstallRetries();
  NpmInstallTask npmInstallTask = GradleUtil.fetchTask(
    getProject(), NodePlugin.NPM_INSTALL_TASK_NAME,
    NpmInstallTask.class);
  if ((this instanceof ExecuteNpmTask) || (npmInstallRetries <= 0) ||
    (npmInstallTask == null)) {
    _result = _nodeExecutor.execute();
    return;
  }
  Logger logger = getLogger();
  for (int i = 1; i <= npmInstallRetries; i++) {
    try {
      _result = _nodeExecutor.execute();
      break;
    }
    catch (IOException ioe) {
      if (i == npmInstallRetries) {
        throw ioe;
      }
      if (logger.isWarnEnabled()) {
        logger.warn(
          ioe.getMessage() + ". Running \"npm install\" again");
      }
      npmInstallTask.executeNpmInstall(true);
    }
  }
}

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-node

private void _npmInstall(boolean reset) throws Exception {
  Logger logger = getLogger();
  int npmInstallRetries = getNpmInstallRetries();
  Project project = getProject();
  for (int i = 0; i < (npmInstallRetries + 1); i++) {
    if (reset || (i > 0)) {
      project.delete(getNodeModulesDir());
    }
    try {
      super.executeNode();
      break;
    }
    catch (IOException ioe) {
      if (i == npmInstallRetries) {
        throw ioe;
      }
      if (logger.isWarnEnabled()) {
        logger.warn(
          ioe.getMessage() + ". Running \"npm install\" again");
      }
      _npmCacheVerify();
    }
  }
}

代码示例来源:origin: gradle.plugin.com.google.cloud.tools/jib-gradle-plugin

consoleLoggerBuilder.info(logger::info);
if (logger.isWarnEnabled()) {
 consoleLoggerBuilder.warn(logger::warn);

相关文章