- set logger to final

- log level check corrected (null pointer exception)

git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@179 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c
This commit is contained in:
schlaepfer
2006-10-23 13:14:35 +00:00
parent b97aba3961
commit afbdb640d5
3 changed files with 5 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ import ch.ntb.usb.logger.LogUtil;
*/
public class Device {
private static Logger logger = LogUtil.getLogger("ch.ntb.usb");
private static final Logger logger = LogUtil.getLogger("ch.ntb.usb");
private static final int TIMEOUT_ERROR_CODE = -116;
@@ -225,7 +225,7 @@ public class Device {
}
logger.info("length written: " + lenWritten);
if (logger.getLevel().intValue() <= Level.FINEST.intValue()) {
if (logger.isLoggable(Level.FINEST)) {
StringBuffer sb = new StringBuffer("bulkwrite, ep 0x"
+ Integer.toHexString(out_ep_address) + ": " + lenWritten
+ " Bytes sent: ");
@@ -285,7 +285,7 @@ public class Device {
}
logger.info("length read: " + lenRead);
if (logger.getLevel().intValue() <= Level.FINEST.intValue()) {
if (logger.isLoggable(Level.FINEST)) {
StringBuffer sb = new StringBuffer("bulkread, ep 0x"
+ Integer.toHexString(in_ep_address) + ": " + lenRead
+ " Bytes received: ");

View File

@@ -26,7 +26,7 @@ public class USB {
*/
public static int FULLSPEED_MAX_BULK_PACKET_SIZE = 64;
private static Logger logger = LogUtil.getLogger("ch.ntb.usb");
private static final Logger logger = LogUtil.getLogger("ch.ntb.usb");
private static LinkedList<Device> devices = new LinkedList<Device>();

View File

@@ -33,6 +33,7 @@ public class LogUtil {
Logger logger = manager.getLogger(name);
if (logger == null) {
logger = Logger.getLogger(name);
initLevel(logger, Level.OFF);
manager.addLogger(logger);
}
logger.setLevel(null);