Documentation ¶
Index ¶
- Constants
- Variables
- func AddWriter(logger *logrus.Logger, writer io.Writer) *logrus.Logger
- func MustNewZapLogger(level string, format string) logr.Logger
- func NewFieldLogger(logger logrus.FieldLogger, fieldKey, fieldValue string) *logrus.Entry
- func NewIDLogger(logger logr.Logger) logr.Logger
- func NewLogger(logLevel string, format string) *logrus.Logger
- func NewNopLogger() *logrus.Logger
- func NewShootLogger(logger logrus.FieldLogger, shoot, project string) *logrus.Entry
- func NewZapLogger(level string, format string) (logr.Logger, error)
- func ZapLogger(development bool) logr.Logger
Constants ¶
const ( // DebugLevel is the debug log level, i.e. the most verbose. DebugLevel = "debug" // InfoLevel is the default log level. InfoLevel = "info" // ErrorLevel is a log level where only errors are logged. ErrorLevel = "error" // FormatJSON is the output type that produces a JSON object per log line. FormatJSON = "json" // FormatText outputs the log as human-readable text. FormatText = "text" )
const IDFieldName = "process_id"
IDFieldName is the name of the id field for a logger.
Variables ¶
var ( // AllLogLevels is a slice of all available log levels. AllLogLevels = []string{DebugLevel, InfoLevel, ErrorLevel} // AllLogFormats is a slice of all available log formats. AllLogFormats = []string{FormatJSON, FormatText} )
var Logger *logrus.Logger
Logger is the standard logger for the Gardener which is used for all messages which are not Shoot cluster specific. Deprecated: use logr for new code!
Functions ¶
func AddWriter ¶
AddWriter returns a logger that uses the tests writer (e.g., GingkoWriter) as output channel Deprecated: use logr for new code!
func MustNewZapLogger ¶ added in v1.35.0
MustNewZapLogger is like NewZapLogger but panics on invalid input.
func NewFieldLogger ¶
func NewFieldLogger(logger logrus.FieldLogger, fieldKey, fieldValue string) *logrus.Entry
NewFieldLogger extends an existing logrus logger and adds the provided additional field. Example output: time="2017-06-08T13:00:49+02:00" level=info msg="something" <fieldKey>=<fieldValue>. Deprecated: use logr for new code!
func NewIDLogger ¶ added in v1.14.0
NewIDLogger extends an existing logger with a randomly generated id field (key `process_id`).
func NewLogger ¶
NewLogger creates a new logrus logger. It uses STDERR as output channel and evaluates the value of the --log-level command line argument in order to set the log level. Example output: time="2017-06-08T13:00:28+02:00" level=info msg="gardener started successfully". Deprecated: use logr for new code!
func NewNopLogger ¶ added in v0.34.0
NewNopLogger instantiates a new logger that logs to ioutil.Discard. Deprecated: use logr for new code!
func NewShootLogger ¶
func NewShootLogger(logger logrus.FieldLogger, shoot, project string) *logrus.Entry
NewShootLogger extends an existing logrus logger and adds an additional field containing the Shoot cluster name and the project in the Garden cluster to the output. If an <operationID> is provided it will be printed for every log message. Example output: time="2017-06-08T13:00:49+02:00" level=info msg="Creating namespace in seed cluster" shoot=core/crazy-botany. Deprecated: use logr for new code!
func NewZapLogger ¶ added in v1.29.0
NewZapLogger creates a new logr.Logger backed by Zap.
func ZapLogger ¶ added in v1.35.0
ZapLogger is a Logger implementation. If development is true, a Zap development config will be used (stacktraces on warnings, no sampling), otherwise a Zap production config will be used (stacktraces on errors, sampling). Additionally, the time encoding is adjusted to `zapcore.ISO8601TimeEncoder`. This is used by extensions for historical reasons. TODO: consolidate this with NewZapLogger and make everything configurable in a harmonized way
Types ¶
This section is empty.