Documentation ¶
Overview ¶
Package ttylog contains utilities to log and play back TTY sessions.
Index ¶
- Constants
- Variables
- func Replay(recording LogSource, callback LogSink) (err error)
- type AsciicastLogSource
- type Close
- type FD
- type IO
- type LogSink
- type LogSource
- type MockFdDir
- type MockFdOp
- type Recorder
- type TTYLogEntry
- func (*TTYLogEntry) Descriptor() ([]byte, []int)deprecated
- func (x *TTYLogEntry) GetClose() *Close
- func (m *TTYLogEntry) GetEvent() isTTYLogEntry_Event
- func (x *TTYLogEntry) GetIo() *IO
- func (x *TTYLogEntry) GetTimestampMicros() int64
- func (*TTYLogEntry) ProtoMessage()
- func (x *TTYLogEntry) ProtoReflect() protoreflect.Message
- func (x *TTYLogEntry) Reset()
- func (x *TTYLogEntry) String() string
- type TTYLogEntry_Close
- type TTYLogEntry_Io
- type UMLLogSource
Constants ¶
const AsciicastFileExt = "cast"
AsciicastFileExt holds the suggested file extension for asciicast files.
Variables ¶
var ( FD_name = map[int32]string{ 0: "STDIN", 1: "STDOUT", 2: "STDERR", } FD_value = map[string]int32{ "STDIN": 0, "STDOUT": 1, "STDERR": 2, } )
Enum value maps for FD.
var File_ttylog_proto protoreflect.FileDescriptor
Functions ¶
Types ¶
type AsciicastLogSource ¶
type AsciicastLogSource struct {
// contains filtered or unexported fields
}
func NewAsciicastLogSource ¶
func NewAsciicastLogSource(r io.Reader) *AsciicastLogSource
NewAsciicastLogSource reads log events from an Asciicast formatted file.
func (*AsciicastLogSource) Next ¶
func (log *AsciicastLogSource) Next() (*TTYLogEntry, error)
Next gets the next log entry, it returns io.EOF if there are no more.
type Close ¶
type Close struct { Fd FD `protobuf:"varint,1,opt,name=fd,proto3,enum=FD" json:"fd,omitempty"` // contains filtered or unexported fields }
Closure of an FD.
func (*Close) Descriptor
deprecated
func (*Close) ProtoMessage ¶
func (*Close) ProtoMessage()
func (*Close) ProtoReflect ¶
func (x *Close) ProtoReflect() protoreflect.Message
type FD ¶
type FD int32
The FD that the event was written to.
func (FD) Descriptor ¶
func (FD) Descriptor() protoreflect.EnumDescriptor
func (FD) EnumDescriptor
deprecated
func (FD) Number ¶
func (x FD) Number() protoreflect.EnumNumber
func (FD) Type ¶
func (FD) Type() protoreflect.EnumType
type IO ¶
type IO struct { Fd FD `protobuf:"varint,1,opt,name=fd,proto3,enum=FD" json:"fd,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
I/O event on an FD.
func (*IO) Descriptor
deprecated
func (*IO) ProtoMessage ¶
func (*IO) ProtoMessage()
func (*IO) ProtoReflect ¶
func (x *IO) ProtoReflect() protoreflect.Message
type LogSink ¶
type LogSink func(t *TTYLogEntry) error
LogSink receives log events.
func NewAsciicastLogSink ¶
NewAsciicastLogSink creates a LogSink compatible with the asciicast v2 format.
See: https://github.com/asciinema/asciinema/blob/develop/doc/asciicast-v2.md
func NewClientOutput ¶
NewClientOutput writes stdout and stderr to the given writer
func NewKippoQuirksAdapter ¶
NewKippoQuirksAdapter fixes quirks in log events that come from Kippo.
func NewRealTimePlayback ¶
NewRealTimePlayback plays back the results in real-time. If maxSleep > 0, it's used as the maximum duration to pause.
func NewUMLLogSink ¶
NewUMLLogSink creates a LogSink compatible with the user-mode-linux TTY.
type LogSource ¶
type LogSource interface { // Next fetches the next available log entry. It reutrns io.EOF if the source // has no more log entries. Next() (*TTYLogEntry, error) }
LogSource adapts log readers.
type Recorder ¶
type Recorder struct { *vos.VIOAdapter // contains filtered or unexported fields }
type TTYLogEntry ¶
type TTYLogEntry struct { // Timestamp of the log event in micros since the UNIX epoch. TimestampMicros int64 `protobuf:"varint,1,opt,name=timestamp_micros,json=timestampMicros,proto3" json:"timestamp_micros,omitempty"` // Types that are assignable to Event: // *TTYLogEntry_Io // *TTYLogEntry_Close Event isTTYLogEntry_Event `protobuf_oneof:"event"` // contains filtered or unexported fields }
func (*TTYLogEntry) Descriptor
deprecated
func (*TTYLogEntry) Descriptor() ([]byte, []int)
Deprecated: Use TTYLogEntry.ProtoReflect.Descriptor instead.
func (*TTYLogEntry) GetClose ¶
func (x *TTYLogEntry) GetClose() *Close
func (*TTYLogEntry) GetEvent ¶
func (m *TTYLogEntry) GetEvent() isTTYLogEntry_Event
func (*TTYLogEntry) GetIo ¶
func (x *TTYLogEntry) GetIo() *IO
func (*TTYLogEntry) GetTimestampMicros ¶
func (x *TTYLogEntry) GetTimestampMicros() int64
func (*TTYLogEntry) ProtoMessage ¶
func (*TTYLogEntry) ProtoMessage()
func (*TTYLogEntry) ProtoReflect ¶
func (x *TTYLogEntry) ProtoReflect() protoreflect.Message
func (*TTYLogEntry) Reset ¶
func (x *TTYLogEntry) Reset()
func (*TTYLogEntry) String ¶
func (x *TTYLogEntry) String() string
type TTYLogEntry_Close ¶
type TTYLogEntry_Close struct {
Close *Close `protobuf:"bytes,3,opt,name=close,proto3,oneof"`
}
type TTYLogEntry_Io ¶
type TTYLogEntry_Io struct {
Io *IO `protobuf:"bytes,2,opt,name=io,proto3,oneof"`
}
type UMLLogSource ¶
type UMLLogSource struct {
// contains filtered or unexported fields
}
UMLLogSource parses log events from a user-mode-linux/Kippo formatted file.
func NewUMLLogSource ¶
func NewUMLLogSource(r io.Reader) *UMLLogSource
NewUMLLogSource reads log events from a user-mode-linux/Kippo formatted file.
func (*UMLLogSource) Next ¶
func (log *UMLLogSource) Next() (*TTYLogEntry, error)
Next gets the next log entry, it returns io.EOF if there are no more.