Enum Class LogLevel

java.lang.Object
java.lang.Enum<LogLevel>
org.daiitech.naftah.playground.utils.logging.LogLevel
All Implemented Interfaces:
Serializable, Comparable<LogLevel>, Constable

public enum LogLevel extends Enum<LogLevel>
Defines the logging levels supported by the playground logging system.

Levels are ordered by severity, from ERROR (highest severity) to TRACE (most verbose). Each level is associated with a numeric rank used to determine whether a log message should be emitted.

For example, a logger configured with INFO will allow ERROR, WARN, and INFO messages, but will suppress DEBUG and TRACE messages.

Author:
Chakib Daii
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Logs detailed diagnostic information useful during development and troubleshooting.
    Logs only error conditions that prevent normal operation.
    Logs general informational messages about application behavior.
    Logs the most detailed execution information available.
    Logs warning conditions that may indicate a problem but do not prevent execution.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) final int
    Internal rank used to compare logging levels.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    LogLevel(int rank)
    Creates a logging level with the specified rank.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Determines whether this logging level permits messages of the specified level.
    static LogLevel
    Converts a string representation into a LogLevel.
    static LogLevel
    Returns the enum constant of this class with the specified name.
    static LogLevel[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • ERROR

      public static final LogLevel ERROR
      Logs only error conditions that prevent normal operation.
    • WARN

      public static final LogLevel WARN
      Logs warning conditions that may indicate a problem but do not prevent execution.
    • INFO

      public static final LogLevel INFO
      Logs general informational messages about application behavior.
    • DEBUG

      public static final LogLevel DEBUG
      Logs detailed diagnostic information useful during development and troubleshooting.
    • TRACE

      public static final LogLevel TRACE
      Logs the most detailed execution information available.
  • Field Details

    • rank

      final int rank
      Internal rank used to compare logging levels.
  • Constructor Details

    • LogLevel

      private LogLevel(int rank)
      Creates a logging level with the specified rank.
      Parameters:
      rank - the numeric rank associated with the level
  • Method Details

    • values

      public static LogLevel[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static LogLevel valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • allows

      public boolean allows(LogLevel other)
      Determines whether this logging level permits messages of the specified level.

      A level allows itself and all levels with higher severity.

      Parameters:
      other - the message level to evaluate
      Returns:
      true if messages at other level should be logged; false otherwise
    • fromString

      public static LogLevel fromString(String s)
      Converts a string representation into a LogLevel.

      The comparison is case-insensitive. If the supplied value is null, empty, or does not correspond to a valid logging level, INFO is returned.

      Parameters:
      s - the string representation of the log level
      Returns:
      the corresponding LogLevel, or INFO if the input is invalid