Skip to content

Commit

Permalink
Add debugging output.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Rebhan committed Jun 24, 2021
1 parent 3c0f152 commit 18569ee
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugins/inputs/dovecot/dovecot.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,14 @@ func (d *Dovecot) gatherServer(addr string, acc telegraf.Accumulator, qtype stri
return fmt.Errorf("writing message %q failed for dovecot server '%s': %s", msg, addr, err)
}
var buf bytes.Buffer
start := time.Now()
if _, err := io.Copy(&buf, c); err != nil {
return fmt.Errorf("copying message failed for dovecot server '%s': %s", addr, err)
fmt.Printf("copying message failed after %v for dovecot server '%s': %s", time.Since(start), addr, err)
fmt.Printf(" --> is net.Error: %v", errors.Is(err, net.Error))
if nerr, ok := err.(net.Error); ok {
fmt.Printf(" --> is timeout: %v", nerr.Timeout())
}
//return fmt.Errorf("copying message failed for dovecot server '%s': %s", addr, err)
}

var host string
Expand Down

0 comments on commit 18569ee

Please sign in to comment.