|
|
@ -46,14 +46,14 @@ func Report(msg string) {
|
|
|
|
if fn != nil {
|
|
|
|
if fn != nil {
|
|
|
|
reported := lessExecutor.DoOrDiscard(func() {
|
|
|
|
reported := lessExecutor.DoOrDiscard(func() {
|
|
|
|
var builder strings.Builder
|
|
|
|
var builder strings.Builder
|
|
|
|
fmt.Fprintf(&builder, "%s\n", time.Now().Format(timeFormat))
|
|
|
|
builder.WriteString(fmt.Sprintln(time.Now().Format(timeFormat)))
|
|
|
|
if len(clusterName) > 0 {
|
|
|
|
if len(clusterName) > 0 {
|
|
|
|
fmt.Fprintf(&builder, "cluster: %s\n", clusterName)
|
|
|
|
builder.WriteString(fmt.Sprintf("cluster: %s\n", clusterName))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fmt.Fprintf(&builder, "host: %s\n", sysx.Hostname())
|
|
|
|
builder.WriteString(fmt.Sprintf("host: %s\n", sysx.Hostname()))
|
|
|
|
dp := atomic.SwapInt32(&dropped, 0)
|
|
|
|
dp := atomic.SwapInt32(&dropped, 0)
|
|
|
|
if dp > 0 {
|
|
|
|
if dp > 0 {
|
|
|
|
fmt.Fprintf(&builder, "dropped: %d\n", dp)
|
|
|
|
builder.WriteString(fmt.Sprintf("dropped: %d\n", dp))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
builder.WriteString(strings.TrimSpace(msg))
|
|
|
|
builder.WriteString(strings.TrimSpace(msg))
|
|
|
|
fn(builder.String())
|
|
|
|
fn(builder.String())
|
|
|
|