Module swim.util
Package swim.util

Class Severity

java.lang.Object
swim.util.Severity
All Implemented Interfaces:
Comparable<Severity>

public final class Severity extends Object implements Comparable<Severity>
Level of importance. Used for log levels and diagnostic classifications.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Severity
    Returns the Severity with ALERT_LEVEL of importance.
    static Severity
    alert(String label)
    Returns a Severity with ALERT_LEVEL of importance, and the given descriptive label.
    int
     
    static Severity
    create(int level, String label)
    Returns a Severity with the given importance level, and descriptive label.
    static Severity
    Returns the Severity with DEBUG_LEVEL of importance.
    static Severity
    debug(String label)
    Returns a Severity with DEBUG_LEVEL of importance, and the given descriptive label.
    boolean
    equals(Object other)
     
    static Severity
    Returns the Severity with ERROR_LEVEL of importance.
    static Severity
    error(String label)
    Returns a Severity with ERROR_LEVEL of importance, and the given descriptive label.
    static Severity
    Returns the Severity with FATAL_LEVEL of importance.
    static Severity
    fatal(String label)
    Returns a Severity with FATAL_LEVEL of importance, and the given descriptive label.
    static Severity
    from(int level)
    Returns the Severity with the given importance level.
    int
     
    static Severity
    Returns the Severity with INFO_LEVEL of importance.
    static Severity
    info(String label)
    Returns a Severity with INFO_LEVEL of importance, and the given descriptive label.
    boolean
    Returns true if this Severity has ALERT_LEVEL of importance.
    boolean
    Returns true if this Severity has DEBUG_LEVEL of importance.
    boolean
    Returns true if this Severity has ERROR_LEVEL of importance.
    boolean
    Returns true if this Severity has FATAL_LEVEL of importance.
    boolean
    Returns true if this Severity has INFO_LEVEL of importance.
    boolean
    Returns true if this Severity has NOTE_LEVEL of importance.
    boolean
    Returns true if this Severity has TRACE_LEVEL of importance.
    boolean
    Returns true if this Severity has WARNING_LEVEL of importance.
    Returns a descriptive label for this Severity.
    label(String label)
    Returns a new Severity with the same level as this Severity, but with a new descriptive label.
    int
    Returns the integer level of importance of this Severity, with higher levels signifying greater importance.
    static Severity
    Returns the Severity with NOTE_LEVEL of importance.
    static Severity
    note(String label)
    Returns a Severity with NOTE_LEVEL of importance, and the given descriptive label.
     
    static Severity
    Returns the Severity with TRACE_LEVEL of importance.
    static Severity
    trace(String label)
    Returns a Severity with TRACE_LEVEL of importance, and the given descriptive label.
    static Severity
    Returns the Severity with WARNING_LEVEL of importance.
    static Severity
    warning(String label)
    Returns a Severity with WARNING_LEVEL of importance, and the given descriptive label.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Method Details

    • level

      public int level()
      Returns the integer level of importance of this Severity, with higher levels signifying greater importance.
      Returns:
      an integer between 0 and 7, inclusive. One of TRACE_LEVEL, DEBUG_LEVEL, INFO_LEVEL, NOTE_LEVEL, WARNING_LEVEL, ERROR_LEVEL, ALERT_LEVEL, or FATAL_LEVEL.
    • label

      public String label()
      Returns a descriptive label for this Severity.
    • label

      public Severity label(String label)
      Returns a new Severity with the same level as this Severity, but with a new descriptive label.
    • isTrace

      public boolean isTrace()
      Returns true if this Severity has TRACE_LEVEL of importance.
    • isDebug

      public boolean isDebug()
      Returns true if this Severity has DEBUG_LEVEL of importance.
    • isInfo

      public boolean isInfo()
      Returns true if this Severity has INFO_LEVEL of importance.
    • isNote

      public boolean isNote()
      Returns true if this Severity has NOTE_LEVEL of importance.
    • isWarning

      public boolean isWarning()
      Returns true if this Severity has WARNING_LEVEL of importance.
    • isError

      public boolean isError()
      Returns true if this Severity has ERROR_LEVEL of importance.
    • isAlert

      public boolean isAlert()
      Returns true if this Severity has ALERT_LEVEL of importance.
    • isFatal

      public boolean isFatal()
      Returns true if this Severity has FATAL_LEVEL of importance.
    • compareTo

      public int compareTo(Severity that)
      Specified by:
      compareTo in interface Comparable<Severity>
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • create

      public static Severity create(int level, String label)
      Returns a Severity with the given importance level, and descriptive label.
      Throws:
      IllegalArgumentException - if level is not a valid level of importance.
    • from

      public static Severity from(int level)
      Returns the Severity with the given importance level.
      Throws:
      IllegalArgumentException - if level is not a valid level of importance.
    • trace

      public static Severity trace()
      Returns the Severity with TRACE_LEVEL of importance.
    • trace

      public static Severity trace(String label)
      Returns a Severity with TRACE_LEVEL of importance, and the given descriptive label.
    • debug

      public static Severity debug()
      Returns the Severity with DEBUG_LEVEL of importance.
    • debug

      public static Severity debug(String label)
      Returns a Severity with DEBUG_LEVEL of importance, and the given descriptive label.
    • info

      public static Severity info()
      Returns the Severity with INFO_LEVEL of importance.
    • info

      public static Severity info(String label)
      Returns a Severity with INFO_LEVEL of importance, and the given descriptive label.
    • note

      public static Severity note()
      Returns the Severity with NOTE_LEVEL of importance.
    • note

      public static Severity note(String label)
      Returns a Severity with NOTE_LEVEL of importance, and the given descriptive label.
    • warning

      public static Severity warning()
      Returns the Severity with WARNING_LEVEL of importance.
    • warning

      public static Severity warning(String label)
      Returns a Severity with WARNING_LEVEL of importance, and the given descriptive label.
    • error

      public static Severity error()
      Returns the Severity with ERROR_LEVEL of importance.
    • error

      public static Severity error(String label)
      Returns a Severity with ERROR_LEVEL of importance, and the given descriptive label.
    • alert

      public static Severity alert()
      Returns the Severity with ALERT_LEVEL of importance.
    • alert

      public static Severity alert(String label)
      Returns a Severity with ALERT_LEVEL of importance, and the given descriptive label.
    • fatal

      public static Severity fatal()
      Returns the Severity with FATAL_LEVEL of importance.
    • fatal

      public static Severity fatal(String label)
      Returns a Severity with FATAL_LEVEL of importance, and the given descriptive label.