Skip to content

Commit 53becca

Browse files
committed
Harmonize capitalization of log messages
1 parent 794e03f commit 53becca

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

agent.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ func (a *Agent) setSelectedPair(p *CandidatePair) {
535535
}
536536

537537
func (a *Agent) pingAllCandidates() {
538-
a.log.Trace("pinging all candidates")
538+
a.log.Trace("Pinging all candidates")
539539

540540
if len(a.checklist) == 0 {
541541
a.log.Warn("Failed to ping without candidate pairs. Connection is not possible yet.")
@@ -549,7 +549,7 @@ func (a *Agent) pingAllCandidates() {
549549
}
550550

551551
if p.bindingRequestCount > a.maxBindingRequests {
552-
a.log.Tracef("max requests reached for pair %s, marking it as failed", p)
552+
a.log.Tracef("Maximum requests reached for pair %s, marking it as failed", p)
553553
p.state = CandidatePairStateFailed
554554
} else {
555555
a.selector.PingCandidate(p.Local, p.Remote)
@@ -959,7 +959,7 @@ func (a *Agent) findRemoteCandidate(networkType NetworkType, addr net.Addr) Cand
959959
}
960960

961961
func (a *Agent) sendBindingRequest(m *stun.Message, local, remote Candidate) {
962-
a.log.Tracef("ping STUN from %s to %s", local.String(), remote.String())
962+
a.log.Tracef("Ping STUN from %s to %s", local.String(), remote.String())
963963

964964
a.invalidatePendingBindingRequests(time.Now())
965965
a.pendingBindingRequests = append(a.pendingBindingRequests, bindingRequest{
@@ -1041,7 +1041,7 @@ func (a *Agent) handleInbound(m *stun.Message, local Candidate, remote net.Addr)
10411041
!(m.Type.Class == stun.ClassSuccessResponse ||
10421042
m.Type.Class == stun.ClassRequest ||
10431043
m.Type.Class == stun.ClassIndication) {
1044-
a.log.Tracef("unhandled STUN from %s to %s class(%s) method(%s)", remote, local, m.Type.Class, m.Type.Method)
1044+
a.log.Tracef("Unhandled STUN from %s to %s class(%s) method(%s)", remote, local, m.Type.Class, m.Type.Method)
10451045
return
10461046
}
10471047

@@ -1109,7 +1109,7 @@ func (a *Agent) handleInbound(m *stun.Message, local Candidate, remote net.Addr)
11091109
a.addRemoteCandidate(remoteCandidate)
11101110
}
11111111

1112-
a.log.Tracef("inbound STUN (Request) from %s to %s", remote.String(), local.String())
1112+
a.log.Tracef("Inbound STUN (Request) from %s to %s", remote.String(), local.String())
11131113

11141114
a.selector.HandleBindingRequest(m, local, remoteCandidate)
11151115
}

candidatepair.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,6 @@ func (p *CandidatePair) Write(b []byte) (int, error) {
9797
func (a *Agent) sendSTUN(msg *stun.Message, local, remote Candidate) {
9898
_, err := local.writeTo(msg.Raw, remote)
9999
if err != nil {
100-
a.log.Tracef("failed to send STUN message: %s", err)
100+
a.log.Tracef("Failed to send STUN message: %s", err)
101101
}
102102
}

selection.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (s *controllingSelector) ContactCandidates() {
5151
switch {
5252
case s.agent.getSelectedPair() != nil:
5353
if s.agent.validateSelectedPair() {
54-
s.log.Trace("checking keepalive")
54+
s.log.Trace("Checking keepalive")
5555
s.agent.checkKeepalive()
5656
}
5757
case s.nominatedPair != nil:
@@ -87,7 +87,7 @@ func (s *controllingSelector) nominatePair(pair *CandidatePair) {
8787
return
8888
}
8989

90-
s.log.Tracef("ping STUN (nominate candidate pair) from %s to %s", pair.Local.String(), pair.Remote.String())
90+
s.log.Tracef("Ping STUN (nominate candidate pair) from %s to %s", pair.Local.String(), pair.Remote.String())
9191
s.agent.sendBindingRequest(msg, pair.Local, pair.Remote)
9292
}
9393

@@ -130,7 +130,7 @@ func (s *controllingSelector) HandleSuccessResponse(m *stun.Message, local, remo
130130
return
131131
}
132132

133-
s.log.Tracef("inbound STUN (SuccessResponse) from %s to %s", remote.String(), local.String())
133+
s.log.Tracef("Inbound STUN (SuccessResponse) from %s to %s", remote.String(), local.String())
134134
p := s.agent.findPair(local, remote)
135135

136136
if p == nil {
@@ -173,7 +173,7 @@ func (s *controlledSelector) Start() {
173173
func (s *controlledSelector) ContactCandidates() {
174174
if s.agent.getSelectedPair() != nil {
175175
if s.agent.validateSelectedPair() {
176-
s.log.Trace("checking keepalive")
176+
s.log.Trace("Checking keepalive")
177177
s.agent.checkKeepalive()
178178
}
179179
} else {
@@ -221,7 +221,7 @@ func (s *controlledSelector) HandleSuccessResponse(m *stun.Message, local, remot
221221
return
222222
}
223223

224-
s.log.Tracef("inbound STUN (SuccessResponse) from %s to %s", remote.String(), local.String())
224+
s.log.Tracef("Inbound STUN (SuccessResponse) from %s to %s", remote.String(), local.String())
225225

226226
p := s.agent.findPair(local, remote)
227227
if p == nil {
@@ -237,7 +237,7 @@ func (s *controlledSelector) HandleSuccessResponse(m *stun.Message, local, remot
237237
(selectedPair != p && selectedPair.priority() <= p.priority()) {
238238
s.agent.setSelectedPair(p)
239239
} else if selectedPair != p {
240-
s.log.Tracef("ignore nominate new pair %s, already nominated pair %s", p, selectedPair)
240+
s.log.Tracef("Ignore nominate new pair %s, already nominated pair %s", p, selectedPair)
241241
}
242242
}
243243
}
@@ -262,7 +262,7 @@ func (s *controlledSelector) HandleBindingRequest(m *stun.Message, local, remote
262262
(selectedPair != p && selectedPair.priority() <= p.priority()) {
263263
s.agent.setSelectedPair(p)
264264
} else if selectedPair != p {
265-
s.log.Tracef("ignore nominate new pair %s, already nominated pair %s", p, selectedPair)
265+
s.log.Tracef("Ignore nominate new pair %s, already nominated pair %s", p, selectedPair)
266266
}
267267
} else {
268268
// If the received Binding request triggered a new check to be

tcp_mux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func (m *TCPMuxDefault) handleConn(conn net.Conn) {
191191
}
192192

193193
for _, attr := range msg.Attributes {
194-
m.params.Logger.Debugf("msg attr: %s", attr.String())
194+
m.params.Logger.Debugf("Message attribute: %s", attr.String())
195195
}
196196

197197
attr, err := msg.Get(stun.AttrUsername)

tcp_packet_conn.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ func (bc *bufferedConn) writeProcess() {
5656
}
5757

5858
if err != nil {
59-
bc.logger.Warnf("read buffer error: %s", err)
59+
bc.logger.Warnf("Failed to read from buffer: %s", err)
6060
continue
6161
}
6262

6363
if _, err := bc.Conn.Write(pktBuf[:n]); err != nil {
64-
bc.logger.Warnf("write error: %s", err)
64+
bc.logger.Warnf("Failed to write: %s", err)
6565
continue
6666
}
6767
}

udp_mux.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func NewUDPMuxDefault(params UDPMuxParams) *UDPMuxDefault {
8989
if params.Net == nil {
9090
var err error
9191
if params.Net, err = stdnet.NewNet(); err != nil {
92-
params.Logger.Errorf("failed to get create network: %v", err)
92+
params.Logger.Errorf("Failed to get create network: %v", err)
9393
}
9494
}
9595

@@ -99,7 +99,7 @@ func NewUDPMuxDefault(params UDPMuxParams) *UDPMuxDefault {
9999
localAddrsForUnspecified = append(localAddrsForUnspecified, &net.UDPAddr{IP: ip, Port: addr.Port})
100100
}
101101
} else {
102-
params.Logger.Errorf("failed to get local interfaces for unspecified addr: %v", err)
102+
params.Logger.Errorf("Failed to get local interfaces for unspecified addr: %v", err)
103103
}
104104
}
105105
}
@@ -290,15 +290,15 @@ func (m *UDPMuxDefault) connWorker() {
290290
if os.IsTimeout(err) {
291291
continue
292292
} else if !errors.Is(err, io.EOF) {
293-
logger.Errorf("could not read udp packet: %v", err)
293+
logger.Errorf("Failed to read UDP packet: %v", err)
294294
}
295295

296296
return
297297
}
298298

299299
udpAddr, ok := addr.(*net.UDPAddr)
300300
if !ok {
301-
logger.Errorf("underlying PacketConn did not return a UDPAddr")
301+
logger.Errorf("Underlying PacketConn did not return a UDPAddr")
302302
return
303303
}
304304

@@ -333,12 +333,12 @@ func (m *UDPMuxDefault) connWorker() {
333333
}
334334

335335
if destinationConn == nil {
336-
m.params.Logger.Tracef("dropping packet from %s, addr: %s", udpAddr.String(), addr.String())
336+
m.params.Logger.Tracef("Dropping packet from %s, addr: %s", udpAddr.String(), addr.String())
337337
continue
338338
}
339339

340340
if err = destinationConn.writePacket(buf[:n], udpAddr); err != nil {
341-
m.params.Logger.Errorf("could not write packet: %v", err)
341+
m.params.Logger.Errorf("Failed to write packet: %v", err)
342342
}
343343
}
344344
}

0 commit comments

Comments
 (0)