Example #1
0
func (s sessionV2) String() string {
	if !globalJSONFlag {
		message := console.SessionID("%s -> ", s.SessionID)
		message = message + console.Time("[%s]", s.Header.When.Local().Format(printDate))
		message = message + console.Command(" %s %s", s.Header.CommandType, strings.Join(s.Header.CommandArgs, " "))
		return message + "\n"
	}
	sessionMesage := SessionJSONMessage{
		Version:     s.Header.Version,
		SessionID:   s.SessionID,
		Time:        s.Header.When.Local().Format(printDate),
		CommandType: s.Header.CommandType,
		CommandArgs: s.Header.CommandArgs,
	}
	sessionJSONBytes, err := json.MarshalIndent(sessionMesage, "", "\t")
	if err != nil {
		panic(err)
	}
	return console.JSON(string(sessionJSONBytes) + "\n")
}
Example #2
0
func (s sessionV1) String() string {
	message := console.SessionID("%s -> ", s.SessionID)
	message = message + console.Time("[%s]", s.Started.Local().Format(printDate))
	message = message + console.Command(" %s %s", s.CommandType, strings.Join(s.URLs, " "))
	return message
}