Documentation
¶
Overview ¶
Package progress reports the progress of messages send and its performance metrics.
A Reporter draws a progress bar, with the counts and an ETA, on stderr when progress was asked for, stderr is a terminal that acts on escape sequences and debug mode is off. In debug mode it logs each update as a debug line instead; otherwise it shows nothing. While the bar is drawn, everything else written to stderr goes through Writer, which moves the bar below it. Finish returns the send's Stats, which ShowMetrics prints.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShowMetrics ¶
ShowMetrics displays performance metrics
Types ¶
type Reporter ¶
type Reporter struct {
// contains filtered or unexported fields
}
Reporter handles progress reporting for batch operations. Its methods may be called from several goroutines.
func NewReporter ¶
NewReporter creates a progress reporter that draws on output, stderr.
func (*Reporter) Record ¶ added in v0.3.0
Record reports the result of a finished send job: how many of its recipients were sent, how many failed and how many are of unknown outcome. The progress bar always shows the latest count.
func (*Reporter) Writer ¶ added in v0.3.0
Writer returns the writer of w, the output the reporter draws on, for everything else written to it while the bar may be drawn, such as notices and logs. Each write clears the bar's line first and draws the bar again below it, so neither runs into the other. Without a bar, it is w.
type Stats ¶
type Stats struct {
Total int
Sent int
Failed int
Unknown int
SuccessRate float64
Duration time.Duration
EmailsPerSec float64
}
Stats holds performance metrics. Unknown counts the recipients whose outcome is unknown: they may have been sent. SuccessRate is the share of the recipients with a result, sent, failed or unknown, that were sent.