3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-19 13:45:48 +00:00

Minor logging fixes. Resolves issue 423.

This commit is contained in:
Mike Hearn 2013-07-09 14:57:20 +02:00
parent f473267da2
commit 8a74b3da2c
5 changed files with 9 additions and 10 deletions

View File

@ -16,6 +16,9 @@
package com.google.bitcoin.core; package com.google.bitcoin.core;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.Date; import java.util.Date;
import java.util.concurrent.Semaphore; import java.util.concurrent.Semaphore;
@ -26,6 +29,7 @@ import java.util.concurrent.Semaphore;
* progress method to update a GUI instead.</p> * progress method to update a GUI instead.</p>
*/ */
public class DownloadListener extends AbstractPeerEventListener { public class DownloadListener extends AbstractPeerEventListener {
private static final Logger log = LoggerFactory.getLogger(DownloadListener.class);
private int originalBlocksLeft = -1; private int originalBlocksLeft = -1;
private int lastPercent = 0; private int lastPercent = 0;
private Semaphore done = new Semaphore(0); private Semaphore done = new Semaphore(0);
@ -69,7 +73,7 @@ public class DownloadListener extends AbstractPeerEventListener {
* @param date the date of the last block downloaded * @param date the date of the last block downloaded
*/ */
protected void progress(double pct, int blocksSoFar, Date date) { protected void progress(double pct, int blocksSoFar, Date date) {
System.out.println(String.format("Chain download %d%% done with %d blocks to go, block date %s", (int) pct, log.info(String.format("Chain download %d%% done with %d blocks to go, block date %s", (int) pct,
blocksSoFar, DateFormat.getDateTimeInstance().format(date))); blocksSoFar, DateFormat.getDateTimeInstance().format(date)));
} }
@ -80,7 +84,7 @@ public class DownloadListener extends AbstractPeerEventListener {
*/ */
protected void startDownload(int blocks) { protected void startDownload(int blocks) {
if (blocks > 0) if (blocks > 0)
System.out.println("Downloading block chain of size " + blocks + ". " + log.info("Downloading block chain of size " + blocks + ". " +
(blocks > 1000 ? "This may take a while." : "")); (blocks > 1000 ? "This may take a while." : ""));
} }

View File

@ -49,9 +49,7 @@ import com.lambdaworks.crypto.SCrypt;
* the AES symmetric cipher. Eight bytes of salt is used to prevent dictionary attacks.</p> * the AES symmetric cipher. Eight bytes of salt is used to prevent dictionary attacks.</p>
*/ */
public class KeyCrypterScrypt implements KeyCrypter, Serializable { public class KeyCrypterScrypt implements KeyCrypter, Serializable {
private static final Logger log = LoggerFactory.getLogger(KeyCrypterScrypt.class.getName());
public Logger log = LoggerFactory.getLogger(KeyCrypterScrypt.class.getName());
private static final long serialVersionUID = 949662512049152670L; private static final long serialVersionUID = 949662512049152670L;
/** /**

View File

@ -82,8 +82,6 @@ public class BitcoinSerializerTest {
ByteArrayOutputStream bos = new ByteArrayOutputStream(); ByteArrayOutputStream bos = new ByteArrayOutputStream();
bs.serialize(tx, bos); bs.serialize(tx, bos);
System.out.println(Utils.bytesToHexString(txMessage));
System.out.println(Utils.bytesToHexString(bos.toByteArray()));
assertEquals(true, Arrays.equals(txMessage, bos.toByteArray())); assertEquals(true, Arrays.equals(txMessage, bos.toByteArray()));
} }

View File

@ -45,7 +45,7 @@ import static com.google.bitcoin.core.Utils.reverseBytes;
import static org.junit.Assert.*; import static org.junit.Assert.*;
public class ECKeyTest { public class ECKeyTest {
public Logger log = LoggerFactory.getLogger(ECKeyTest.class.getName()); private static final Logger log = LoggerFactory.getLogger(ECKeyTest.class);
private SecureRandom secureRandom; private SecureRandom secureRandom;

View File

@ -50,7 +50,7 @@ import static com.google.bitcoin.core.Utils.toNanoCoins;
import static org.junit.Assert.*; import static org.junit.Assert.*;
public class WalletTest extends TestWithWallet { public class WalletTest extends TestWithWallet {
public Logger log = LoggerFactory.getLogger(WalletTest.class.getName()); private static final Logger log = LoggerFactory.getLogger(WalletTest.class);
private Address myEncryptedAddress; private Address myEncryptedAddress;
private Address myEncryptedAddress2; private Address myEncryptedAddress2;
@ -1541,7 +1541,6 @@ public class WalletTest extends TestWithWallet {
assertEquals(BigInteger.ZERO, request25.fee); assertEquals(BigInteger.ZERO, request25.fee);
assertEquals(1, request25.tx.getInputs().size()); assertEquals(1, request25.tx.getInputs().size());
assertEquals(72, request25.tx.getOutputs().size()); assertEquals(72, request25.tx.getOutputs().size());
System.out.println(request25.tx.bitcoinSerialize().length);
// Now reset request19 and give it a fee per kb // Now reset request19 and give it a fee per kb
request25.tx.clearInputs(); request25.tx.clearInputs();
request25 = SendRequest.forTx(request25.tx); request25 = SendRequest.forTx(request25.tx);