1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

vendor: sirupsen/logrus v1.7.0

full diff: https://github.com/sirupsen/logrus/compare/v1.6.0...v1.7.0

removes dependency on github.com/konsorten/go-windows-terminal-sequences

Features:
   * a new buffer pool management API has been added
   * a set of `<LogLevel>Fn()` functions have been added

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-09-30 13:38:38 +02:00
parent 46cdcd206c
commit c9bbf37f85
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
12 changed files with 168 additions and 130 deletions

View file

@ -13,7 +13,6 @@ import (
)
var (
bufferPool *sync.Pool
// qualified package name, cached at first use
logrusPackage string
@ -31,12 +30,6 @@ const (
)
func init() {
bufferPool = &sync.Pool{
New: func() interface{} {
return new(bytes.Buffer)
},
}
// start at the bottom of the stack before the package-name cache is primed
minimumCallerDepth = 1
}
@ -243,9 +236,12 @@ func (entry Entry) log(level Level, msg string) {
entry.fireHooks()
buffer = bufferPool.Get().(*bytes.Buffer)
buffer = getBuffer()
defer func() {
entry.Buffer = nil
putBuffer(buffer)
}()
buffer.Reset()
defer bufferPool.Put(buffer)
entry.Buffer = buffer
entry.write()