- ctx.LogI("call-start", sds, "connected")
- state.Wait()
- ctx.LogI("call-finish", SDS{
- "node": state.Node.Id,
- "duration": int64(state.Duration.Seconds()),
- "rxbytes": state.RxBytes,
- "txbytes": state.TxBytes,
- "rxspeed": state.RxSpeed,
- "txspeed": state.TxSpeed,
- }, "")
- isGood = true
+ ctx.LogI("call-started", les, func(les LEs) string {
+ return fmt.Sprintf("Connection to %s (%s)", node.Name, addr)
+ })
+ isGood = state.Wait()
+ ctx.LogI("call-finished", append(
+ les,
+ LE{"Duration", int64(state.Duration.Seconds())},
+ LE{"RxBytes", state.RxBytes},
+ LE{"RxSpeed", state.RxSpeed},
+ LE{"TxBytes", state.TxBytes},
+ LE{"TxSpeed", state.TxSpeed},
+ ), func(les LEs) string {
+ return fmt.Sprintf(
+ "Finished call with %s (%d:%d:%d): %s received (%s/sec), %s transferred (%s/sec)",
+ 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)),
+ )
+ })