public class Logger extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
BLUE |
static String |
CYAN |
static String |
GREEN |
static String |
PURPLE |
static String |
RED |
static String |
WHITE |
static String |
YELLOW |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
createNewTemplate(Enum<?> templateName,
String colorCode,
String logLevel,
boolean writeToFile,
boolean onlyVerbose,
boolean onlyDebug,
boolean hidePrefix,
boolean mixpanelMessage,
String mixpanelName) |
static boolean |
createNewTemplate(String templateName,
String colorCode,
String logLevel) |
static boolean |
createNewTemplate(String templateName,
String colorCode,
String logLevel,
boolean writeToFile) |
static boolean |
createNewTemplate(String templateName,
String colorCode,
String logLevel,
boolean writeToFile,
boolean onlyVerbose,
boolean onlyDebug) |
static boolean |
createNewTemplate(String templateName,
String colorCode,
String logLevel,
boolean writeToFile,
boolean onlyVerbose,
boolean onlyDebug,
boolean hidePrefix) |
static boolean |
createNewTemplate(String templateName,
String colorCode,
String logLevel,
boolean writeToFile,
boolean onlyVerbose,
boolean onlyDebug,
boolean hidePrefix,
boolean mixpanelMessage) |
static boolean |
createNewTemplate(String templateName,
String colorCode,
String logLevel,
boolean writeToFile,
boolean onlyVerbose,
boolean onlyDebug,
boolean hidePrefix,
boolean mixpanelMessage,
String mixpanelName)
Create a new
LogTemplate for logging
that can be used to quickly create a new LogEntry. |
static Logger |
getInstance()
Get the
Logger-singleton and create it if it does not exist yet. |
static void |
log(LogEntry log)
|
static boolean |
log(String text,
Enum<?> template) |
static boolean |
log(String text,
String templateName)
Create a
LogEntry with the specified text and LogTemplate. |
void |
setDebug(boolean isDebugMode)
Change the current debug-mode.
|
void |
setLogFolder(File logFolder)
Change the folder where log-files should be stored.
|
void |
setSmallLog(boolean ignorePrefixes)
Change the way
LogEntrys are displayed. |
void |
setVerbose(boolean isVerboseMode)
Change the current verbose-mode.
|
static boolean |
updateTemplate(String templateName,
String colorCode,
String logLevel) |
static boolean |
updateTemplate(String templateName,
String colorCode,
String logLevel,
boolean writeToFile) |
static boolean |
updateTemplate(String templateName,
String colorCode,
String logLevel,
boolean writeToFile,
boolean onlyVerbose,
boolean onlyDebug) |
static boolean |
updateTemplate(String templateName,
String colorCode,
String logLevel,
boolean writeToFile,
boolean onlyVerbose,
boolean onlyDebug,
boolean hidePrefix) |
static boolean |
updateTemplate(String templateName,
String colorCode,
String logLevel,
boolean writeToFile,
boolean onlyVerbose,
boolean onlyDebug,
boolean hidePrefix,
boolean mixpanelMessage) |
static boolean |
updateTemplate(String templateName,
String colorCode,
String logLevel,
boolean writeToFile,
boolean onlyVerbose,
boolean onlyDebug,
boolean hidePrefix,
boolean mixpanelMessage,
String mixpanelName)
Update a specific
LogTemplate. |
public static final String RED
public static final String GREEN
public static final String YELLOW
public static final String BLUE
public static final String PURPLE
public static final String CYAN
public static final String WHITE
public static Logger getInstance()
Logger-singleton and create it if it does not exist yet.Logger-singleton.public void setLogFolder(File logFolder)
logFolder - The path where future log-files should be stored
(Default is "PROGRAMDATA/JavaLogger").public void setDebug(boolean isDebugMode)
LogEntrys whose 'DEBUG' method was set,
are only visible if this method is set to true.isDebugMode - Weather or not the Logger should work in debug-mode
(Default is false).public void setVerbose(boolean isVerboseMode)
LogEntrys whose 'VERBOSE' method was set,
are only visible if this method is set to true.isVerboseMode - Weather or not the Logger should work in verbose-mode
(Default is false).public void setSmallLog(boolean ignorePrefixes)
LogEntrys are displayed.
Using small-logs will remove all prefixes from logging.
This has the same effect as the plaintext setting in a single LogEntry,
but will affect all logging.ignorePrefixes - Weather or not the Logger should use small-logs
(Default is false).public static void log(LogEntry log)
LogEntry provided with the settings that are stored in the LogEntry.
If the LogEntry is set to VERBOSE or DEBUG,
it will only be processed if the Logger has activated that mode.log - The LogEntry that should be processed.public static boolean log(String text, String templateName)
LogEntry with the specified text and LogTemplate.text - The message to log.templateName - The name of the LogTemplate that should be used.LogTemplate does not exist.public static boolean createNewTemplate(String templateName, String colorCode, String logLevel, boolean writeToFile, boolean onlyVerbose, boolean onlyDebug, boolean hidePrefix, boolean mixpanelMessage, String mixpanelName)
LogTemplate for logging
that can be used to quickly create a new LogEntry.templateName - The name which is required to find the LogTemplate again.colorCode - The color which will be used in the console output.logLevel - The logging-level.writeToFile - If LogEntrys written with this LogTemplate should be saved in a log-file.onlyDebug - If LogEntrys with these settings should only be visible in debug-mode.onlyVerbose - If LogEntrys with these settings should only be visible in verbose-mode.hidePrefix - If only the actual message without timestamp, logging-level and error-code should be shown.mixpanelMessage - If the LogEntry should be sent to Mixpanel.mixpanelName - The name of the Mixpanel-event.LogTemplate was created successfully, False if the LogTemplate already existed.public static boolean createNewTemplate(Enum<?> templateName, String colorCode, String logLevel, boolean writeToFile, boolean onlyVerbose, boolean onlyDebug, boolean hidePrefix, boolean mixpanelMessage, String mixpanelName)
public static boolean createNewTemplate(String templateName, String colorCode, String logLevel, boolean writeToFile, boolean onlyVerbose, boolean onlyDebug, boolean hidePrefix, boolean mixpanelMessage)
public static boolean createNewTemplate(String templateName, String colorCode, String logLevel, boolean writeToFile, boolean onlyVerbose, boolean onlyDebug, boolean hidePrefix)
public static boolean createNewTemplate(String templateName, String colorCode, String logLevel, boolean writeToFile, boolean onlyVerbose, boolean onlyDebug)
public static boolean createNewTemplate(String templateName, String colorCode, String logLevel, boolean writeToFile)
public static boolean createNewTemplate(String templateName, String colorCode, String logLevel)
public static boolean updateTemplate(String templateName, String colorCode, String logLevel, boolean writeToFile, boolean onlyVerbose, boolean onlyDebug, boolean hidePrefix, boolean mixpanelMessage, String mixpanelName)
LogTemplate.templateName - The name of the LogTemplate.colorCode - The new color.logLevel - The new logging-level.writeToFile - If LogEntrys written with this LogTemplate should be saved in a log-file.onlyDebug - If LogEntrys with these settings should only be visible in debug-mode.onlyVerbose - If LogEntrys with these settings should only be visible in verbose-mode.hidePrefix - If only the actual message without timestamp, logging-level and error-code should be shown.mixpanelMessage - If the LogEntry should be sent to Mixpanel.mixpanelName - The name of the Mixpanel-event.LogTemplate was updated successfully, False if the name was not found.public static boolean updateTemplate(String templateName, String colorCode, String logLevel, boolean writeToFile, boolean onlyVerbose, boolean onlyDebug, boolean hidePrefix, boolean mixpanelMessage)
public static boolean updateTemplate(String templateName, String colorCode, String logLevel, boolean writeToFile, boolean onlyVerbose, boolean onlyDebug, boolean hidePrefix)
public static boolean updateTemplate(String templateName, String colorCode, String logLevel, boolean writeToFile, boolean onlyVerbose, boolean onlyDebug)
public static boolean updateTemplate(String templateName, String colorCode, String logLevel, boolean writeToFile)
Copyright © 2022. All rights reserved.