add debug log command
Some checks are pending
Java CI with Gradle / build (push) Waiting to run

This commit is contained in:
alexcrea 2026-06-29 00:56:54 +02:00
parent fcbe6ba3fb
commit 965ee33325
Signed by: alexcrea
GPG key ID: E346CD16413450E3
5 changed files with 140 additions and 2 deletions

View file

@ -71,21 +71,35 @@ open class CustomAnvil : JavaPlugin() {
var latestVer: String? = null
// Debug
val debugStorageQueue = ArrayDeque<String>()
private fun addToLogQueue(message: String) {
if(debugStorageQueue.size >= 200) {
// Let not store infinite debug logs lol
debugStorageQueue.removeFirst()
}
debugStorageQueue.addLast(message)
}
/**
* Logging handler
*/
@JvmStatic fun log(message: String) {
if (ConfigOptions.debugLog) {
instance.logger.info(message)
addToLogQueue(message)
}
}
/**
* Vebose Logging handler
*/
fun verboseLog(message: String) {
@JvmStatic fun verboseLog(message: String) {
if (ConfigOptions.verboseDebugLog) {
instance.logger.info(message)
addToLogQueue(message)
}
}