Package io.fi0x.javalogger.logging
Class LogEntry
java.lang.Object
io.fi0x.javalogger.logging.LogEntry
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBACKGROUND(String colorCode) Change the background-color that should be used when theLogEntryis printed.CODE(int exceptionCode) Set a specific error code for theLogEntryto use.Change the color that should be used when theLogEntryis printed.CONSOLE_EXCEPTIONS(boolean showExceptionsInConsole) Force thisLogEntryto print exceptions in the console.DEBUG(boolean onlyInDebugMode) Set the debug-state of thisLogEntry.FILE_ENTRY(boolean shouldWriteToFile) Set weather theLogEntryshould be stored in the log-file or not.Change the logging-level that should be used for thisLogEntry.MIXPANEL(boolean sendToMixpanel) Require thisLogEntryto send its information to Mixpanel.MIXPANELNAME(String mixpanelEvent) Change the Mixpanel event name for thisLogEntry.PLAINTEXT(boolean onlyPlaintext) Stop thisLogEntryfrom using the prefix information.VERBOSE(boolean onlyInVerboseMode) Set the verbose-state of thisLogEntry.
-
Constructor Details
-
LogEntry
Create a newLogEntrywith the given text.- Parameters:
text- The message that should be logged.
-
LogEntry
Create a newLogEntrywith the provided text, based on the givenLogTemplate-name.- Parameters:
text- The message that should be logged.templateName- The name of theLogTemplatethat should be used for the logging-behaviour.- Throws:
IllegalArgumentException- Will throw if aLogTemplatewith the provided name does not exist.
-
LogEntry
- Throws:
IllegalArgumentException
-
-
Method Details
-
COLOR
Change the color that should be used when theLogEntryis printed.- Parameters:
colorCode- The new color code (Default will use the current console-color).- Returns:
- The current
LogEntryto be used further.
-
BACKGROUND
Change the background-color that should be used when theLogEntryis printed.- Parameters:
colorCode- The new background-color code (Default will use the current console-color).- Returns:
- The current
LogEntryto be used further.
-
LEVEL
Change the logging-level that should be used for thisLogEntry.- Parameters:
levelEnum- The new logging-level (Default is INFO).- Returns:
- The current
LogEntryto be used further.
-
CODE
Set a specific error code for theLogEntryto use.- Parameters:
exceptionCode- The code that should be printed and saved (Default will not use an error-code).- Returns:
- The current
LogEntryto be used further.
-
EXCEPTION
-
FILE_ENTRY
Set weather theLogEntryshould be stored in the log-file or not. -
DEBUG
Set the debug-state of thisLogEntry. -
VERBOSE
Set the verbose-state of thisLogEntry. -
PLAINTEXT
Stop thisLogEntryfrom using the prefix information. The removed prefix information is the time, logging-level and error-code. -
CONSOLE_EXCEPTIONS
Force thisLogEntryto print exceptions in the console. -
MIXPANEL
Require thisLogEntryto send its information to Mixpanel. This requires you to set up theMixpanelHandlercorrectly. -
MIXPANELNAME
Change the Mixpanel event name for thisLogEntry. Using Mixpanel Logs requires you to set up theMixpanelHandlercorrectly.
-