Deprecate logger and start moving to SLF4J
All checks were successful
continuous-integration/drone/push Build is passing

JDA already has SLF4J as a requirement, so we might as well use that instead of making our own.
This commit is contained in:
2023-01-15 01:48:56 +01:00
parent 95b4f81235
commit 6bbaf3fe7e
4 changed files with 41 additions and 37 deletions

View File

@@ -1,7 +1,8 @@
package wtf.beatrice.hidekobot.runnables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import wtf.beatrice.hidekobot.Cache;
import wtf.beatrice.hidekobot.util.Logger;
import java.io.IOException;
import java.net.HttpURLConnection;
@@ -9,12 +10,8 @@ import java.net.URL;
public class HeartBeatTask implements Runnable
{
private final Logger logger;
private final Logger LOGGER = LoggerFactory.getLogger(HeartBeatTask.class);
public HeartBeatTask()
{
logger = new Logger(getClass());
}
@@ -37,15 +34,15 @@ public class HeartBeatTask implements Runnable
if(200 <= responseCode && responseCode < 300)
{
// only log ok response codes when verbosity is enabled
if(Cache.isVerbose()) logger.log("Heartbeat response code: " + responseCode);
if(Cache.isVerbose()) LOGGER.info("Heartbeat response code: {}", responseCode);
}
else
{
logger.log("Heartbeat returned problematic response code: " + responseCode);
LOGGER.error("Heartbeat returned problematic response code: {}", responseCode);
}
} catch (IOException e) {
logger.log("Error while trying to push heartbeat: " + e.getMessage());
LOGGER.error("Error while trying to push heartbeat", e);
}
}