-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All direct logging via logrus is now removed from tbot, tctl, tsh, and teleport. The last remaining places using logrus are all of the plugins in `integrations`. Some of the integrations code are directly imported in teleport.e which prevent logrus from becoming an indirect dependency for the time being.
- Loading branch information
1 parent
2c764e1
commit 59146c8
Showing
27 changed files
with
329 additions
and
625 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule e
updated
from f00dbc to bc0a10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2022 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package logger | ||
|
||
import "sync" | ||
|
||
// buffer adapted from go/src/fmt/print.go | ||
type buffer []byte | ||
|
||
// Having an initial size gives a dramatic speedup. | ||
var bufPool = sync.Pool{ | ||
New: func() any { | ||
b := make([]byte, 0, 1024) | ||
return (*buffer)(&b) | ||
}, | ||
} | ||
|
||
func newBuffer() *buffer { | ||
return bufPool.Get().(*buffer) | ||
} | ||
|
||
func (b *buffer) Len() int { | ||
return len(*b) | ||
} | ||
|
||
func (b *buffer) SetLen(n int) { | ||
*b = (*b)[:n] | ||
} | ||
|
||
func (b *buffer) Free() { | ||
// To reduce peak allocation, return only smaller buffers to the pool. | ||
const maxBufferSize = 16 << 10 | ||
if cap(*b) <= maxBufferSize { | ||
*b = (*b)[:0] | ||
bufPool.Put(b) | ||
} | ||
} | ||
|
||
func (b *buffer) Reset() { | ||
*b = (*b)[:0] | ||
} | ||
|
||
func (b *buffer) Write(p []byte) (int, error) { | ||
*b = append(*b, p...) | ||
return len(p), nil | ||
} | ||
|
||
func (b *buffer) WriteString(s string) (int, error) { | ||
*b = append(*b, s...) | ||
return len(s), nil | ||
} | ||
|
||
func (b *buffer) WriteByte(c byte) error { | ||
*b = append(*b, c) | ||
return nil | ||
} | ||
|
||
func (b *buffer) String() string { | ||
return string(*b) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.