Class TLog

java.lang.Object
com.prineside.tdi2.utils.logging.TLog

public final class TLog extends Object
The proper way to log things. Normally each class which logs something uses a single static field with its own instance of TLog. For Lua scripts, it is preferable to create a local logger per file, with a tag which will allow to find out quickly which script uses it: local logger = TLog.class:forTag("scriptName")
  • Method Details

    • forClass

      public static TLog forClass(Class<?> clazz)
      Creates new instance of TLog and uses class' simple name as a tag
      Parameters:
      clazz - class to create TLog for
      Returns:
      new instance of TLog
    • forTag

      public static TLog forTag(String tag)
      Creates new instance of TLog with a specified tag
      Parameters:
      tag - tag name, which will be added to every logged message. Allowed characters are [a-zA-Z0-9-_]
      Returns:
      new instance of TLog
    • getTag

      public String getTag()
      Returns:
      tag used by this logger
    • d

      public void d(String message, Object... args)
      Print a Debug message. Will do noting if current log level is set to INFO or higher.
      Parameters:
      message - message which also acts as a template. %s in this string will be replaced with args in order
      args - optional array of arguments. %s strings in the `message` will be replaced with the specified args in order. If the last argument is an instance of Throwable (usually an Exception), its description and stacktrace will be added to the end of the message and it won't act as an argument for %s
      See Also:
    • i

      public void i(String message, Object... args)
      Print an Info message. Will do noting if current log level is set to WARNING or higher.
      Parameters:
      message - message which also acts as a template. %s in this string will be replaced with args in order
      args - optional array of arguments. %s strings in the `message` will be replaced with the specified args in order. If the last argument is an instance of Throwable (usually an Exception), its description and stacktrace will be added to the end of the message and it won't act as an argument for %s
      See Also:
    • w

      public void w(String message, Object... args)
      Print a Warning message. Will do noting if current log level is set to ERROR or higher.
      Parameters:
      message - message which also acts as a template. %s in this string will be replaced with args in order
      args - optional array of arguments. %s strings in the `message` will be replaced with the specified args in order. If the last argument is an instance of Throwable (usually an Exception), its description and stacktrace will be added to the end of the message and it won't act as an argument for %s
      See Also:
    • e

      public void e(String message, Object... args)
      Print an Error message.
      Parameters:
      message - message which also acts as a template. %s in this string will be replaced with args in order
      args - optional array of arguments. %s strings in the `message` will be replaced with the specified args in order. If the last argument is an instance of Throwable (usually an Exception), its description and stacktrace will be added to the end of the message and it won't act as an argument for %s
      See Also: