Class LogEntry

java.lang.Object
io.fi0x.javalogger.logging.LogEntry

public class LogEntry extends Object
This class provides all information that are needed to print and / or save a LogEntry. It contains the message that should be logged, in which color it should be printed, the logging-level it has, an error code if required, an exception if required and weather it should be saved in a file or only printed. It can also be set to be only visible if the Logger is in verbose- or debug-mode.
  • Constructor Details

  • Method Details

    • COLOR

      public LogEntry COLOR(String colorCode)
      Change the color that should be used when the LogEntry is printed.
      Parameters:
      colorCode - The new color code (Default will use the current console-color).
      Returns:
      The current LogEntry to be used further.
    • BACKGROUND

      public LogEntry BACKGROUND(String colorCode)
      Change the background-color that should be used when the LogEntry is printed.
      Parameters:
      colorCode - The new background-color code (Default will use the current console-color).
      Returns:
      The current LogEntry to be used further.
    • LEVEL

      public LogEntry LEVEL(String levelEnum)
      Change the logging-level that should be used for this LogEntry.
      Parameters:
      levelEnum - The new logging-level (Default is INFO).
      Returns:
      The current LogEntry to be used further.
    • CODE

      public LogEntry CODE(int exceptionCode)
      Set a specific error code for the LogEntry to use.
      Parameters:
      exceptionCode - The code that should be printed and saved (Default will not use an error-code).
      Returns:
      The current LogEntry to be used further.
    • EXCEPTION

      public LogEntry EXCEPTION(Exception e)
      Add an Exception to the LogEntry. The Exception will only be visible in the log-file. The message of this LogEntry will still be printed in the output.
      Parameters:
      e - The Exception to save in the log-file (Default will not save any Exceptions).
      Returns:
      The current LogEntry to be used further.
    • FILE_ENTRY

      public LogEntry FILE_ENTRY(boolean shouldWriteToFile)
      Set weather the LogEntry should be stored in the log-file or not.
      Parameters:
      shouldWriteToFile - If the LogEntry should be written to the log-file or only be printed in the output (Default will do both).
      Returns:
      The current LogEntry to be used further.
    • DEBUG

      public LogEntry DEBUG(boolean onlyInDebugMode)
      Set the debug-state of this LogEntry.
      Parameters:
      onlyInDebugMode - If the LogEntry should only be active when the Logger is in debug-mode (Default is false).
      Returns:
      The current LogEntry to be used further.
    • VERBOSE

      public LogEntry VERBOSE(boolean onlyInVerboseMode)
      Set the verbose-state of this LogEntry.
      Parameters:
      onlyInVerboseMode - If the LogEntry should only be active when the Logger is in verbose-mode (Default is false).
      Returns:
      The current LogEntry to be used further.
    • PLAINTEXT

      public LogEntry PLAINTEXT(boolean onlyPlaintext)
      Stop this LogEntry from using the prefix information. The removed prefix information is the time, logging-level and error-code.
      Parameters:
      onlyPlaintext - If the LogEntry should ignore the prefix (Default is false).
      Returns:
      The current LogEntry to be used further.
    • CONSOLE_EXCEPTIONS

      public LogEntry CONSOLE_EXCEPTIONS(boolean showExceptionsInConsole)
      Force this LogEntry to print exceptions in the console.
      Parameters:
      showExceptionsInConsole - If the LogEntry should display exceptions in the console. (Default is false).
      Returns:
      The current LogEntry to be used further.
    • MIXPANEL

      public LogEntry MIXPANEL(boolean sendToMixpanel)
      Require this LogEntry to send its information to Mixpanel. This requires you to set up the MixpanelHandler correctly.
      Parameters:
      sendToMixpanel - If the LogEntry should send its information to Mixpanel (Default is false).
      Returns:
      The current LogEntry to be used further.
    • MIXPANELNAME

      public LogEntry MIXPANELNAME(String mixpanelEvent)
      Change the Mixpanel event name for this LogEntry. Using Mixpanel Logs requires you to set up the MixpanelHandler correctly.
      Parameters:
      mixpanelEvent - The event name under which this LogEntry should be displayed in Mixpanel (Default is 'LOG').
      Returns:
      The current LogEntry to be used further.