Added support for varying log levels configurable in the server config (see log_level in default.conf)

Error logs now properly print to stderr when possible
Colour-coded logs
Addressed a scenario in which outgoing packet writes could get hung up
Fixed interface incorrect definition message on server startup
This commit is contained in:
Ceikry
2023-03-01 08:01:14 +00:00
committed by Ryan
parent e1faa64af7
commit 88a2f354b4
171 changed files with 723 additions and 475 deletions
@@ -1,8 +1,10 @@
package content.minigame.allfiredup
import core.api.log
import core.game.node.entity.player.Player
import core.tools.SystemLogger
import core.game.world.map.Location
import core.tools.Log
/**
* Various data for beacons, such as varp and offset, required FM level, etc
@@ -29,7 +31,7 @@ enum class AFUBeacon(val title: String, val fmLevel: Int, val varpId: Int, val o
for (beacon in values()) {
if (beacon.location.equals(location)) return beacon
}
return content.minigame.allfiredup.AFUBeacon.RIVER_SALVE.also { SystemLogger.logWarn(this::class.java, "Unhandled Beacon Location ${location.toString()}") }
return content.minigame.allfiredup.AFUBeacon.RIVER_SALVE.also { log(this::class.java, Log.WARN, "Unhandled Beacon Location ${location.toString()}") }
}
fun resetAllBeacons(player: Player){
@@ -97,7 +97,7 @@ public final class BarrowsActivityPlugin extends ActivityPlugin {
}
}
int drain = 8;
System.out.println(getWorldTicks() % 30);
//if (p.getLocks().isLocked("barrow:drain") || RandomFunction.random(100) % 2 == 0) {
// continue;
//}
@@ -3,6 +3,7 @@ package content.minigame.fishingtrawler
import core.api.LogoutListener
import core.api.MapArea
import core.api.getRegionBorders
import core.api.log
import core.game.component.Component
import core.game.node.entity.Entity
import core.game.node.scenery.Scenery
@@ -294,11 +295,11 @@ class FishingTrawlerSession(val activity: FishingTrawlerActivity? = null) : Logo
override fun areaEnter(entity: Entity) {
super.areaEnter(entity)
SystemLogger.logInfo(this::class.java, "ENTERED FTZ")
log(this::class.java, Log.FINE, "ENTERED FTZ")
}
override fun areaLeave(entity: Entity, logout: Boolean) {
super.areaLeave(entity, logout)
SystemLogger.logInfo(this::class.java, "EXITED FTZ")
log(this::class.java, Log.FINE, "EXITED FTZ")
}
}
@@ -1,5 +1,6 @@
package content.minigame.fog
import core.api.log
import core.cache.def.impl.ItemDefinition
import core.game.component.Component
import core.game.component.ComponentDefinition
@@ -8,6 +9,7 @@ import core.game.node.entity.player.Player
import core.game.node.item.Item
import core.plugin.Initializable
import core.plugin.Plugin
import core.tools.Log
import core.tools.SystemLogger
@Initializable
@@ -52,7 +54,7 @@ class FOGRewardsInterface : ComponentPlugin(){
176 -> choice = Air_Gloves
181 -> choice = Water_Gloves
186 -> choice = Earth_Gloves
else -> SystemLogger.logWarn(this::class.java, "Unhandled button ID for FOG interface: $button").also { return true }
else -> log(this::class.java, Log.WARN, "Unhandled button ID for FOG interface: $button").also { return true }
}
handleOpcode(choice,opcode,player!!)
return true
@@ -21,7 +21,7 @@ public final class PCIslandZone extends MapZone {
@Override
public boolean death(Entity e, Entity killer) {
if (e instanceof Player) { // Ensure players can't die on the island.
// System.out.println("[PCIslandZone] Saved player from death!");
e.getProperties().setTeleportLocation(e.getLocation());
return true;
}