1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-18 14:47:03 +00:00

Improve the readability of some log messages

This patch contains a few changes to logging messages, to improve log
readability.

While at it, an obsolete TODO in the SMTP courier is removed.
This commit is contained in:
Alberto Bertogli
2016-10-24 10:49:49 +01:00
parent 60a7932bd3
commit 1bc111f783
6 changed files with 41 additions and 45 deletions

View File

@@ -32,11 +32,11 @@ func TestLogger(t *testing.T) {
buf.Reset()
l.Auth(netAddr, "user@domain", false)
expect(t, buf, "1.2.3.4:4321 authentication failed for user@domain")
expect(t, buf, "1.2.3.4:4321 auth failed for user@domain")
buf.Reset()
l.Auth(netAddr, "user@domain", true)
expect(t, buf, "1.2.3.4:4321 authentication successful for user@domain")
expect(t, buf, "1.2.3.4:4321 auth succeeded for user@domain")
buf.Reset()
l.Rejected(netAddr, "from", []string{"to1", "to2"}, "error")
@@ -48,23 +48,23 @@ func TestLogger(t *testing.T) {
buf.Reset()
l.SendAttempt("qid", "from", "to", nil, false)
expect(t, buf, "qid from=from to=to sent successfully")
expect(t, buf, "qid from=from to=to sent")
buf.Reset()
l.SendAttempt("qid", "from", "to", fmt.Errorf("error"), false)
expect(t, buf, "qid from=from to=to sent failed (temporary): error")
expect(t, buf, "qid from=from to=to failed (temporary): error")
buf.Reset()
l.SendAttempt("qid", "from", "to", fmt.Errorf("error"), true)
expect(t, buf, "qid from=from to=to sent failed (permanent): error")
expect(t, buf, "qid from=from to=to failed (permanent): error")
buf.Reset()
l.QueueLoop("qid", 17*time.Second)
expect(t, buf, "qid completed loop, next in 17s")
l.QueueLoop("qid", "from", 17*time.Second)
expect(t, buf, "qid from=from completed loop, next in 17s")
buf.Reset()
l.QueueLoop("qid", 0)
expect(t, buf, "qid all done")
l.QueueLoop("qid", "from", 0)
expect(t, buf, "qid from=from all done")
buf.Reset()
}
@@ -79,11 +79,11 @@ func TestDefault(t *testing.T) {
buf.Reset()
Auth(netAddr, "user@domain", false)
expect(t, buf, "1.2.3.4:4321 authentication failed for user@domain")
expect(t, buf, "1.2.3.4:4321 auth failed for user@domain")
buf.Reset()
Auth(netAddr, "user@domain", true)
expect(t, buf, "1.2.3.4:4321 authentication successful for user@domain")
expect(t, buf, "1.2.3.4:4321 auth succeeded for user@domain")
buf.Reset()
Rejected(netAddr, "from", []string{"to1", "to2"}, "error")
@@ -95,22 +95,22 @@ func TestDefault(t *testing.T) {
buf.Reset()
SendAttempt("qid", "from", "to", nil, false)
expect(t, buf, "qid from=from to=to sent successfully")
expect(t, buf, "qid from=from to=to sent")
buf.Reset()
SendAttempt("qid", "from", "to", fmt.Errorf("error"), false)
expect(t, buf, "qid from=from to=to sent failed (temporary): error")
expect(t, buf, "qid from=from to=to failed (temporary): error")
buf.Reset()
SendAttempt("qid", "from", "to", fmt.Errorf("error"), true)
expect(t, buf, "qid from=from to=to sent failed (permanent): error")
expect(t, buf, "qid from=from to=to failed (permanent): error")
buf.Reset()
QueueLoop("qid", 17*time.Second)
expect(t, buf, "qid completed loop, next in 17s")
QueueLoop("qid", "from", 17*time.Second)
expect(t, buf, "qid from=from completed loop, next in 17s")
buf.Reset()
QueueLoop("qid", 0)
expect(t, buf, "qid all done")
QueueLoop("qid", "from", 0)
expect(t, buf, "qid from=from all done")
buf.Reset()
}