mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-08 08:12:57 +08:00
Enable debug mode for plugin loggers if enabled for the primary logger
This commit is contained in:
parent
b88b3717c3
commit
0cad9a90c0
@ -1,15 +1,17 @@
|
||||
package emu.grasscutter.plugin;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.plugin.api.ServerHelper;
|
||||
import emu.grasscutter.plugin.api.ServerHook;
|
||||
import emu.grasscutter.server.game.GameServer;
|
||||
import emu.grasscutter.utils.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLClassLoader;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/** The base class for all plugins to extend. */
|
||||
@SuppressWarnings("removal")
|
||||
@ -39,6 +41,10 @@ public abstract class Plugin {
|
||||
this.dataFolder = FileUtils.getPluginPath(identifier.name).toFile();
|
||||
this.logger = LoggerFactory.getLogger(identifier.name);
|
||||
|
||||
// Check if the logger should be set in debug mode.
|
||||
if (Grasscutter.getLogger().isDebugEnabled())
|
||||
((ch.qos.logback.classic.Logger) logger).setLevel(Level.DEBUG);
|
||||
|
||||
if (!this.dataFolder.exists() && !this.dataFolder.mkdirs()) {
|
||||
Grasscutter.getLogger()
|
||||
.warn("Failed to create plugin data folder for " + this.identifier.name);
|
||||
|
Loading…
Reference in New Issue
Block a user