Class Logger


  • public class Logger
    extends java.lang.Object
    A logger is used to do the real logging work, can use multiple log printers to print the log.

    A Logger is always generated and mostly accessed by XLog, but for customization purpose, you can configure a Logger via the Logger.Builder which is returned by XLog when you trying to start a customization using XLog.tag(String) or other configuration method, and to use the customized Logger, you should call the Logger.Builder.build() to build a Logger, and then you can log using the Logger assuming that you are using the XLog directly.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Logger.Builder
      Builder for Logger.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void d​(java.lang.Object object)
      Log an object with level LogLevel.DEBUG.
      void d​(java.lang.Object[] array)
      Log an array with level LogLevel.DEBUG.
      void d​(java.lang.String msg)
      Log a message with level LogLevel.DEBUG.
      void d​(java.lang.String format, java.lang.Object... args)
      Log a message with level LogLevel.DEBUG.
      void d​(java.lang.String msg, java.lang.Throwable tr)
      Log a message and a throwable with level LogLevel.DEBUG.
      void e​(java.lang.Object object)
      Log an object with level LogLevel.ERROR.
      void e​(java.lang.Object[] array)
      Log an array with level LogLevel.ERROR.
      void e​(java.lang.String msg)
      Log a message with level LogLevel.ERROR.
      void e​(java.lang.String format, java.lang.Object... args)
      Log a message with level LogLevel.ERROR.
      void e​(java.lang.String msg, java.lang.Throwable tr)
      Log a message and a throwable with level LogLevel.ERROR.
      void i​(java.lang.Object object)
      Log an object with level LogLevel.INFO.
      void i​(java.lang.Object[] array)
      Log an array with level LogLevel.INFO.
      void i​(java.lang.String msg)
      Log a message with level LogLevel.INFO.
      void i​(java.lang.String format, java.lang.Object... args)
      Log a message with level LogLevel.INFO.
      void i​(java.lang.String msg, java.lang.Throwable tr)
      Log a message and a throwable with level LogLevel.INFO.
      void json​(java.lang.String json)
      Log a JSON string, with level LogLevel.DEBUG by default.
      void log​(int logLevel, java.lang.Object object)
      Log an object with specific log level.
      void log​(int logLevel, java.lang.Object[] array)
      Log an array with specific log level.
      void log​(int logLevel, java.lang.String msg)
      Log a message with specific log level.
      void log​(int logLevel, java.lang.String format, java.lang.Object... args)
      Log a message with specific log level.
      void log​(int logLevel, java.lang.String msg, java.lang.Throwable tr)
      Log a message and a throwable with specific log level.
      void v​(java.lang.Object object)
      Log an object with level LogLevel.VERBOSE.
      void v​(java.lang.Object[] array)
      Log an array with level LogLevel.VERBOSE.
      void v​(java.lang.String msg)
      Log a message with level LogLevel.VERBOSE.
      void v​(java.lang.String format, java.lang.Object... args)
      Log a message with level LogLevel.VERBOSE.
      void v​(java.lang.String msg, java.lang.Throwable tr)
      Log a message and a throwable with level LogLevel.VERBOSE.
      void w​(java.lang.Object object)
      Log an object with level LogLevel.WARN.
      void w​(java.lang.Object[] array)
      Log an array with level LogLevel.WARN.
      void w​(java.lang.String msg)
      Log a message with level LogLevel.WARN.
      void w​(java.lang.String format, java.lang.Object... args)
      Log a message with level LogLevel.WARN.
      void w​(java.lang.String msg, java.lang.Throwable tr)
      Log a message and a throwable with level LogLevel.WARN.
      void xml​(java.lang.String xml)
      Log a XML string, with level LogLevel.DEBUG by default.
      • Methods inherited from class java.lang.Object

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

      • v

        public void v​(java.lang.Object[] array)
        Log an array with level LogLevel.VERBOSE.
        Parameters:
        array - the array to log
      • v

        public void v​(java.lang.String format,
                      java.lang.Object... args)
        Log a message with level LogLevel.VERBOSE.
        Parameters:
        format - the format of the message to log
        args - the arguments of the message to log
      • v

        public void v​(java.lang.String msg)
        Log a message with level LogLevel.VERBOSE.
        Parameters:
        msg - the message to log
      • v

        public void v​(java.lang.String msg,
                      java.lang.Throwable tr)
        Log a message and a throwable with level LogLevel.VERBOSE.
        Parameters:
        msg - the message to log
        tr - the throwable to be log
      • d

        public void d​(java.lang.Object[] array)
        Log an array with level LogLevel.DEBUG.
        Parameters:
        array - the array to log
      • d

        public void d​(java.lang.String format,
                      java.lang.Object... args)
        Log a message with level LogLevel.DEBUG.
        Parameters:
        format - the format of the message to log, null if just need to concat arguments
        args - the arguments of the message to log
      • d

        public void d​(java.lang.String msg)
        Log a message with level LogLevel.DEBUG.
        Parameters:
        msg - the message to log
      • d

        public void d​(java.lang.String msg,
                      java.lang.Throwable tr)
        Log a message and a throwable with level LogLevel.DEBUG.
        Parameters:
        msg - the message to log
        tr - the throwable to be log
      • i

        public void i​(java.lang.Object[] array)
        Log an array with level LogLevel.INFO.
        Parameters:
        array - the array to log
      • i

        public void i​(java.lang.String format,
                      java.lang.Object... args)
        Log a message with level LogLevel.INFO.
        Parameters:
        format - the format of the message to log, null if just need to concat arguments
        args - the arguments of the message to log
      • i

        public void i​(java.lang.String msg)
        Log a message with level LogLevel.INFO.
        Parameters:
        msg - the message to log
      • i

        public void i​(java.lang.String msg,
                      java.lang.Throwable tr)
        Log a message and a throwable with level LogLevel.INFO.
        Parameters:
        msg - the message to log
        tr - the throwable to be log
      • w

        public void w​(java.lang.Object[] array)
        Log an array with level LogLevel.WARN.
        Parameters:
        array - the array to log
      • w

        public void w​(java.lang.String format,
                      java.lang.Object... args)
        Log a message with level LogLevel.WARN.
        Parameters:
        format - the format of the message to log, null if just need to concat arguments
        args - the arguments of the message to log
      • w

        public void w​(java.lang.String msg)
        Log a message with level LogLevel.WARN.
        Parameters:
        msg - the message to log
      • w

        public void w​(java.lang.String msg,
                      java.lang.Throwable tr)
        Log a message and a throwable with level LogLevel.WARN.
        Parameters:
        msg - the message to log
        tr - the throwable to be log
      • e

        public void e​(java.lang.Object[] array)
        Log an array with level LogLevel.ERROR.
        Parameters:
        array - the array to log
      • e

        public void e​(java.lang.String format,
                      java.lang.Object... args)
        Log a message with level LogLevel.ERROR.
        Parameters:
        format - the format of the message to log, null if just need to concat arguments
        args - the arguments of the message to log
      • e

        public void e​(java.lang.String msg)
        Log a message with level LogLevel.ERROR.
        Parameters:
        msg - the message to log
      • e

        public void e​(java.lang.String msg,
                      java.lang.Throwable tr)
        Log a message and a throwable with level LogLevel.ERROR.
        Parameters:
        msg - the message to log
        tr - the throwable to be log
      • log

        public void log​(int logLevel,
                        java.lang.Object[] array)
        Log an array with specific log level.
        Parameters:
        logLevel - the specific log level
        array - the array to log
        Since:
        1.4.0
      • log

        public void log​(int logLevel,
                        java.lang.String format,
                        java.lang.Object... args)
        Log a message with specific log level.
        Parameters:
        logLevel - the specific log level
        format - the format of the message to log, null if just need to concat arguments
        args - the arguments of the message to log
        Since:
        1.4.0
      • log

        public void log​(int logLevel,
                        java.lang.String msg)
        Log a message with specific log level.
        Parameters:
        logLevel - the specific log level
        msg - the message to log
        Since:
        1.4.0
      • log

        public void log​(int logLevel,
                        java.lang.String msg,
                        java.lang.Throwable tr)
        Log a message and a throwable with specific log level.
        Parameters:
        logLevel - the specific log level
        msg - the message to log
        tr - the throwable to be log
        Since:
        1.4.0
      • json

        public void json​(java.lang.String json)
        Log a JSON string, with level LogLevel.DEBUG by default.
        Parameters:
        json - the JSON string to log
      • xml

        public void xml​(java.lang.String xml)
        Log a XML string, with level LogLevel.DEBUG by default.
        Parameters:
        xml - the XML string to log