improve qlogging of transport errors

This commit is contained in:
Marten Seemann
2020-03-28 14:39:40 +07:00
parent b9ab1d172d
commit cc737b4b11
4 changed files with 96 additions and 5 deletions

View File

@@ -236,8 +236,12 @@ func marshalConnectionCloseFrame(enc *gojay.Encoder, f *wire.ConnectionCloseFram
}
enc.StringKey("frame_type", "connection_close")
enc.StringKey("error_space", errorSpace)
enc.Int64Key("error_code", int64(f.ErrorCode))
enc.Int64Key("raw_error_code", int64(f.ErrorCode))
if errName := transportError(f.ErrorCode).String(); len(errName) > 0 {
enc.StringKey("error_code", errName)
} else {
enc.Uint64Key("error_code", uint64(f.ErrorCode))
}
enc.Uint64Key("raw_error_code", uint64(f.ErrorCode))
enc.StringKey("reason", f.ReasonPhrase)
}