Skip to content

Commit

Permalink
Renamed the loggers for the modules
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerBenGera committed Nov 20, 2022
1 parent 09d81eb commit ff0aa44
Showing 1 changed file with 3 additions and 12 deletions.
@@ -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);
}

}

0 comments on commit ff0aa44

Please sign in to comment.