Skip to content

Commit

Permalink
Remove version label from logger
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolLord22 committed Oct 25, 2023
1 parent 6c8d940 commit 02d2d11
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions src/main/java/com/coollord22/otheranimalteleport/assets/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,20 @@
public class Log {
static ConsoleCommandSender console = null;
static String pluginName = "";
static String pluginVersion = "";
static final Logger logger = Logger.getLogger("Minecraft");
private final OtherAnimalTeleport plugin;

public Log(OtherAnimalTeleport plugin) {
this.plugin = plugin;
if (plugin != null) {
pluginName = plugin.getDescription().getName();
pluginVersion = plugin.getDescription().getVersion();
}
console = Bukkit.getServer().getConsoleSender();
}

// LogInfo & Logwarning - display messages with a standard prefix
public void logWarning(String msg) {
Log.logger.warning("[" + pluginName + ":" + pluginVersion + "] " + msg);
Log.logger.warning("[" + pluginName + "] " + msg);
}

public void logInfo(List<String> msgs) {
Expand All @@ -46,11 +44,7 @@ public void logInfo(List<String> msgs) {

public void logInfo(String msg) {
if (OATConfig.verbosity.exceeds(Verbosity.NORMAL))
Log.logger.info("[" + pluginName + ":" + pluginVersion + "] " + msg);
}

public void logInfoNoVerbosity(String msg) {
Log.logger.info("[" + pluginName + ":" + pluginVersion + "] " + msg);
Log.logger.info("[" + pluginName + "] " + msg);
}

/**
Expand All @@ -60,14 +54,11 @@ public void logInfoNoVerbosity(String msg) {
* @param msg - msg to log
*/
public void dMsg(String msg) {
// Deliberately doesn't check gColorLogMessage as I want these messages
// to stand out in case they
// are left in by accident
if (OATConfig.verbosity.exceeds(Verbosity.HIGHEST))
if (console != null && plugin.config.gColorLogMessages) {
console.sendMessage(ChatColor.RED + "[" + pluginName + ":" + pluginVersion + "] " + ChatColor.RESET + msg);
console.sendMessage(ChatColor.RED + "[" + pluginName + "] " + ChatColor.RESET + msg);
} else {
Log.logger.info("[" + pluginName + ":" + pluginVersion + "] " + msg);
Log.logger.info("[" + pluginName + "] " + msg);
}
}

Expand All @@ -94,9 +85,9 @@ public void logInfo(String msg, Verbosity level) {
default:
break;
}
console.sendMessage(col + "[" + pluginName + ":" + pluginVersion + "] " + ChatColor.RESET + msg);
console.sendMessage(col + "[" + pluginName + "] " + ChatColor.RESET + msg);
} else {
Log.logger.info("[" + pluginName + ":" + pluginVersion + "] " + msg);
Log.logger.info("[" + pluginName + "] " + msg);
}
}
}
Expand All @@ -105,10 +96,4 @@ public void logWarning(String msg, Verbosity level) {
if (OATConfig.verbosity.exceeds(level))
logWarning(msg);
}

// TODO: This is only for temporary debug purposes.
public void stackTrace() {
if (OATConfig.verbosity.exceeds(Verbosity.EXTREME))
Thread.dumpStack();
}
}

0 comments on commit 02d2d11

Please sign in to comment.