Java 8 Level - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Level class.

This code example shows how to use the following methods: intValue
     * @param level The {@link java.util.logging.Logger} logging level. 
     * 
     * @return The resulting Android logging level. 
     */ 
    static int getAndroidLevel(Level level) {
        int value = level.intValue();
        if (value >= 1000) { // SEVERE
            return Log.ERROR;
        } else if (value >= 900) { // WARNING
            return Log.WARN;
        } else if (value >= 800) { // INFO
            return Log.INFO;
        } else { 
            return Log.DEBUG;
        } 
    } 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getLocalizedName, intValue
    return buffer.toString();
  } 
 
 
  private String levelNumberToCommonsLevelName(Level level) {
    switch (level.intValue()) {
      case FINE:
        return "DEBUG"; 
      case INFO:
        return "INFO"; 
      case WARNING:
        return "WARN"; 
      case SEVERE:
        return "ERROR"; 
      default: 
        return level.getLocalizedName();
    } 
  } 
 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getLocalizedName, getName
StringBuilder msg = new StringBuilder();
        msg.append(this.dateFormat.format(Long.valueOf(record.getMillis())));
        Level lvl = record.getLevel();
 
        String name = lvl.getLocalizedName();
        if ( name == null )
        { 
            name = lvl.getName();        	
        } 
 
        if ( ( name != null ) && ( name.length() > 0 ) )
        { 
            msg.append(" [" + name + "] ");
        } 
        else 
        { 
            msg.append(" ");
        } 
 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: intValue
 
        @Override 
        public int compare(final Level o1, final Level o2) {
            int result = EQUAL;
            final int left = o1.intValue();
            final int right = o2.intValue();
            if (left < right) {
                result = LESS;
            } else if (left > right) {
                result = GREATER;
            } 
            return result;
        } 
    } 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getName
    private static final SimpleDateFormat FORMAT = new SimpleDateFormat("yyMMdd HH:mm:ss.SSS");
 
    private static Map<Level, String> LEVEL_TO_STRING_CACHE = Maps.newHashMap();
 
    private static final String levelToString(Level level) {
        String levelName = LEVEL_TO_STRING_CACHE.get(level);
        if (levelName == null) {
            levelName = level.getName().substring(0, 1);
            LEVEL_TO_STRING_CACHE.put(level, levelName);
        } 
        return levelName;
    } 
 
    private static String getHeader(LogRecord record) {
        StringBuilder sb = new StringBuilder();
 
        sb.append(FORMAT.format(new Date(record.getMillis()))).append(":");
        sb.append(levelToString(record.getLevel())).append(" ");
 
        sb.append("[").append(Thread.currentThread().getName()).append("] ");
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Java 8 Level Questions & Answers:

See Code Examples for Java 8 Level Methods: