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,12 +1,15 @@
package core.game.activity;
import core.game.node.entity.player.Player;
import core.tools.Log;
import core.tools.SystemLogger;
import core.game.world.GameWorld;
import java.util.HashMap;
import java.util.Map;
import static core.api.ContentAPIKt.log;
/**
* Manages the activities.
* @author Emperor
@@ -50,7 +53,7 @@ public final class ActivityManager {
ActivityPlugin plugin = ACTIVITIES.get(name);
if (plugin == null) {
if (GameWorld.getSettings().isDevMode()) {
SystemLogger.logErr(ActivityManager.class, "Unhandled activity - " + name + "!");
log(ActivityManager.class, Log.ERR, "Unhandled activity - " + name + "!");
}
return false;
}
@@ -25,6 +25,7 @@ import core.api.Event
import core.api.utils.PlayerCamera
import core.tools.SystemLogger
import core.game.world.GameWorld
import core.tools.Log
/**
* A utility class for making cutscenes.
@@ -259,7 +260,7 @@ abstract class Cutscene(val player: Player) {
try {
endActions?.invoke()
} catch (e: Exception) {
SystemLogger.logErr(this::class.java, "There's some bad nasty code in ${this::class.java.simpleName} end actions!")
log(this::class.java, Log.ERR, "There's some bad nasty code in ${this::class.java.simpleName} end actions!")
e.printStackTrace()
}
return true
@@ -347,7 +348,7 @@ abstract class Cutscene(val player: Player) {
fun logCutscene(message: String)
{
if(ServerConstants.LOG_CUTSCENE)
SystemLogger.logInfo(this::class.java, "$message")
log(this::class.java, Log.FINE, "$message")
}
fun clearNPCs() {