diff --git a/README.md b/README.md index fdf72b78..2059bc25 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,9 @@ Usage: sparrow [options] Path to Sparrow home folder --help, -h Show usage + --level, -l + Set log level + Possible Values: [ERROR, WARN, INFO, DEBUG, TRACE] --network, -n Network to use Possible Values: [mainnet, testnet, regtest, signet] diff --git a/drongo b/drongo index faa8f713..b84aa2e7 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit faa8f71313ff102c9611f8a9265511029654a83c +Subproject commit b84aa2e7cb0c1f78fb36d610295ade0439e0df2a diff --git a/src/main/java/com/sparrowwallet/sparrow/Args.java b/src/main/java/com/sparrowwallet/sparrow/Args.java index 1fa8449c..fb157343 100644 --- a/src/main/java/com/sparrowwallet/sparrow/Args.java +++ b/src/main/java/com/sparrowwallet/sparrow/Args.java @@ -2,6 +2,7 @@ package com.sparrowwallet.sparrow; import com.beust.jcommander.Parameter; import com.sparrowwallet.drongo.Network; +import org.slf4j.event.Level; public class Args { @Parameter(names = { "--dir", "-d" }, description = "Path to Sparrow home folder") @@ -10,6 +11,9 @@ public class Args { @Parameter(names = { "--network", "-n" }, description = "Network to use") public Network network; + @Parameter(names = { "--level", "-l" }, description = "Set log level") + public Level level; + @Parameter(names = { "--help", "-h" }, description = "Show usage", help = true) public boolean help; } diff --git a/src/main/java/com/sparrowwallet/sparrow/MainApp.java b/src/main/java/com/sparrowwallet/sparrow/MainApp.java index 1d2ab98c..9579d832 100644 --- a/src/main/java/com/sparrowwallet/sparrow/MainApp.java +++ b/src/main/java/com/sparrowwallet/sparrow/MainApp.java @@ -1,6 +1,7 @@ package com.sparrowwallet.sparrow; import com.beust.jcommander.JCommander; +import com.sparrowwallet.drongo.Drongo; import com.sparrowwallet.drongo.Network; import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.sparrow.glyphfont.FontAwesome5; @@ -119,6 +120,10 @@ public class MainApp extends Application { System.exit(0); } + if(args.level != null) { + Drongo.setRootLogLevel(args.level); + } + if(args.dir != null) { System.setProperty(APP_HOME_PROPERTY, args.dir); getLogger().info("Using configured Sparrow home folder of " + args.dir);