Skip to content

Commit fdd53c3

Browse files
committed
verbose debug checks
1 parent e7e9fd5 commit fdd53c3

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

src/main/kotlin/com/lambda/config/AutomationConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ open class AutomationConfig(
7979
val showAllEntries by setting("Show All Entries", false, "Show all entries in the task tree").group(Group.Debug)
8080
val shrinkFactor by setting("Shrink Factor", 0.001, 0.0..1.0, 0.001).group(Group.Debug)
8181
val ignoreItemDropWarnings by setting("Ignore Drop Warnings", false, "Hides the item drop warnings from the break manager").group(Group.Debug)
82-
val managerDebugLogs by setting("Manager Debug Logs", false, "Prints debug logs from managers into chat").group(Group.Debug)
82+
val verboseDebug by setting("Verbose Debug", false, "Prints more, and more detailed, debug logs").group(Group.Debug)
8383

8484
@Volatile
8585
var drawables = listOf<Drawable>()

src/main/kotlin/com/lambda/interaction/managers/breaking/BrokenBlockHandler.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
package com.lambda.interaction.managers.breaking
1919

2020
import com.lambda.config.AutomationConfig.Companion.DEFAULT
21-
import com.lambda.config.AutomationConfig.Companion.DEFAULT.managerDebugLogs
21+
import com.lambda.config.AutomationConfig.Companion.DEFAULT.verboseDebug
2222
import com.lambda.context.SafeContext
2323
import com.lambda.event.events.EntityEvent
2424
import com.lambda.event.events.WorldEvent
@@ -60,10 +60,10 @@ object BrokenBlockHandler : PostActionHandler<BreakInfo>() {
6060

6161
if (!info.broken) {
6262
val message = "${info.type} ${info::class.simpleName} at ${info.context.blockPos.toShortString()} timed out with cached state ${info.context.cachedState}"
63-
if (managerDebugLogs) this@BrokenBlockHandler.warn(message)
63+
if (verboseDebug) this@BrokenBlockHandler.warn(message)
6464
} else if (!DEFAULT.ignoreItemDropWarnings) {
6565
val message = "${info.type} ${info::class.simpleName}'s item drop at ${info.context.blockPos.toShortString()} timed out"
66-
if (managerDebugLogs) this@BrokenBlockHandler.warn(message)
66+
if (verboseDebug) this@BrokenBlockHandler.warn(message)
6767
}
6868

6969
if (!info.broken && info.breakConfig.breakConfirmation != BreakConfirmationMode.AwaitThenBreak) {
@@ -95,7 +95,7 @@ object BrokenBlockHandler : PostActionHandler<BreakInfo>() {
9595
pending.context.cachedState = event.newState
9696
} else {
9797
val message = "Broken block at ${event.pos.toShortString()} was rejected with ${event.newState} instead of ${pending.context.cachedState.emptyState}"
98-
if (managerDebugLogs) this@BrokenBlockHandler.warn(message)
98+
if (verboseDebug) this@BrokenBlockHandler.warn(message)
9999
pending.stopPending()
100100
}
101101
return@listen

src/main/kotlin/com/lambda/interaction/managers/interacting/InteractedBlockHandler.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
package com.lambda.interaction.managers.interacting
1919

2020
import com.lambda.config.AutomationConfig.Companion.DEFAULT
21-
import com.lambda.config.AutomationConfig.Companion.DEFAULT.managerDebugLogs
21+
import com.lambda.config.AutomationConfig.Companion.DEFAULT.verboseDebug
2222
import com.lambda.event.events.WorldEvent
2323
import com.lambda.event.listener.SafeListener.Companion.listen
2424
import com.lambda.interaction.managers.PostActionHandler
@@ -33,7 +33,7 @@ object InteractedBlockHandler : PostActionHandler<InteractInfo>() {
3333
DEFAULT.buildConfig.maxPendingActions,
3434
DEFAULT.buildConfig.actionTimeout * 50L
3535
) {
36-
if (managerDebugLogs) warn("${it::class.simpleName} at ${it.context.blockPos.toShortString()} timed out")
36+
if (verboseDebug) warn("${it::class.simpleName} at ${it.context.blockPos.toShortString()} timed out")
3737
if (it.interactConfig.interactConfirmationMode != InteractConfig.InteractConfirmationMode.AwaitThenPlace) {
3838
runSafe {
3939
world.setBlockState(it.context.blockPos, it.context.cachedState)
@@ -55,7 +55,7 @@ object InteractedBlockHandler : PostActionHandler<InteractInfo>() {
5555

5656
pending.stopPending()
5757

58-
if (managerDebugLogs) this@InteractedBlockHandler.warn("Placed block at ${event.pos.toShortString()} was rejected with ${event.newState} instead of ${pending.context.expectedState}")
58+
if (verboseDebug) this@InteractedBlockHandler.warn("Placed block at ${event.pos.toShortString()} was rejected with ${event.newState} instead of ${pending.context.expectedState}")
5959
return@listen
6060
}
6161

src/main/kotlin/com/lambda/task/Task.kt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package com.lambda.task
1919

2020
import com.lambda.Lambda.LOG
2121
import com.lambda.config.AutomationConfig.Companion.DEFAULT
22+
import com.lambda.config.AutomationConfig.Companion.DEFAULT.verboseDebug
2223
import com.lambda.context.SafeContext
2324
import com.lambda.event.EventFlow.unsubscribe
2425
import com.lambda.event.Muteable
@@ -118,10 +119,10 @@ abstract class Task<Result> : Nameable, Muteable {
118119
require(owner != this) { "Cannot execute a task as a child of itself" }
119120
owner.subTasks.add(this)
120121
parent = owner
121-
LOG.info("${owner.name} started $name")
122+
if (verboseDebug) LOG.info("${owner.name} started $name")
122123
if (pauseParent) {
123124
parentPausing = true
124-
LOG.info("$name pausing parent ${owner.name}")
125+
if (verboseDebug) LOG.info("$name pausing parent ${owner.name}")
125126
if (owner !is RootTask) owner.pause()
126127
}
127128
state = State.Running
@@ -219,16 +220,18 @@ abstract class Task<Result> : Nameable, Muteable {
219220
if (parentPausing) parent?.activate()
220221
return
221222
} else parent?.failure(e, stacktrace) ?: run {
222-
val message = buildString {
223-
stacktrace.firstOrNull()?.let { first ->
224-
append("${first.name} failed: ${e.message}\n")
225-
stacktrace.drop(1).forEach {
226-
append(" -> ${it.name}\n")
223+
if (verboseDebug) {
224+
val message = buildString {
225+
stacktrace.firstOrNull()?.let { first ->
226+
append("${first.name} failed: ${e.message}\n")
227+
stacktrace.drop(1).forEach {
228+
append(" -> ${it.name}\n")
229+
}
227230
}
228231
}
232+
LOG.error(message, e)
233+
logError(message)
229234
}
230-
LOG.error(message, e)
231-
logError(message)
232235
}
233236
}
234237

0 commit comments

Comments
 (0)