mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-08-28 16:35:57 +02:00
This commit is contained in:
parent
fcbe6ba3fb
commit
965ee33325
5 changed files with 140 additions and 2 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -128,6 +128,9 @@ object ConfigOptions {
|
|||
private const val DEFAULT_DEBUG_LOG = false
|
||||
private const val DEFAULT_VERBOSE_DEBUG_LOG = false
|
||||
|
||||
var OVERRIDE_DEBUG_LOG: Boolean? = null
|
||||
var OVERRIDE_VERBOSE_DEBUG_LOG: Boolean? = null
|
||||
|
||||
// Dialog menu rename
|
||||
const val DEFAULT_DIALOG_RENAME_ENABLED = false
|
||||
const val DEFAULT_DIALOG_MAX_SIZE = 256
|
||||
|
|
@ -436,6 +439,9 @@ object ConfigOptions {
|
|||
*/
|
||||
val debugLog: Boolean
|
||||
get() {
|
||||
val overrider = OVERRIDE_DEBUG_LOG
|
||||
if(overrider != null) return overrider
|
||||
|
||||
return ConfigHolder.DEFAULT_CONFIG
|
||||
.config
|
||||
.getBoolean(DEBUG_LOGGING, DEFAULT_DEBUG_LOG)
|
||||
|
|
@ -446,6 +452,9 @@ object ConfigOptions {
|
|||
*/
|
||||
val verboseDebugLog: Boolean
|
||||
get() {
|
||||
val overrider = OVERRIDE_VERBOSE_DEBUG_LOG
|
||||
if(overrider != null) return overrider
|
||||
|
||||
return ConfigHolder.DEFAULT_CONFIG
|
||||
.config
|
||||
.getBoolean(VERBOSE_DEBUG_LOGGING, DEFAULT_VERBOSE_DEBUG_LOG)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue