Documentation ¶
Index ¶
- Variables
- func MakeBaseLogger(ctx context.Context, logLevel string) context.Context
- func NewTestLogger(t testing.TB, level dlog.LogLevel) dlog.Logger
- func SetLevel(ctx context.Context, logLevelStr string)
- func SetLogrusLevel(logrusLogger *logrus.Logger, logLevelStr string)
- func WithDiscardingLogger(ctx context.Context) context.Context
- func WithLevelSetter(ctx context.Context, logrusLogger *logrus.Logger) context.Context
- type Formatter
- type LevelSetter
- type TimedLevel
Constants ¶
This section is empty.
Variables ¶
View Source
var DlogLevelNames = [5]string{
"error",
"warning",
"info",
"debug",
"trace",
}
Functions ¶
func MakeBaseLogger ¶ added in v2.4.7
func NewTestLogger ¶ added in v2.4.5
func SetLogrusLevel ¶
SetLogrusLevel sets the log-level of the given logger from logLevelStr and logs that to the logger.
func WithDiscardingLogger ¶
WithDiscardingLogger returns a context that discards all log output.
Types ¶
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
Formatter formats log messages for Telepresence.
func NewFormatter ¶
type LevelSetter ¶
LevelSetter is a function that sets the log-level.
type TimedLevel ¶
type TimedLevel interface { sync.Locker // Get returns the current level and the time left until that level // is reset to default. An empty string and zero is returned if // no level has been set or if it has expired already. Get() (string, time.Duration) // Set sets a new log-level that will be active for the given duration. If the // duration is zero, then the log-level will be active until the next call to // Set. If level is the empty string, then duration is ignored and the log-level // will be reset to default. Set(ctx context.Context, level string, duration time.Duration) // Reset restores the log-level to its default value Reset(ctx context.Context) }
TimedLevel is an object capable of setting a log-level for a given time period and then resetting it to a default.
func NewTimedLevel ¶
func NewTimedLevel(defaultLevel string, setter LevelSetter) TimedLevel
NewTimedLevel returns a new TimedLevel for the given default level and setter.
Click to show internal directories.
Click to hide internal directories.