mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-15 19:55:51 +00:00
Control API logging using the bitcoinj.logging global property.
This commit is contained in:
parent
f97cde4c34
commit
99d155e0fe
@ -26,6 +26,7 @@ import java.security.NoSuchAlgorithmException;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A collection of various utility methods that are helpful for working with the BitCoin protocol.
|
* A collection of various utility methods that are helpful for working with the BitCoin protocol.
|
||||||
|
* To enable debug logging from the library, run with -Dbitcoinj.logging=true on your command line.
|
||||||
*/
|
*/
|
||||||
public class Utils {
|
public class Utils {
|
||||||
/** How many nanocoins there are in a BitCoin. */
|
/** How many nanocoins there are in a BitCoin. */
|
||||||
@ -33,6 +34,12 @@ public class Utils {
|
|||||||
/** How many nanocoins there are in 0.01 BitCoins. */
|
/** How many nanocoins there are in 0.01 BitCoins. */
|
||||||
public static final BigInteger CENT = new BigInteger("1000000", 10);
|
public static final BigInteger CENT = new BigInteger("1000000", 10);
|
||||||
|
|
||||||
|
private static boolean logging;
|
||||||
|
|
||||||
|
static {
|
||||||
|
logging = Boolean.parseBoolean(System.getProperty("bitcoinj.logging", "false"));
|
||||||
|
}
|
||||||
|
|
||||||
/** Convert an amount expressed in the way humans are used to into nanocoins. */
|
/** Convert an amount expressed in the way humans are used to into nanocoins. */
|
||||||
public static BigInteger toNanoCoins(int coins, int cents) {
|
public static BigInteger toNanoCoins(int coins, int cents) {
|
||||||
assert cents < 100;
|
assert cents < 100;
|
||||||
@ -159,7 +166,7 @@ public class Utils {
|
|||||||
|
|
||||||
static void LOG(String msg) {
|
static void LOG(String msg) {
|
||||||
// Set this to true to see debug prints from the library.
|
// Set this to true to see debug prints from the library.
|
||||||
if (false) {
|
if (logging) {
|
||||||
System.out.print("BitCoin: ");
|
System.out.print("BitCoin: ");
|
||||||
System.out.println(msg);
|
System.out.println(msg);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user