mirror of
https://github.com/itHotL/PlayerStats.git
synced 2025-02-17 01:51:35 +01:00
Updated Adventure-platform, removed some unnecessary logging from DebugLevel.LOW
This commit is contained in:
parent
992344b210
commit
d4e3463cea
2
pom.xml
2
pom.xml
@ -54,7 +54,7 @@
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-bukkit</artifactId>
|
||||
<version>4.1.1</version>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -93,10 +93,10 @@ public final class ShareManager {
|
||||
return sharedResults.contains(shareCode);
|
||||
}
|
||||
|
||||
/** Takes a statResult from the internal ConcurrentHashmap,
|
||||
/** Takes a formattedValue from the internal ConcurrentHashmap,
|
||||
puts the current time in the shareTimeStamp (ConcurrentHashMap),
|
||||
puts the shareCode (int hashCode) in the sharedResults (ArrayBlockingQueue),
|
||||
and returns the statResult. If no statResult was found, returns null.*/
|
||||
and returns the formattedValue. If no formattedValue was found, returns null.*/
|
||||
public @Nullable InternalStatResult getStatResult(String playerName, int shareCode) {
|
||||
if (statResultQueue.containsKey(shareCode)) {
|
||||
shareTimeStamp.put(playerName, Instant.now());
|
||||
|
@ -1,9 +1,21 @@
|
||||
package com.gmail.artemis.the.gr8.playerstats.api;
|
||||
|
||||
import com.gmail.artemis.the.gr8.playerstats.msg.components.ComponentUtils;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.Statistic;
|
||||
|
||||
public interface Formatter extends StatFormatter {
|
||||
public interface Formatter {
|
||||
|
||||
/** Turns a TextComponent into its String representation. This method is equipped
|
||||
to turn all PlayerStats' formatted statResults into String.
|
||||
|
||||
@return a String representation of this TextComponent, without hover/click events,
|
||||
but with color, style and formatting. TranslatableComponents will be turned into
|
||||
plain English.*/
|
||||
default String TextComponentToString(TextComponent component) {
|
||||
return ComponentUtils.getTranslatableComponentSerializer()
|
||||
.serialize(component);
|
||||
}
|
||||
|
||||
/** @return [PlayerStats]*/
|
||||
TextComponent getPluginPrefix();
|
||||
|
@ -38,7 +38,7 @@ public final class PlayerStatsAPI implements PlayerStats {
|
||||
|
||||
@Override
|
||||
public Formatter getFormatter() {
|
||||
return null;
|
||||
return statFormatter;
|
||||
}
|
||||
|
||||
static StatCalculator statCalculator() {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.gmail.artemis.the.gr8.playerstats.api;
|
||||
|
||||
import com.gmail.artemis.the.gr8.playerstats.statistic.request.StatRequest;
|
||||
import com.gmail.artemis.the.gr8.playerstats.msg.msgutils.ComponentUtils;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.*;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
@ -21,21 +20,11 @@ import java.util.LinkedHashMap;
|
||||
<br>
|
||||
<br>Alternatively, you can also turn your TextComponent into a plain String with
|
||||
{@link #TextComponentToString(TextComponent)}. Don't use Adventure's method .content()
|
||||
on your statResult to do this - because of the way the TextComponent is built by PlayerStats,
|
||||
on your formattedValue to do this - because of the way the TextComponent is built by PlayerStats,
|
||||
you won't be able to get the full content that way.*/
|
||||
@Internal
|
||||
public interface StatFormatter {
|
||||
|
||||
/** Turns a TextComponent into its String representation. This method is equipped
|
||||
to turn all PlayerStats' formatted statResults into String.
|
||||
|
||||
@return a String representation of this TextComponent, without hover/click events,
|
||||
but with color, style and formatting. TranslatableComponents will be turned into
|
||||
plain English.*/
|
||||
static String TextComponentToString(TextComponent component) {
|
||||
return ComponentUtils.getTranslatableComponentSerializer()
|
||||
.serialize(component);
|
||||
}
|
||||
public
|
||||
interface StatFormatter extends Formatter {
|
||||
|
||||
/** @return a TextComponent with the following parts:
|
||||
<br>[player-name]: [number] [stat-name] {sub-stat-name}*/
|
||||
|
@ -38,10 +38,10 @@ public final class ShareCommand implements CommandExecutor {
|
||||
}
|
||||
else {
|
||||
InternalStatResult result = shareManager.getStatResult(sender.getName(), shareCode);
|
||||
if (result == null) { //at this point the only possible cause of statResult being null is the request being older than 25 player-requests ago
|
||||
if (result == null) { //at this point the only possible cause of formattedValue being null is the request being older than 25 player-requests ago
|
||||
outputManager.sendFeedbackMsg(sender, StandardMessage.STAT_RESULTS_TOO_OLD);
|
||||
} else {
|
||||
outputManager.sendToAllPlayers(result.statResult());
|
||||
outputManager.sendToAllPlayers(result.formattedValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -177,11 +177,11 @@ public final class MessageBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns a BiFunction for a player statistic. This BiFunction will return a statResult,
|
||||
/** Returns a BiFunction for a player statistic. This BiFunction will return a formattedValue,
|
||||
the shape of which is determined by the 2 parameters the BiFunction gets.
|
||||
<p>- Integer shareCode: if a shareCode is provided, a clickable "share" button will be added.
|
||||
<br>- CommandSender sender: if a sender is provided, a signature with "shared by sender-name" will be added.</br>
|
||||
<br>- If both parameters are null, the statResult will be returned as is.</br>*/
|
||||
<br>- If both parameters are null, the formattedValue will be returned as is.</br>*/
|
||||
public BiFunction<Integer, CommandSender, TextComponent> formattedPlayerStatFunction(int stat, @NotNull StatRequest statRequest) {
|
||||
TextComponent playerStat = Component.text()
|
||||
.append(componentFactory.playerName(statRequest.getPlayerName(), Target.PLAYER)
|
||||
@ -196,11 +196,11 @@ public final class MessageBuilder {
|
||||
return getFormattingFunction(playerStat, Target.PLAYER);
|
||||
}
|
||||
|
||||
/** Returns a BiFunction for a server statistic. This BiFunction will return a statResult,
|
||||
/** Returns a BiFunction for a server statistic. This BiFunction will return a formattedValue,
|
||||
the shape of which is determined by the 2 parameters the BiFunction gets.
|
||||
<p>- Integer shareCode: if a shareCode is provided, a clickable "share" button will be added.
|
||||
<br>- CommandSender sender: if a sender is provided, a signature with "shared by sender-name" will be added.</br>
|
||||
<br>- If both parameters are null, the statResult will be returned as is.</br>*/
|
||||
<br>- If both parameters are null, the formattedValue will be returned as is.</br>*/
|
||||
public BiFunction<Integer, CommandSender, TextComponent> formattedServerStatFunction(long stat, @NotNull StatRequest statRequest) {
|
||||
TextComponent serverStat = text()
|
||||
.append(componentFactory.title(config.getServerTitle(), Target.SERVER))
|
||||
@ -216,11 +216,11 @@ public final class MessageBuilder {
|
||||
return getFormattingFunction(serverStat, Target.SERVER);
|
||||
}
|
||||
|
||||
/** Returns a BiFunction for a top statistic. This BiFunction will return a statResult,
|
||||
/** Returns a BiFunction for a top statistic. This BiFunction will return a formattedValue,
|
||||
the shape of which is determined by the 2 parameters the BiFunction gets.
|
||||
<p>- Integer shareCode: if a shareCode is provided, a clickable "share" button will be added.
|
||||
<br>- CommandSender sender: if a sender is provided, a signature with "shared by sender-name" will be added.</br>
|
||||
<br>- If both parameters are null, the statResult will be returned as is.</br>*/
|
||||
<br>- If both parameters are null, the formattedValue will be returned as is.</br>*/
|
||||
public BiFunction<Integer, CommandSender, TextComponent> formattedTopStatFunction(@NotNull LinkedHashMap<String, Integer> topStats, @NotNull StatRequest statRequest) {
|
||||
final TextComponent title = getTopStatsTitleComponent(statRequest, topStats.size());
|
||||
final TextComponent shortTitle = getTopStatDescription(statRequest, topStats.size());
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.gmail.artemis.the.gr8.playerstats.msg;
|
||||
|
||||
import com.gmail.artemis.the.gr8.playerstats.ShareManager;
|
||||
import com.gmail.artemis.the.gr8.playerstats.api.Formatter;
|
||||
import com.gmail.artemis.the.gr8.playerstats.api.StatFormatter;
|
||||
import com.gmail.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.gmail.artemis.the.gr8.playerstats.enums.StandardMessage;
|
||||
import com.gmail.artemis.the.gr8.playerstats.msg.components.ComponentFactory;
|
||||
@ -29,7 +29,7 @@ import static com.gmail.artemis.the.gr8.playerstats.enums.StandardMessage.*;
|
||||
/** This class manages all PlayerStats output. It is the only place where messages are sent.
|
||||
It gets the messages from a {@link MessageBuilder}, which is different for a Console as for Players
|
||||
(mainly to deal with the lack of hover-text, and for Bukkit consoles to make up for the lack of hex-colors).*/
|
||||
public final class OutputManager implements Formatter {
|
||||
public final class OutputManager implements StatFormatter {
|
||||
|
||||
private static BukkitAudiences adventure;
|
||||
private static ConfigHandler config;
|
||||
@ -76,11 +76,6 @@ public final class OutputManager implements Formatter {
|
||||
return prideFactory.pluginPrefixAsTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextComponent formatSingleTopStatLine(int positionInTopList, String playerName, long statNumber, Statistic statistic) {
|
||||
return messageBuilder.singleTopStatLine(positionInTopList, playerName, statNumber, statistic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextComponent formatPlayerStat(@NotNull StatRequest statRequest, int playerStat) {
|
||||
BiFunction<Integer, CommandSender, TextComponent> playerStatFunction =
|
||||
@ -97,6 +92,11 @@ public final class OutputManager implements Formatter {
|
||||
return processFunction(statRequest.getCommandSender(), serverStatFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextComponent formatSingleTopStatLine(int positionInTopList, String playerName, long statNumber, Statistic statistic) {
|
||||
return messageBuilder.singleTopStatLine(positionInTopList, playerName, statNumber, statistic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextComponent formatTopStat(@NotNull StatRequest statRequest, @NotNull LinkedHashMap<String, Integer> topStats) {
|
||||
BiFunction<Integer, CommandSender, TextComponent> topStatFunction =
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.gmail.artemis.the.gr8.playerstats.msg.msgutils;
|
||||
package com.gmail.artemis.the.gr8.playerstats.msg.components;
|
||||
|
||||
import com.gmail.artemis.the.gr8.playerstats.msg.msgutils.LanguageKeyHandler;
|
||||
import com.gmail.artemis.the.gr8.playerstats.msg.msgutils.StringUtils;
|
||||
import net.kyori.adventure.text.*;
|
||||
import net.kyori.adventure.text.flattener.ComponentFlattener;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
@ -125,7 +125,7 @@ public final class ReloadThread extends Thread {
|
||||
MyLogger.actionFinished(1);
|
||||
|
||||
MyLogger.logTimeTaken("ReloadThread",
|
||||
("loaded " + playerMap.size() + " offline players"), time);
|
||||
("loaded " + playerMap.size() + " offline players"), time, DebugLevel.LOW);
|
||||
return playerMap;
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package com.gmail.artemis.the.gr8.playerstats.statistic;
|
||||
|
||||
import com.gmail.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import com.gmail.artemis.the.gr8.playerstats.api.StatCalculator;
|
||||
import com.gmail.artemis.the.gr8.playerstats.enums.DebugLevel;
|
||||
import com.gmail.artemis.the.gr8.playerstats.statistic.request.StatRequest;
|
||||
import com.gmail.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.gmail.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
@ -74,7 +75,7 @@ public final class StatManager implements StatCalculator {
|
||||
|
||||
MyLogger.actionFinished(2);
|
||||
ThreadManager.recordCalcTime(System.currentTimeMillis() - time);
|
||||
MyLogger.logTimeTaken("StatThread", "calculated all stats", time);
|
||||
MyLogger.logTimeTaken("StatThread", "calculated all stats", time, DebugLevel.MEDIUM);
|
||||
|
||||
return allStats;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.gmail.artemis.the.gr8.playerstats.statistic;
|
||||
|
||||
import com.gmail.artemis.the.gr8.playerstats.api.StatFormatter;
|
||||
import com.gmail.artemis.the.gr8.playerstats.enums.StandardMessage;
|
||||
import com.gmail.artemis.the.gr8.playerstats.enums.Target;
|
||||
import com.gmail.artemis.the.gr8.playerstats.msg.components.ComponentUtils;
|
||||
import com.gmail.artemis.the.gr8.playerstats.statistic.request.StatRequest;
|
||||
import com.gmail.artemis.the.gr8.playerstats.msg.OutputManager;
|
||||
import com.gmail.artemis.the.gr8.playerstats.reload.ReloadThread;
|
||||
@ -65,7 +65,8 @@ public final class StatThread extends Thread {
|
||||
case SERVER -> outputManager.formatServerStat(statRequest, statManager.getServerStat(statRequest));
|
||||
};
|
||||
if (statRequest.isAPIRequest()) {
|
||||
String msg = StatFormatter.TextComponentToString(statResult);
|
||||
String msg = ComponentUtils.getTranslatableComponentSerializer()
|
||||
.serialize(statResult);
|
||||
statRequest.getCommandSender().sendMessage(msg);
|
||||
}
|
||||
else {
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.gmail.artemis.the.gr8.playerstats.statistic.result;
|
||||
|
||||
import com.gmail.artemis.the.gr8.playerstats.api.StatFormatter;
|
||||
import com.gmail.artemis.the.gr8.playerstats.msg.components.ComponentUtils;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
|
||||
/** This Record is used to store stat-results internally, so Players can share them by clicking a share-button.*/
|
||||
public record InternalStatResult(String executorName, TextComponent statResult, int ID) implements StatResult<Integer> {
|
||||
public record InternalStatResult(String executorName, TextComponent formattedValue, int ID) implements StatResult<Integer> {
|
||||
|
||||
/** Gets the ID number for this StatResult. Unlike for the other {@link StatResult} implementations,
|
||||
this one does not return the actual statistic data, because this implementation is meant for internal
|
||||
@ -19,11 +19,12 @@ public record InternalStatResult(String executorName, TextComponent statResult,
|
||||
|
||||
@Override
|
||||
public TextComponent getFormattedTextComponent() {
|
||||
return statResult;
|
||||
return formattedValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormattedString() {
|
||||
return StatFormatter.TextComponentToString(statResult);
|
||||
public String toString() {
|
||||
return ComponentUtils.getTranslatableComponentSerializer()
|
||||
.serialize(formattedValue);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package com.gmail.artemis.the.gr8.playerstats.statistic.result;
|
||||
|
||||
import com.gmail.artemis.the.gr8.playerstats.api.StatFormatter;
|
||||
import com.gmail.artemis.the.gr8.playerstats.msg.components.ComponentUtils;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
|
||||
public record PlayerStatResult(int value, TextComponent formattedValue) implements StatResult<Integer> {
|
||||
@ -16,7 +16,8 @@ public record PlayerStatResult(int value, TextComponent formattedValue) implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormattedString() {
|
||||
return StatFormatter.TextComponentToString(formattedValue);
|
||||
public String toString() {
|
||||
return ComponentUtils.getTranslatableComponentSerializer()
|
||||
.serialize(formattedValue);
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package com.gmail.artemis.the.gr8.playerstats.statistic.result;
|
||||
|
||||
import com.gmail.artemis.the.gr8.playerstats.api.StatFormatter;
|
||||
import com.gmail.artemis.the.gr8.playerstats.msg.components.ComponentUtils;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
|
||||
public record ServerStatResult(long value, TextComponent formattedStatResult) implements StatResult<Long> {
|
||||
public record ServerStatResult(long value, TextComponent formattedValue) implements StatResult<Long> {
|
||||
|
||||
@Override
|
||||
public Long getNumericalValue() {
|
||||
@ -12,11 +12,12 @@ public record ServerStatResult(long value, TextComponent formattedStatResult) im
|
||||
|
||||
@Override
|
||||
public TextComponent getFormattedTextComponent() {
|
||||
return formattedStatResult;
|
||||
return formattedValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormattedString() {
|
||||
return StatFormatter.TextComponentToString(formattedStatResult);
|
||||
public String toString() {
|
||||
return ComponentUtils.getTranslatableComponentSerializer()
|
||||
.serialize(formattedValue);
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,18 @@
|
||||
package com.gmail.artemis.the.gr8.playerstats.statistic.result;
|
||||
|
||||
import com.gmail.artemis.the.gr8.playerstats.api.Formatter;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
|
||||
/** Holds the result of a completed stat-lookup. The <code>Type</code> parameter
|
||||
<code>T</code> of the StatResult represents the data type of the stored number:
|
||||
From the StatResult,
|
||||
you can get the numbers in a formatted message, or the raw numbers by themselves:
|
||||
<code>T</code> of this StatResult represents the data type of the stored number:
|
||||
<ul>
|
||||
<li> <code>Integer</code> for playerStat
|
||||
<li> <code>Long</code> for serverStat
|
||||
<li> <code>LinkedHashMap(String, Integer)</code> for topStat
|
||||
</ul>
|
||||
You can get the raw numbers with {@link #getNumericalValue()}. Additionally,
|
||||
you can get the default formatted message that includes formatted numbers. This can
|
||||
either be a String or a {@link TextComponent}, and contains the following information:
|
||||
You can get these raw numbers with {@link #getNumericalValue()}. Additionally,
|
||||
you can get a formatted message that contains the following information:
|
||||
<ul>
|
||||
<li> for playerStat:
|
||||
<br> [player-name]: [formatted-number] [stat-name] [sub-stat-name]
|
||||
@ -26,15 +24,19 @@ import net.kyori.adventure.text.TextComponent;
|
||||
<br> [2.] [player-name] [.....] [formatted-number]
|
||||
<br> [3.] etc...
|
||||
</ul>
|
||||
If you want the results to be formatted differently, you can get an instance of
|
||||
the {@link com.gmail.artemis.the.gr8.playerstats.api.Formatter}.
|
||||
|
||||
Resulting TextComponents can be sent directly to a Minecraft client or console with the
|
||||
Adventure library. To send a Component, you need to get a {@link BukkitAudiences} object,
|
||||
and use that to send the desired Component. Normally you would have to add Adventure
|
||||
as a dependency to your project, but since the library is included in PlayerStats, you can
|
||||
access it directly. Information on how to get and use the BukkitAudiences object can be
|
||||
By default, the resulting message is a {@link TextComponent}, which can be sent directly
|
||||
to a Minecraft client or console with the Adventure library. To send a Component,
|
||||
you need to get a {@link BukkitAudiences} object, and use that to send the desired Component.
|
||||
Normally you would have to add Adventure as a dependency to your project,
|
||||
but since the library is included in PlayerStats, you can access it directly.
|
||||
Information on how to get and use the BukkitAudiences object can be
|
||||
found on <a href="https://docs.adventure.kyori.net/platform/bukkit.html">Adventure's website</a>.
|
||||
|
||||
<p>You can also use the provided {@link #toString()} method to get the same information
|
||||
in String-format. Don't use Adventure's toString methods on the Components
|
||||
- those are for debugging purposes. And finally, if you want the results to be
|
||||
formatted differently, you can get an instance of the {@link Formatter}.
|
||||
*/
|
||||
public interface StatResult<T> {
|
||||
|
||||
@ -51,11 +53,11 @@ public interface StatResult<T> {
|
||||
PlayerStats config. See class description for more information. */
|
||||
TextComponent getFormattedTextComponent();
|
||||
|
||||
/** Gets the formatted message for the completed stat-lookup this {@link StatResult} stores.
|
||||
/** Turns the formatted message for the completed stat-lookup into String.
|
||||
|
||||
@return a String message containing the formatted number. This message follows
|
||||
the same style and color settings that are specified in the PlayerStats config,
|
||||
but it is not translatable (it is always plain English). See class description
|
||||
for more information.*/
|
||||
String getFormattedString();
|
||||
String toString();
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package com.gmail.artemis.the.gr8.playerstats.statistic.result;
|
||||
|
||||
import com.gmail.artemis.the.gr8.playerstats.api.StatFormatter;
|
||||
import com.gmail.artemis.the.gr8.playerstats.msg.components.ComponentUtils;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
public record TopStatResult(LinkedHashMap<String, Integer> value, TextComponent formattedStatResult) implements StatResult<LinkedHashMap<String,Integer>> {
|
||||
public record TopStatResult(LinkedHashMap<String, Integer> value, TextComponent formattedValue) implements StatResult<LinkedHashMap<String,Integer>> {
|
||||
|
||||
@Override
|
||||
public LinkedHashMap<String, Integer> getNumericalValue() {
|
||||
@ -14,11 +14,12 @@ public record TopStatResult(LinkedHashMap<String, Integer> value, TextComponent
|
||||
|
||||
@Override
|
||||
public TextComponent getFormattedTextComponent() {
|
||||
return formattedStatResult;
|
||||
return formattedValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormattedString() {
|
||||
return StatFormatter.TextComponentToString(formattedStatResult);
|
||||
public String toString() {
|
||||
return ComponentUtils.getTranslatableComponentSerializer()
|
||||
.serialize(formattedValue);
|
||||
}
|
||||
}
|
@ -110,14 +110,14 @@ public final class MyLogger {
|
||||
|
||||
/** Output to console that the given thread has been created (but not started yet).*/
|
||||
public static void threadCreated(String threadName) {
|
||||
if (debugLevel != DebugLevel.LOW) {
|
||||
if (debugLevel == DebugLevel.HIGH) {
|
||||
logger.info(threadName + " created!");
|
||||
}
|
||||
}
|
||||
|
||||
/** Output to console that the given thread has been started. */
|
||||
public static void threadStart(String threadName) {
|
||||
if (debugLevel == DebugLevel.MEDIUM || debugLevel == DebugLevel.HIGH) {
|
||||
if (debugLevel == DebugLevel.HIGH) {
|
||||
logger.info(threadName + " started!");
|
||||
}
|
||||
}
|
||||
@ -195,14 +195,6 @@ public final class MyLogger {
|
||||
}
|
||||
}
|
||||
|
||||
/** Output to console how long a certain task has taken (regardless of DebugLevel).
|
||||
@param className Name of the class executing the task
|
||||
@param methodName Name or description of the task
|
||||
@param startTime Timestamp marking the beginning of the task */
|
||||
public static void logTimeTaken(String className, String methodName, long startTime) {
|
||||
logTimeTaken(className, methodName, startTime, DebugLevel.LOW);
|
||||
}
|
||||
|
||||
/** Output to console how long a certain task has taken if DebugLevel is equal to or higher than the specified threshold.
|
||||
@param className Name of the class executing the task
|
||||
@param methodName Name or description of the task
|
||||
|
Loading…
Reference in New Issue
Block a user