Documentation ¶
Overview ¶
A central logstore.
Motivation and spec: https://github.com/windmilleng/tilt.specs/pull/19
Index ¶
- func SourcePrefix(n model.ManifestName) string
- type Checkpoint
- type LogEvent
- type LogSegment
- type LogStore
- func (s *LogStore) Append(le LogEvent, secrets model.SecretSet)
- func (s *LogStore) Checkpoint() Checkpoint
- func (s *LogStore) ContinuingString(checkpoint Checkpoint) string
- func (s *LogStore) Empty() 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)
- type Reader
- 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 LogSegment ¶
type LogSegment struct { SpanID SpanID Time time.Time Text []byte Level logger.Level // Continues a line from a previous segment. ContinuesLine 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) 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) 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) ContinuingString ¶
func (r Reader) ContinuingString(c Checkpoint) string