package livelog
import "golang.org/x/build/livelog"
Package livelog provides a buffer that can be simultaneously written to by one writer and read from by many readers.
Index ¶
Constants ¶
const ( // MaxBufferSize is the maximum buffer size, as it is more output than // we expect from reasonable tests. MaxBufferSize = 2 << 20 // 2 MB )
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is an io.WriteCloser that provides multiple Readers that each yield the same data.
It is safe to Write to a Buffer while Readers consume data. A Buffer has a maximum size of MaxBufferSize, after which Write will silently drop additional data and the buffer will contain a truncation note at the end.
The zero value is a ready-to-use buffer.
func (*Buffer) Bytes ¶
Bytes returns a copy of the underlying buffer.
func (*Buffer) Close ¶
Close signals EOF to all Readers.
func (*Buffer) Reader ¶
func (b *Buffer) Reader() io.ReadCloser
Reader initializes and returns a ReadCloser that will emit the entire buffer. It is safe to call Read and Close concurrently.
func (*Buffer) String ¶
String returns a copy of the underlying buffer as a string.
func (*Buffer) Write ¶
Write appends data to the Buffer. It will wake any blocked Readers.
Source Files ¶
livelog.go
- Version
- v0.0.0-20250421191922-3619c213cff3 (latest)
- Published
- Apr 21, 2025
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 2 months ago –
Tools for package owners.