Added packetRecord function to allow easy recording of packets to logfile