Source File
buffer_pool.go
Belonging Package
github.com/sirupsen/logrus
package logrusimport ()var (bufferPool BufferPool)type BufferPool interface {Put(*bytes.Buffer)Get() *bytes.Buffer}type defaultPool struct {pool *sync.Pool}func ( *defaultPool) ( *bytes.Buffer) {.pool.Put()}func ( *defaultPool) () *bytes.Buffer {return .pool.Get().(*bytes.Buffer)}func () *bytes.Buffer {return bufferPool.Get()}func ( *bytes.Buffer) {.Reset()bufferPool.Put()}// SetBufferPool allows to replace the default logrus buffer pool// to better meets the specific needs of an application.func ( BufferPool) {bufferPool =}func () {SetBufferPool(&defaultPool{pool: &sync.Pool{New: func() interface{} {return new(bytes.Buffer)},},})}
![]() |
The pages are generated with Golds v0.3.6. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |