Documentation ¶
Overview ¶
Package ts contains a Transform to prepend a timestamp in front of each line.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultFormat ¶
DefaultFormat formats in seconds since the startTime. Ex: [12.3456s]
func NewRelativeFormat ¶
NewRelativeFormat returns a format function which formats in seconds since the previous line. Ex: [+1.0050s]
Types ¶
type PrependTimestamp ¶
type PrependTimestamp struct { R io.Reader StartTime time.Time Format func(startTime time.Time) string // ResetTimeOnNextRead is set to force the StartTime to reset to the // current time when data is next read. It is useful to set this to // true initially for all times to be relative to the first line. ResetTimeOnNextRead bool // contains filtered or unexported fields }
PrependTimestamp is an io.Reader which prepends a timestamp on each line.
func New ¶
func New(r io.Reader) *PrependTimestamp
New creates a PrependTimestamp with default settings.
Click to show internal directories.
Click to hide internal directories.