From 33da0aa8119e8acef58637bd11b8b4ac52a06965 Mon Sep 17 00:00:00 2001 From: Kamiel Date: Tue, 1 May 2018 23:57:39 +0200 Subject: [PATCH] Add logger command to change the logger level --- .../plugins/devtools/DevToolsPlugin.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java index 9c4ba945597..37845989548 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java @@ -24,6 +24,8 @@ */ package net.runelite.client.plugins.devtools; +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; import com.google.inject.Provides; @@ -50,6 +52,7 @@ import net.runelite.client.ui.NavigationButton; import net.runelite.client.ui.PluginToolbar; import net.runelite.client.ui.overlay.Overlay; +import org.slf4j.LoggerFactory; @PluginDescriptor( name = "Developer Tools", @@ -145,6 +148,26 @@ public void onCommand(CommandExecuted commandExecuted) switch (commandExecuted.getCommand()) { + case "logger": + { + final Logger logger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); + String message; + Level currentLoggerLevel = logger.getLevel(); + + if (args.length < 1) + { + message = "Logger level is currently set to " + currentLoggerLevel; + } + else + { + Level newLoggerLevel = Level.toLevel(args[0], currentLoggerLevel); + logger.setLevel(newLoggerLevel); + message = "Logger level has been set to " + newLoggerLevel; + } + + client.addChatMessage(ChatMessageType.SERVER, "", message, null); + break; + } case "getvar": { int varbit = Integer.parseInt(args[0]);