- ctx.LogI("call-finish", nncp.SDS{
- "node": state.Node.Id,
- "duration": int64(state.Duration.Seconds()),
- "rxbytes": state.RxBytes,
- "txbytes": state.TxBytes,
- "rxspeed": state.RxSpeed,
- "txspeed": state.TxSpeed,
- }, "")
+ ctx.LogI("call-finished", nncp.LEs{
+ {K: "Node", V: state.Node.Id},
+ {K: "Duration", V: int64(state.Duration.Seconds())},
+ {K: "RxBytes", V: state.RxBytes},
+ {K: "TxBytes", V: state.TxBytes},
+ {K: "RxSpeed", V: state.RxSpeed},
+ {K: "TxSpeed", V: state.TxSpeed},
+ }, func(les nncp.LEs) string {
+ return fmt.Sprintf(
+ "Finished call with %s (%d:%d:%d): %s received (%s/sec), %s transferred (%s/sec)",
+ state.Node.Name,
+ int(state.Duration.Hours()),
+ int(state.Duration.Minutes()),
+ int(state.Duration.Seconds())%60,
+ humanize.IBytes(uint64(state.RxBytes)),
+ humanize.IBytes(uint64(state.RxSpeed)),
+ humanize.IBytes(uint64(state.TxBytes)),
+ humanize.IBytes(uint64(state.TxSpeed)),
+ )
+ })