Class LogLevel


  • public class LogLevel
    extends java.lang.Object
    Log level indicate how important the log is.

    Usually when we log a message, we also specify the log level explicitly or implicitly, so if we setup a log level using XLog.init(...), all the logs which is with a log level smaller than the setup one would not be printed.

    The priority of log levels is: VERBOSE < DEBUG < INFO < WARN < ERROR.
    And there are two special log levels which are usually used for Log#init: NONE and ALL, NONE for not printing any log and ALL for printing all logs.

    See Also:
    VERBOSE, DEBUG, INFO, WARN, ERROR, NONE, ALL
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ALL
      Log level for XLog#init, printing all logs.
      static int DEBUG
      Log level for XLog.d.
      static int ERROR
      Log level for XLog.e.
      static int INFO
      Log level for XLog.i.
      static int NONE
      Log level for XLog#init, printing no log.
      static int VERBOSE
      Log level for XLog.v.
      static int WARN
      Log level for XLog.w.
    • Constructor Summary

      Constructors 
      Constructor Description
      LogLevel()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getLevelName​(int logLevel)
      Get a name representing the specified log level.
      static java.lang.String getShortLevelName​(int logLevel)
      Get a short name representing the specified log level.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LogLevel

        public LogLevel()
    • Method Detail

      • getLevelName

        public static java.lang.String getLevelName​(int logLevel)
        Get a name representing the specified log level.

        The returned name may be
        Level less than VERBOSE: "VERBOSE-N", N means levels below VERBOSE
        VERBOSE: "VERBOSE"
        DEBUG: "DEBUG"
        INFO: "INFO"
        WARN: "WARN"
        ERROR: "ERROR"
        Level greater than ERROR: "ERROR+N", N means levels above ERROR

        Parameters:
        logLevel - the log level to get name for
        Returns:
        the name
      • getShortLevelName

        public static java.lang.String getShortLevelName​(int logLevel)
        Get a short name representing the specified log level.

        The returned name may be
        Level less than VERBOSE: "V-N", N means levels below VERBOSE
        VERBOSE: "V"
        DEBUG: "D"
        INFO: "I"
        WARN: "W"
        ERROR: "E"
        Level greater than ERROR: "E+N", N means levels above ERROR

        Parameters:
        logLevel - the log level to get short name for
        Returns:
        the short name