Documentation ¶
Overview ¶
Package buffer provides a cache for byte.Buffer instances that can be reused to avoid frequent allocation and deallocation. It also has utility code for log header formatting that use these buffers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Pid is inserted into log headers. Can be overridden for tests. Pid = os.Getpid() // Time, if set, will be used instead of the actual current time. Time *time.Time )
Functions ¶
Types ¶
type Buffer ¶
Buffer holds a single byte.Buffer for reuse. The zero value is ready for use. It also provides some helper methods for output formatting.
func GetBuffer ¶ added in v2.90.0
func GetBuffer() *Buffer
GetBuffer returns a new, ready-to-use buffer.
func (*Buffer) FormatHeader ¶
FormatHeader formats a log header using the provided file name and line number and writes it into the buffer.
Click to show internal directories.
Click to hide internal directories.