func FromClient(msg string) bool
FromClient says if the message is from the client
func FromServer(msg string) bool
FromServer says if the message is from the server
func IsNotify(msg string) bool
IsNotify says if the message is a notification
func Notifs(m string) interface{}
Notifs returns a pointer to a type suitable for Unmarshal
func Requests(m string) interface{}
Requests returns a pointer to a type suitable for Unmarshal
func Responses(m string) []interface{}
Responses returns a slice of types, one of which should be suitable for Unmarshal
Direction is the type of message,
type Direction int
const (
// Clrequest from client to server has method and id
Clrequest Direction = iota
// Clresponse from server to client
Clresponse
// Svrequest from server to client, has method and id
Svrequest
// Svresponse from client to server
Svresponse
// Toserver notification has method, but no id
Toserver
// Toclient notification
Toclient
// Reporterr is an error message
Reporterr // errors have method and id
)
func (d Direction) String() string
String returns a user-useful versin of a Direction
LogHist gets ints, and puts them into buckets: <=10, <=30, 100, 300, 1000, ... It produces a historgram of elapsed times in milliseconds
type LogHist struct {
// contains filtered or unexported fields
}
func (l *LogHist) String() string
String returns a string describing a histogram
Logmsg is the type of a parsed log entry
type Logmsg struct {
Dir Direction
Method string
ID string // for requests/responses. Client and server request ids overlap
Elapsed string // for responses
Hdr string // header. do we need to keep all these strings?
Rest string // the unparsed result, with newlines or not
Body interface{} // the parsed result
}
func ReadLogs(fname string) ([]*Logmsg, error)
ReadLogs from a file. Most users should use TRlog().
Msgtype given method names. Note that mSrv|mCl is possible
type Msgtype int
const (
// Mnot for notifications
Mnot Msgtype = 1
// Mreq for requests
Mreq Msgtype = 2
// Msrv for messages from the server
Msrv Msgtype = 4
// Mcl for messages from the client
Mcl Msgtype = 8
)
Rlog contains the processed logs
type Rlog struct {
Logs []*Logmsg // In the order in the log file
ServerCall map[string]*Logmsg // ID->Request, client->server
ServerReply map[string]*Logmsg // ID->Response, server->client (includes Errors)
ClientCall map[string]*Logmsg
ClientReply map[string]*Logmsg
ClientNotifs []*Logmsg
ServerNotifs []*Logmsg
Histogram *LogHist
}
func ToRlog(fname string) (*Rlog, error)
ToRlog reads a log file and returns a *Rlog
func (r *Rlog) Counts() string
Counts returns a one-line summary of an Rlog