protected int mapLevelToAnt(final Level level) {
    if (Level.CONFIG.equals(level)) return Project.MSG_DEBUG;
    if (Level.FINE.equals(level)) return Project.MSG_VERBOSE;
    if (Level.FINER.equals(level)) return Project.MSG_DEBUG;
    if (Level.FINEST.equals(level)) return Project.MSG_DEBUG;
    if (Level.INFO.equals(level)) return Project.MSG_INFO;
    if (Level.SEVERE.equals(level)) return Project.MSG_ERR;
    if (Level.WARNING.equals(level)) return Project.MSG_WARN;

    return Project.MSG_WARN;
  }
Esempio n. 2
0
    public void publish(LogRecord record) {

      Level level = record.getLevel();
      Throwable throwable = record.getThrown();

      if (Level.SEVERE.equals(level)) {

        if (throwable != null) {
          Log.error(record.getMessage(), throwable);
        } else {
          Log.error(record.getMessage());
        }

      } else if (Level.WARNING.equals(level)) {

        if (throwable != null) {
          Log.warn(record.getMessage(), throwable);
        } else {
          Log.warn(record.getMessage());
        }

      } else if (Level.INFO.equals(level)) {

        if (throwable != null) {
          Log.info(record.getMessage(), throwable);
        } else {
          Log.info(record.getMessage());
        }

      } else {
        // else FINE,FINER,FINEST

        if (throwable != null) {
          Log.debug(record.getMessage(), throwable);
        } else {
          Log.debug(record.getMessage());
        }
      }
    }