001package com.identityworksllc.iiq.common.vo;
002
003/**
004 * Enumerates a LogLevel type, particularly for {@link StampedMessage}. The
005 * levels are intended to have the same semantics as Commons Logging or Log4j.
006 */
007public enum LogLevel {
008    /**
009     * Trace level: indicates very low-level method input/output debugging
010     */
011    TRACE(0),
012
013    /**
014     * Debug level: indicates a medium-level debugging message
015     */
016    DEBUG(1),
017
018    /**
019     * Info level: indicates an ordinary log message providing information
020     */
021    INFO(2),
022
023    /**
024     * Warn level: indicates a potential problem
025     */
026    WARN(3),
027
028    /**
029     * Error level: indicates a severe problem, possibly one interrupting the process
030     */
031    ERROR(4);
032
033    private final int ordinalValue;
034
035    LogLevel(int ordinalValue) {
036        this.ordinalValue = ordinalValue;
037    }
038
039    /**
040     * Determines whether this log level is at least as severe as the other
041     * @param other the other log level to compare against
042     * @return true if this level is at least as severe as the other level
043     */
044    public boolean atLeast(LogLevel other) {
045        return this.ordinalValue >= other.ordinalValue;
046    }
047
048    public int getOrdinalValue() {
049        return ordinalValue;
050    }
051}