log timestamps

This commit is contained in:
Marten Seemann
2017-05-15 15:00:17 +08:00
parent 82ce3b221b
commit 7e256e0ebe
6 changed files with 57 additions and 14 deletions

View File

@@ -393,9 +393,9 @@ func (s *session) handlePacketImpl(p *receivedPacket) error {
packet, err := s.unpacker.Unpack(hdr.Raw, hdr, data)
if utils.Debug() {
if err != nil {
utils.Debugf("<- Reading packet 0x%x (%d bytes) for connection %x @ %s", hdr.PacketNumber, len(data)+len(hdr.Raw), hdr.ConnectionID, time.Now().Format("15:04:05.000"))
utils.Debugf("<- Reading packet 0x%x (%d bytes) for connection %x", hdr.PacketNumber, len(data)+len(hdr.Raw), hdr.ConnectionID)
} else {
utils.Debugf("<- Reading packet 0x%x (%d bytes) for connection %x, %s @ %s", hdr.PacketNumber, len(data)+len(hdr.Raw), hdr.ConnectionID, packet.encryptionLevel, time.Now().Format("15:04:05.000"))
utils.Debugf("<- Reading packet 0x%x (%d bytes) for connection %x, %s", hdr.PacketNumber, len(data)+len(hdr.Raw), hdr.ConnectionID, packet.encryptionLevel)
}
}
// if the decryption failed, this might be a packet sent by an attacker
@@ -735,7 +735,7 @@ func (s *session) logPacket(packet *packedPacket) {
return
}
if utils.Debug() {
utils.Debugf("-> Sending packet 0x%x (%d bytes), %s, @ %s", packet.number, len(packet.raw), packet.encryptionLevel, time.Now().Format("15:04:05.000"))
utils.Debugf("-> Sending packet 0x%x (%d bytes), %s", packet.number, len(packet.raw), packet.encryptionLevel)
for _, frame := range packet.frames {
frames.LogFrame(frame, true)
}