package net.acomputerdog.core.logger;

/**
 * Logging levels such as DEBUG, INFO, ERROR, etc.
 */
public enum LogLevel {
    DEBUG("DEBUG", 0, true, false),
    DETAIL("DETAIL", 1, true, false),
    INFO("INFO", 2, false, false),
    WARNING("WARNING", 3, false, false),
    ERROR("ERROR", 4, false, true),
    FATAL("FATAL", 5, false, true),
    STACK("STACK", 6, false, true);

    private String levelName;
    private int priority;
    private boolean isDebug;
    private boolean isError;

    private LogLevel(String levelName, int priority, boolean isDebug, boolean isError) {
        this.levelName = levelName;
        this.priority = priority;
        this.isDebug = isDebug;
        this.isError = isError;
    }

    /**
     * Gets a String representing the name of this logging level.
     *
     * @return Return a String representing the name of this logging level.
     */
    public String getLevelName() {
        return levelName;
    }

    /**
     * Gets an int representing the priority level of this logging level.
     *
     * @return Return an int representing the priority level of this logging level.
     */
    public int getPriority() {
        return priority;
    }

    /**
     * Returns true if this Logging level is a debug level (DEBUG or DETAIL).
     *
     * @return Return true if this Logging level is a debug level
     */
    public boolean isDebug() {
        return isDebug;
    }

    /**
     * Returns true if this logging level is an error level (ERROR or FATAL)
     *
     * @return Return true if this logging level is an error level
     */
    public boolean isError() {
        return isError;
    }

    /**
     * Returns true if this ELogLevel is allowed with the specified priority.
     *
     * @param priority The priority to compare to.
     * @return Returns true if this ELogLevel is allowed with the specified priority.
     */
    public boolean isAllowedBy(int priority) {
        return this.priority >= priority;
    }

    /**
     * Returns true if this ELogLevel is allowed with the specified priority.
     *
     * @param priority The priority to compare to.
     * @return Returns true if this ELogLevel is allowed with the specified priority.
     */
    public boolean isAllowedBy(LogLevel priority) {
        return this.priority >= priority.getPriority();
    }

    /**
     * Gets the ELogLevel identified by the given name.
     *
     * @param name The name of the ELogLevel to get.
     * @return Return the ELogLevel identified by the given name, or null if none exists.
     */
    public static LogLevel getByName(String name) {
        if (name == null) {
            throw new IllegalArgumentException("name cannot be null!");
        } else {
            for (LogLevel level : values()) {
                if (name.equals(level.getLevelName())) {
                    return level;
                }
            }
            return null;
        }
    }
}

@@ -122,377 +122,1404 @@
     
-DEBUG(%22DEBUG%22, 0, true, false),%0A    DETAIL(%22DETAIL%22, 1, true, false),%0A    INFO(%22INFO%22, 2, false, false),%0A    WARNING(%22WARNING%22, 3, false, false),%0A    ERROR(%22ERROR%22, 4, false, true),%0A    FATAL(%22FATAL%22, 5, false, true),%0A    STACK(%22STACK%22, 6, false, true);%0A%0A    private String levelName;%0A    private int priority;%0A    private boolean isDebug;%0A    private boolean isError;%0A
+/**%0A     * LogLevel for full debug logging%0A     */%0A    DEBUG(%22DEBUG%22, 0, true, false),%0A    /**%0A     * LogLevel for smaller debug logging%0A     */%0A    DETAIL(%22DETAIL%22, 1, true, false),%0A    /**%0A     * LogLevel for normal message logging.%0A     */%0A    INFO(%22INFO%22, 2, false, false),%0A    /**%0A     * LogLevel for logging warnings, such as when an unexpected value is encountered.%0A     */%0A    WARNING(%22WARNING%22, 3, false, false),%0A    /**%0A     * LogLevel for logging errors, such as an exception%0A     */%0A    ERROR(%22ERROR%22, 4, false, true),%0A    /**%0A     * LogLevel for logging application-terminating errors, such as when a required library could not be loaded%0A     */%0A    FATAL(%22FATAL%22, 5, false, true),%0A    /**%0A     * LogLevel for logging stack traces.%0A     */%0A    STACK(%22STACK%22, 6, false, true);%0A%0A    /**%0A     * The name of this LogLevel%0A     */%0A    private String levelName;%0A%0A    /**%0A     * The numerical priority of this LogLevel%0A     */%0A    private int priority;%0A%0A    /**%0A     * If this LogLevel is a debug level%0A     */%0A    private boolean isDebug;%0A%0A    /**%0A     * If this LogLevel is an error level%0A     */%0A    private boolean isError;%0A%0A    /**%0A     * Creates a new LogLevel%0A     *%0A     * @param levelName The name of this Level%0A     * @param priority  The priority of this level%0A     * @param isDebug   If this Level is a debug level%0A     * @param isError   If this level is an error level%0A     */
 %0A   

Add comments to LogLevel