Documentation
¶
Overview ¶
Package termlog writes a terminal session's log: the lines of its output as the terminal showed them, each with its time if asked, or the bytes it printed as they came, in a file of its own, under a folder of the host's. What is typed is never written, only what the session printed.
Index ¶
- Variables
- func SafeName(name string) string
- type Header
- type Options
- type Recorder
- func (r *Recorder) Close(tail string, now time.Time) error
- func (r *Recorder) Err() error
- func (r *Recorder) Line(text string, wrapped bool)
- func (r *Recorder) Mark(text string, now time.Time)
- func (r *Recorder) Path() string
- func (r *Recorder) Raw(p []byte)
- func (r *Recorder) Size() int64
- func (r *Recorder) Started() time.Time
Constants ¶
This section is empty.
Variables ¶
var ErrBacklog = errors.New("termlog: the log file is not keeping up")
ErrBacklog means the log fell too far behind its file, which stopped taking what was written: the log stops rather than hold it all.
Functions ¶
Types ¶
type Header ¶
type Header struct {
// Name is the host's name, which also names its folder.
Name string
// Target is where it connects to, as user@host:port; "" for none.
Target string
}
Header is what the first line of a log says about its session.
type Options ¶
type Options struct {
// Raw keeps the bytes printed, escape sequences and all (Raw), not the
// lines shown (Line).
Raw bool
// Stamps starts each line with the time it was left.
Stamps bool
}
Options are how a log is written.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder writes one session's log. Line and Close may be called from any goroutine; Line never waits for the file.
func Start ¶
Start creates a log for the session h names, at now, in a folder of its own under dir; changed, when set, is told as it grows or fails.
func (*Recorder) Close ¶
Close ends the log at now with tail, the line the session was on (not in a raw log, which has it already), and waits for the file: the error is why it failed, if it did.
func (*Recorder) Line ¶
Line adds a line of output; wrapped says the next goes on in it, as vt.Terminal.SetLineHook tells.