Documentation ¶
Overview ¶
A central logstore.
Motivation and spec: https://github.com/tilt-dev/tilt.specs/pull/19
Index ¶
- func SourcePrefix(n model.ManifestName) string
- type Checkpoint
- type LogEvent
- type LogLine
- type LogSegment
- type LogStore
- func (s *LogStore) Append(le LogEvent, secrets model.SecretSet)
- func (s *LogStore) Checkpoint() Checkpoint
- func (s *LogStore) ContinuingLines(checkpoint Checkpoint) []LogLine
- func (s *LogStore) ContinuingString(checkpoint Checkpoint) string
- func (s *LogStore) Empty() bool
- func (s *LogStore) IsLastSegmentUncompleted() bool
- func (s *LogStore) ManifestLog(mn model.ManifestName) string
- func (s *LogStore) ScrubSecretsStartingAt(secrets model.SecretSet, checkpoint Checkpoint)
- func (s *LogStore) SpanLog(spanID SpanID) string
- func (s *LogStore) String() string
- func (s *LogStore) Tail(n int) string
- func (s *LogStore) TailSpan(n int, spanID SpanID) string
- func (s *LogStore) ToLogList(fromCheckpoint Checkpoint) (*webview.LogList, error)
- func (s *LogStore) Warnings(spanID SpanID) []string
- type Reader
- func (r Reader) Checkpoint() Checkpoint
- func (r Reader) ContinuingLines(c Checkpoint) []LogLine
- func (r Reader) ContinuingString(c Checkpoint) string
- func (r Reader) Empty() bool
- func (r Reader) String() string
- func (r Reader) Tail(n int) string
- func (r Reader) TailSpan(n int, spanID SpanID) string
- func (r Reader) Warnings(spanID SpanID) []string
- type Span
- type SpanID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SourcePrefix ¶
func SourcePrefix(n model.ManifestName) string
Types ¶
type Checkpoint ¶
type Checkpoint int
An abstract checkpoint in the log store, so we can ask questions like "give me all logs since checkpoint X" and "scrub everything since checkpoint Y". In practice, this is just an index into the segment slice.
type LogLine ¶ added in v0.14.0
type LogLine struct { Text string SpanID SpanID ProgressID string // Most progress lines are optional. For example, if a bunch // of little upload updates come in, it's ok to skip some. // // ProgressMustPrint indicates that this line must appear in the // output - e.g., a line that communicates that the upload finished. ProgressMustPrint bool Time time.Time }
type LogSegment ¶
type LogSegment struct { SpanID SpanID Time time.Time Text []byte Level logger.Level Fields logger.Fields // Continues a line from a previous segment. ContinuesLine bool // When we store warnings in the LogStore, we break them up into lines and // store them as a series of line segments. 'Anchor' marks the beginning of a // series of logs that should be kept together. // // Anchor warning1, line1 // warning1, line2 // Anchor warning2, line1 Anchor bool }
func (LogSegment) CanContinueLine ¶ added in v0.10.25
func (l LogSegment) CanContinueLine(other LogSegment) bool
Whether these two log segments may be printed on the same line
func (LogSegment) IsComplete ¶
func (l LogSegment) IsComplete() bool
func (LogSegment) Len ¶
func (l LogSegment) Len() int
func (LogSegment) StartsLine ¶
func (l LogSegment) StartsLine() bool
func (LogSegment) String ¶
func (l LogSegment) String() string
type LogStore ¶
type LogStore struct {
// contains filtered or unexported fields
}
A central place for storing logs. Not thread-safe.
If you need to read logs in a thread-safe way outside of the normal Store state loop, take a look at logstore.Reader.
func NewLogStore ¶
func NewLogStore() *LogStore
func NewLogStoreForTesting ¶
func (*LogStore) Checkpoint ¶
func (s *LogStore) Checkpoint() Checkpoint
func (*LogStore) ContinuingLines ¶ added in v0.14.0
func (s *LogStore) ContinuingLines(checkpoint Checkpoint) []LogLine
func (*LogStore) ContinuingString ¶
func (s *LogStore) ContinuingString(checkpoint Checkpoint) string
Returns logs incrementally from the given checkpoint.
In many use cases, logs are printed to an append-only stream (like os.Stdout). Once they've been printed, they can't be called back. ContinuingString() tries to make reasonable product decisions about printing all the logs that have streamed in since the given checkpoint.
Typical usage, looks like:
Print(store.ContinuingString(state.LastCheckpoint)) state.LastCheckpoint = store.Checkpoint()
func (*LogStore) IsLastSegmentUncompleted ¶ added in v0.14.0
func (*LogStore) ManifestLog ¶ added in v0.10.24
func (s *LogStore) ManifestLog(mn model.ManifestName) string
func (*LogStore) ScrubSecretsStartingAt ¶
func (s *LogStore) ScrubSecretsStartingAt(secrets model.SecretSet, checkpoint Checkpoint)
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Thread-safe reading a log store, outside of the Store state loop.
func (Reader) Checkpoint ¶
func (r Reader) Checkpoint() Checkpoint
func (Reader) ContinuingLines ¶ added in v0.14.0
func (r Reader) ContinuingLines(c Checkpoint) []LogLine
func (Reader) ContinuingString ¶
func (r Reader) ContinuingString(c Checkpoint) string