set log level dynamically

This commit is contained in:
Craig Raw 2021-03-01 16:30:12 +02:00
parent faa8f71313
commit b84aa2e7cb
2 changed files with 7 additions and 0 deletions

View file

@ -3,6 +3,7 @@ package com.sparrowwallet.drongo;
import com.sparrowwallet.drongo.rpc.BitcoinJSONRPCClient; import com.sparrowwallet.drongo.rpc.BitcoinJSONRPCClient;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.slf4j.event.Level;
import org.zeromq.SocketType; import org.zeromq.SocketType;
import org.zeromq.ZContext; import org.zeromq.ZContext;
import org.zeromq.ZMQ; import org.zeromq.ZMQ;
@ -74,4 +75,9 @@ public class Drongo {
public List<WatchWallet> getWallets() { public List<WatchWallet> getWallets() {
return watchWallets; return watchWallets;
} }
public static void setRootLogLevel(Level level) {
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger)LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
root.setLevel(ch.qos.logback.classic.Level.toLevel(level.toString()));
}
} }

View file

@ -3,6 +3,7 @@ open module com.sparrowwallet.drongo {
requires de.mkammerer.argon2; requires de.mkammerer.argon2;
requires slf4j.api; requires slf4j.api;
requires logback.core; requires logback.core;
requires logback.classic;
requires json.simple; requires json.simple;
requires jeromq; requires jeromq;
exports com.sparrowwallet.drongo; exports com.sparrowwallet.drongo;