Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09d81eb
commit ff0aa44
Showing
1 changed file
with
3 additions
and
12 deletions.
There are no files selected for viewing
15 changes: 3 additions & 12 deletions
15
API/src/main/java/com/bgsoftware/superiorskyblock/api/modules/ModuleLogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,24 @@ | ||
package com.bgsoftware.superiorskyblock.api.modules; | ||
|
||
import org.bukkit.Bukkit; | ||
import com.bgsoftware.superiorskyblock.api.SuperiorSkyblockAPI; | ||
|
||
import java.util.logging.Level; | ||
import java.util.logging.LogRecord; | ||
import java.util.logging.Logger; | ||
|
||
/** | ||
* Simple implementation of a custom logger for modules. | ||
*/ | ||
public class ModuleLogger extends Logger { | ||
|
||
private final String loggerPrefix; | ||
|
||
/** | ||
* Constructor for the logger. | ||
* | ||
* @param pluginModule The module that uses the logger. | ||
*/ | ||
public ModuleLogger(PluginModule pluginModule) { | ||
super(pluginModule.getClass().getCanonicalName(), null); | ||
this.loggerPrefix = "[" + pluginModule.getName() + "] "; | ||
this.setParent(Bukkit.getServer().getLogger()); | ||
super("SuperiorSkyblock2-" + pluginModule.getName(), null); | ||
this.setParent(SuperiorSkyblockAPI.getSuperiorSkyblock().getLogger()); | ||
this.setLevel(Level.ALL); | ||
} | ||
|
||
public void log(LogRecord logRecord) { | ||
logRecord.setMessage(this.loggerPrefix + logRecord.getMessage()); | ||
super.log(logRecord); | ||
} | ||
|
||
} |