-
Notifications
You must be signed in to change notification settings - Fork 8
Loggers
OliverVsCreeper edited this page May 20, 2015
·
2 revisions
To begin, a logger must be defined as a variable. You can't assign it to a reference yet, as it requires Bukkit methods which are not available upon class load.
Do this with the following: public static NULogger logger;
Then, use the following code in your onEnable() method to create the logger: logger = new NULogger(true);
to initialize the Logger. The boolean value taken as an argument specifies your output preference - true outputs Bukkit version information, while false creates a blank logger.
To log to the file, use: Main.logger.log("NameOfLogEvent", "MessageToLog");
The getLog() method allows you to upload the log to a HasteBin file using the PasteUtils class - try it out!