diff options
| author | Will Hawkins <[email protected]> | 2022-08-17 22:07:35 -0400 |
|---|---|---|
| committer | Will Hawkins <[email protected]> | 2022-08-17 22:07:35 -0400 |
| commit | 18bcc4fe73bd8245cde001c939b400693a0d9410 (patch) | |
| tree | 1d38cdb6271153d0bc1ba4ddfc3218722b12ccf7 /datalogger/logger.go | |
| parent | 8d7b3f43988f40976c540e64f955fabe3d14d755 (diff) | |
[Feature] Add TCP information (RTT and Cwnd) to Logging
This patch adds support for logging the underlying RTT and Cwnd of the
TCP connection used when doing probes. More work to follow in order to
add support for this information on Windows and Darwin.
Diffstat (limited to 'datalogger/logger.go')
| -rw-r--r-- | datalogger/logger.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/datalogger/logger.go b/datalogger/logger.go index 1a4cd20..6236b59 100644 --- a/datalogger/logger.go +++ b/datalogger/logger.go @@ -66,19 +66,20 @@ func doCustomFormatting(value reflect.Value, tag reflect.StructTag) (string, err } formatMethodArgument, success := tag.Lookup("FormatterArgument") if !success { - return "", fmt.Errorf("Could not find the formatter name") + formatMethodArgument = "" } formatMethod := value.MethodByName(formatMethodName) if formatMethod == reflect.ValueOf(0) { return "", fmt.Errorf("Type %v does not support a method named %v", value.Type(), formatMethodName) } - - formatMethodArgumentUsable := make([]reflect.Value, 1) - formatMethodArgumentUsable[0] = reflect.ValueOf(formatMethodArgument) + var formatMethodArgumentUsable []reflect.Value = make([]reflect.Value, 0) + if formatMethodArgument != "" { + formatMethodArgumentUsable = append(formatMethodArgumentUsable, reflect.ValueOf(formatMethodArgument)) + } result := formatMethod.Call(formatMethodArgumentUsable) if len(result) == 1 { - return result[0].String(), nil + return fmt.Sprintf("%v", result[0]), nil } return "", fmt.Errorf("Too many results returned by the format method's invocation.") } |
