Created LimeLog as a wrapper around javas logger

This commit is contained in:
Aaron Neyer 2014-01-12 20:01:23 -05:00
parent ab1e47edb4
commit f95cd60cfd
5 changed files with 36 additions and 7 deletions

View File

@ -0,0 +1,25 @@
package com.limelight;
import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Logger;
public class LimeLog {
private static final Logger LOGGER = Logger.getLogger(LimeLog.class.getName());
public static void info(String msg) {
LOGGER.info(msg);
}
public static void warning(String msg) {
LOGGER.warning(msg);
}
public static void severe(String msg) {
LOGGER.severe(msg);
}
public static void setFileHandler(String fileName) throws IOException {
LOGGER.addHandler(new FileHandler(fileName));
}
}

View File

@ -12,6 +12,7 @@ import java.util.concurrent.TimeUnit;
import org.xmlpull.v1.XmlPullParserException;
import com.limelight.LimeLog;
import com.limelight.nvstream.av.audio.AudioStream;
import com.limelight.nvstream.av.audio.AudioRenderer;
import com.limelight.nvstream.av.video.VideoDecoderRenderer;
@ -173,7 +174,7 @@ public class NvConnection {
throw e;
}
}
System.out.println("Resumed existing game session");
LimeLog.info("Resumed existing game session");
}
else {
// Launch the app since it's not running
@ -183,7 +184,7 @@ public class NvConnection {
listener.displayMessage("Failed to launch application");
return false;
}
System.out.println("Launched new game session");
LimeLog.info("Launched new game session");
}
return true;

View File

@ -2,6 +2,7 @@ package com.limelight.nvstream.av.audio;
import java.util.concurrent.LinkedBlockingQueue;
import com.limelight.LimeLog;
import com.limelight.nvstream.av.ByteBufferDescriptor;
import com.limelight.nvstream.av.RtpPacket;
@ -26,7 +27,7 @@ public class AudioDepacketizer {
// Put it on the decoded queue
if (!decodedUnits.offer(new ByteBufferDescriptor(pcmData, 0, decodeLen))) {
System.out.println("Audio player too slow! Forced to drop decoded samples");
LimeLog.warning("Audio player too slow! Forced to drop decoded samples");
// Clear out the queue
decodedUnits.clear();
}
@ -47,7 +48,7 @@ public class AudioDepacketizer {
if (lastSequenceNumber != 0 &&
(short)(lastSequenceNumber + 1) != seq)
{
System.out.println("Received OOS audio data (expected "+(lastSequenceNumber + 1)+", got "+seq+")");
LimeLog.warning("Received OOS audio data (expected "+(lastSequenceNumber + 1)+", got "+seq+")");
decodeData(null, 0, 0);
}

View File

@ -3,6 +3,7 @@ package com.limelight.nvstream.av.video;
import java.util.LinkedList;
import java.util.concurrent.LinkedBlockingQueue;
import com.limelight.LimeLog;
import com.limelight.nvstream.av.ByteBufferDescriptor;
import com.limelight.nvstream.av.DecodeUnit;
import com.limelight.nvstream.av.RtpPacket;
@ -45,7 +46,7 @@ public class VideoDepacketizer {
DecodeUnit du = new DecodeUnit(DecodeUnit.TYPE_H264, avcNalDataChain, avcNalDataLength, 0);
if (!decodedUnits.offer(du)) {
// We need a new IDR frame since we're discarding data now
System.out.println("Video decoder is too slow! Forced to drop decode units");
LimeLog.warning("Video decoder is too slow! Forced to drop decode units");
decodedUnits.clear();
controlListener.connectionNeedsResync();
}
@ -207,7 +208,7 @@ public class VideoDepacketizer {
if (lastSequenceNumber != 0 &&
(short)(lastSequenceNumber + 1) != seq)
{
System.out.println("Received OOS video data (expected "+(lastSequenceNumber + 1)+", got "+seq+")");
LimeLog.warning("Received OOS video data (expected "+(lastSequenceNumber + 1)+", got "+seq+")");
// Reset the depacketizer state
clearAvcNalState();

View File

@ -9,6 +9,7 @@ import java.net.Socket;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import com.limelight.LimeLog;
import com.limelight.nvstream.NvConnectionListener;
import com.limelight.nvstream.StreamConfiguration;
import com.limelight.nvstream.av.ConnectionStatusListener;
@ -133,7 +134,7 @@ public class ControlStream implements ConnectionStatusListener {
public void requestResync() throws IOException
{
System.out.println("CTL: Requesting IDR frame");
LimeLog.info("CTL: Requesting IDR frame");
sendResync();
}