package log
import "github.com/envoyproxy/go-control-plane/pkg/log"
Package log provides a logging interface for use in this library.
Index ¶
- type DefaultLogger
- func NewDefaultLogger() *DefaultLogger
- func (l *DefaultLogger) Debugf(string, ...interface{})
- func (l *DefaultLogger) Errorf(string, ...interface{})
- func (l *DefaultLogger) Infof(string, ...interface{})
- func (l *DefaultLogger) Warnf(string, ...interface{})
- type Logger
- type LoggerFuncs
Examples ¶
Types ¶
type DefaultLogger ¶
type DefaultLogger struct {
}
DefaultLogger is enabled when no consuming clients provide a logger to the server/cache subsystem
func NewDefaultLogger ¶
func NewDefaultLogger() *DefaultLogger
NewDefaultLogger creates a DefaultLogger which is a no-op to maintain current functionality
func (*DefaultLogger) Debugf ¶
func (l *DefaultLogger) Debugf(string, ...interface{})
Debugf logs a message at level debug on the standard logger.
func (*DefaultLogger) Errorf ¶
func (l *DefaultLogger) Errorf(string, ...interface{})
Errorf logs a message at level error on the standard logger.
func (*DefaultLogger) Infof ¶
func (l *DefaultLogger) Infof(string, ...interface{})
Infof logs a message at level info on the standard logger.
func (*DefaultLogger) Warnf ¶
func (l *DefaultLogger) Warnf(string, ...interface{})
Warnf logs a message at level warn on the standard logger.
type Logger ¶
type Logger interface {
// Debugf logs a formatted debugging message.
Debugf(format string, args ...interface{})
// Infof logs a formatted informational message.
Infof(format string, args ...interface{})
// Warnf logs a formatted warning message.
Warnf(format string, args ...interface{})
// Errorf logs a formatted error message.
Errorf(format string, args ...interface{})
}
Logger interface for reporting informational and warning messages.
func NewTestLogger ¶
type LoggerFuncs ¶
type LoggerFuncs struct {
DebugFunc func(string, ...interface{})
InfoFunc func(string, ...interface{})
WarnFunc func(string, ...interface{})
ErrorFunc func(string, ...interface{})
}
LoggerFuncs implements the Logger interface, allowing the
caller to specify only the logging functions that are desired.
Code:
Example¶
{
xdsLogger := LoggerFuncs{
DebugFunc: log.Printf,
InfoFunc: log.Printf,
WarnFunc: log.Printf,
ErrorFunc: log.Printf,
}
xdsLogger.Debugf("debug")
xdsLogger.Infof("info")
xdsLogger.Warnf("warn")
xdsLogger.Errorf("error")
}
func (LoggerFuncs) Debugf ¶
func (f LoggerFuncs) Debugf(format string, args ...interface{})
Debugf logs a formatted debugging message.
func (LoggerFuncs) Errorf ¶
func (f LoggerFuncs) Errorf(format string, args ...interface{})
Errorf logs a formatted error message.
func (LoggerFuncs) Infof ¶
func (f LoggerFuncs) Infof(format string, args ...interface{})
Infof logs a formatted informational message.
func (LoggerFuncs) Warnf ¶
func (f LoggerFuncs) Warnf(format string, args ...interface{})
Warnf logs a formatted warning message.
Source Files ¶
- Version
- v0.14.0 (latest)
- Published
- Nov 4, 2025
- Platform
- linux/amd64
- Imports
- 1 packages
- Last checked
- 4 months ago –
Tools for package owners.