Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CircularLogs ¶
type CircularLogs struct {
// contains filtered or unexported fields
}
CircularLogs is a circular array of logs.
It must be created using the MakeCircularLogs function.
func MakeCircularLogs ¶
func MakeCircularLogs(capacity int) CircularLogs
MakeCircularLogs initializes a CircularLogs struct with the given capacity.
This function will panic if it is called with a zero capacity.
func (*CircularLogs) BuildLogs ¶
func (c *CircularLogs) BuildLogs() []LogEntry
BuildLogs copies the content of the circular array in a new slice.
The log entries are ordered from oldest to newest.
func (*CircularLogs) Push ¶
func (c *CircularLogs) Push(content string)
Push records a new entry in the logs.
The timestamp of the entry is set to the current monotonic time.
If the capacity of the logs has been reached, the new entry will replace the oldest entry.
Click to show internal directories.
Click to hide internal directories.