Class SkriptLogger
java.lang.Object
io.github.syst3ms.skriptparser.log.SkriptLogger
An object through which Skript can keep track of errors, warnings and other useful information to the one that writes
Skript code.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcallback()Decrements the recursion of the logger ; should be called after calling methods that may use SkriptLogger later in execution.voidClears every log that is an error message.voidClears every log that is not a debug message.voidClears every log that is not an error or a debug message.close()Finishes this Logger object, making it impossible to edit.voidLogs a debug message.voidLogs an error messagevoidLogs an error message with a tip on how to solve it.voidFinishes a logging process by making some logged entries definitive.voidUsed to "forget" about a previous error, in case it is desirable to take into account multiple errors.intgetLine()LikesetLine(int), is only used for the purposes of the trigger loading priority system.booleanhasError()voidLogs an info messagebooleanisDebug()voidnextLine()Advances in the currently analysed file.voidrecurse()Increments the recursion of the logger ; should be called before calling methods that may use SkriptLogger later in execution.voidsetContext(ErrorContext context) Updates the error context, which matters for establishing which errors are the most importantvoidsetDebug(boolean debug) Set whether this logger will print debug messagesvoidsetFileInfo(String fileName, List<FileElement> fileElements) Provides the logger information about the file it's currently parsingvoidsetLine(int line) LikegetLine(), is only used for the purposes of the trigger loading priority system.voidLogs a warning messagevoidLogs a warning message
-
Field Details
-
LOG_FORMAT
- See Also:
-
-
Constructor Details
-
SkriptLogger
public SkriptLogger(boolean debug) -
SkriptLogger
public SkriptLogger()
-
-
Method Details
-
setFileInfo
Provides the logger information about the file it's currently parsing- Parameters:
fileName- the file namefileElements- theFileElements of the current file
-
nextLine
public void nextLine()Advances in the currently analysed file. Used to properly display errors. -
getLine
public int getLine()LikesetLine(int), is only used for the purposes of the trigger loading priority system.- Returns:
- the current line
-
setLine
public void setLine(int line) LikegetLine(), is only used for the purposes of the trigger loading priority system.- Parameters:
line- the new line number
-
recurse
public void recurse()Increments the recursion of the logger ; should be called before calling methods that may use SkriptLogger later in execution. -
callback
public void callback()Decrements the recursion of the logger ; should be called after calling methods that may use SkriptLogger later in execution. -
setContext
Updates the error context, which matters for establishing which errors are the most important- Parameters:
context- the new error context
-
error
-
error
-
warn
-
warn
-
info
-
debug
Logs a debug message. Will only work if debug mode is enabled.- Parameters:
message- the debug message
-
forgetError
public void forgetError()Used to "forget" about a previous error, in case it is desirable to take into account multiple errors. Should only be called by the parser. -
clearNotError
public void clearNotError()Clears every log that is not an error or a debug message. -
clearErrors
public void clearErrors()Clears every log that is an error message. -
clearLogs
public void clearLogs()Clears every log that is not a debug message. -
finalizeLogs
public void finalizeLogs()Finishes a logging process by making some logged entries definitive. All non-error logs are made definitive and only the error that has the most priority is made definitive. -
close
-
isDebug
public boolean isDebug()- Returns:
- whether this Logger is in debug mode
-
setDebug
public void setDebug(boolean debug) Set whether this logger will print debug messages- Parameters:
debug- Whether to enable debug mode
-
getFileName
-
hasError
public boolean hasError()- Returns:
- whether or not this Logger has an error stored
-