diff options
author | dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> | 2020-09-29 08:17:24 +0000 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-09-29 05:58:49 -0400 |
commit | e6789cb3e8aaaa54cd80e953f730f358b861f167 (patch) | |
tree | b66c1eb7b37e34ab37fb887b0cdd5158c5f8ea33 /vendor/github.com/sirupsen/logrus/buffer_pool.go | |
parent | 4a7fb62adcbb8d5f2bc8e45273748301d12375a7 (diff) | |
download | podman-e6789cb3e8aaaa54cd80e953f730f358b861f167.tar.gz podman-e6789cb3e8aaaa54cd80e953f730f358b861f167.tar.bz2 podman-e6789cb3e8aaaa54cd80e953f730f358b861f167.zip |
Bump github.com/sirupsen/logrus from 1.6.0 to 1.7.0
Bumps [github.com/sirupsen/logrus](https://github.com/sirupsen/logrus) from 1.6.0 to 1.7.0.
- [Release notes](https://github.com/sirupsen/logrus/releases)
- [Changelog](https://github.com/sirupsen/logrus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sirupsen/logrus/compare/v1.6.0...v1.7.0)
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/github.com/sirupsen/logrus/buffer_pool.go')
-rw-r--r-- | vendor/github.com/sirupsen/logrus/buffer_pool.go | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/vendor/github.com/sirupsen/logrus/buffer_pool.go b/vendor/github.com/sirupsen/logrus/buffer_pool.go new file mode 100644 index 000000000..4545dec07 --- /dev/null +++ b/vendor/github.com/sirupsen/logrus/buffer_pool.go @@ -0,0 +1,52 @@ +package logrus + +import ( + "bytes" + "sync" +) + +var ( + bufferPool BufferPool +) + +type BufferPool interface { + Put(*bytes.Buffer) + Get() *bytes.Buffer +} + +type defaultPool struct { + pool *sync.Pool +} + +func (p *defaultPool) Put(buf *bytes.Buffer) { + p.pool.Put(buf) +} + +func (p *defaultPool) Get() *bytes.Buffer { + return p.pool.Get().(*bytes.Buffer) +} + +func getBuffer() *bytes.Buffer { + return bufferPool.Get() +} + +func putBuffer(buf *bytes.Buffer) { + buf.Reset() + bufferPool.Put(buf) +} + +// SetBufferPool allows to replace the default logrus buffer pool +// to better meets the specific needs of an application. +func SetBufferPool(bp BufferPool) { + bufferPool = bp +} + +func init() { + SetBufferPool(&defaultPool{ + pool: &sync.Pool{ + New: func() interface{} { + return new(bytes.Buffer) + }, + }, + }) +} |