Browse Source

Added logging statements

Bruce Marriner 9 years ago
parent
commit
dd69a7e27f
2 changed files with 4 additions and 0 deletions
  1. 2 0
      voice.go
  2. 2 0
      wsapi.go

+ 2 - 0
voice.go

@@ -126,6 +126,7 @@ func (v *VoiceConnection) Disconnect() (err error) {
 	// Close websocket and udp connections
 	v.Close()
 
+	v.log(LogInformational, "Deleting VoiceConnection %s", v.GuildID)
 	delete(v.session.VoiceConnections, v.GuildID)
 
 	return
@@ -428,6 +429,7 @@ func (v *VoiceConnection) wsHeartbeat(wsConn *websocket.Conn, close <-chan struc
 	var err error
 	ticker := time.NewTicker(i * time.Millisecond)
 	for {
+		v.log(LogDebug, "Sending heartbeat packet")
 		err = wsConn.WriteJSON(voiceHeartbeatOp{3, int(time.Now().Unix())})
 		if err != nil {
 			log.Println("wsHeartbeat send error: ", err)

+ 2 - 0
wsapi.go

@@ -377,6 +377,7 @@ func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (voice *Voi
 	data := voiceChannelJoinOp{4, voiceChannelJoinData{&gID, &cID, mute, deaf}}
 	err = s.wsConn.WriteJSON(data)
 	if err != nil {
+		s.log(LogInformational, "Deleting VoiceConnection %s", gID)
 		delete(s.VoiceConnections, gID)
 		return
 	}
@@ -385,6 +386,7 @@ func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (voice *Voi
 	err = voice.waitUntilConnected()
 	if err != nil {
 		voice.Close()
+		s.log(LogInformational, "Deleting VoiceConnection %s", gID)
 		delete(s.VoiceConnections, gID)
 		return
 	}