Package ch.njol.skript.log
Class RetainingLogHandler
java.lang.Object
ch.njol.skript.log.LogHandler
ch.njol.skript.log.RetainingLogHandler
- All Implemented Interfaces:
OpenCloseable,Closeable,AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.njol.skript.log.LogHandler
LogHandler.LogResult -
Field Summary
Fields inherited from interface ch.njol.util.OpenCloseable
EMPTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbackup()Internal method for creating a backup of this log.voidclear()Clears the list of retained log messages.@Nullable LogEntrygetFirstError(String def) getLog()intbooleanvoidonStop()Called just after the handler is removed from the active handlers stack.final booleanfinal booleanprintErrors(@Nullable String def) Prints all retained errors or the given one if no errors were retained.final booleanprintErrors(@Nullable String def, ErrorQuality quality) final booleanprintErrors(org.bukkit.command.CommandSender recipient, @Nullable String def) Sends all retained error messages to the given recipient.final voidprintLog()Prints all retained log messages.voidrestore(RetainingLogHandler copy) Internal method for restoring a backup of this log.intsize()start()A convenience method forSkriptLogger.startLogHandler(LogHandler).Methods inherited from class ch.njol.skript.log.LogHandler
close, isStopped, open, stop
-
Constructor Details
-
RetainingLogHandler
public RetainingLogHandler()
-
-
Method Details
-
backup
Internal method for creating a backup of this log.- Returns:
- A new RetainingLogHandler containing the contents of this RetainingLogHandler.
-
restore
Internal method for restoring a backup of this log. -
log
- Specified by:
login classLogHandler- Parameters:
entry- entry to log- Returns:
- Whether to print the specified entry or not.
-
onStop
public void onStop()Description copied from class:LogHandlerCalled just after the handler is removed from the active handlers stack.- Overrides:
onStopin classLogHandler
-
start
Description copied from class:LogHandlerA convenience method forSkriptLogger.startLogHandler(LogHandler).
Implementations should override this to set the return type to the implementing class.- Overrides:
startin classLogHandler
-
printErrors
public final boolean printErrors() -
printErrors
Prints all retained errors or the given one if no errors were retained.This handler is stopped if not already done.
- Parameters:
def- Error to print if no errors were logged, can be null to not print any error if there are none- Returns:
- Whether there were any errors
-
printErrors
-
printErrors
public final boolean printErrors(org.bukkit.command.CommandSender recipient, @Nullable @Nullable String def) Sends all retained error messages to the given recipient.This handler is stopped if not already done.
- Parameters:
recipient-def- Error to send if no errors were logged, can be null to not print any error if there are none- Returns:
- Whether there were any errors to send
-
printLog
public final void printLog()Prints all retained log messages.This handler is stopped if not already done.
-
hasErrors
public boolean hasErrors() -
getFirstError
-
getFirstError
-
clear
public void clear()Clears the list of retained log messages. -
size
public int size() -
getLog
-
getErrors
-
getNumErrors
public int getNumErrors()
-