Documentation ¶
Overview ¶
Package log provides logging for apiserver.
Package log provides logging for apiserver.
Index ¶
- func ConfigureLogging(cfg *LoggingConfig) func()
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(template string, args ...interface{})
- func HTTPHandler(handler http.Handler, withPayloads bool) http.Handler
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func OnHTTPClient(hc *http.Client, withPayloads bool)
- func Warn(args ...interface{})
- func Warnf(template string, args ...interface{})
- func With(args ...interface{}) *zap.SugaredLogger
- func WithError(err error) *zap.SugaredLogger
- func Writer() *io.PipeWriter
- func WriterWithLevel(f func(args ...interface{})) *io.PipeWriter
- type LoggingConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureLogging ¶
func ConfigureLogging(cfg *LoggingConfig) func()
ConfigureLogging configures the log output for API Server.
func Debugf ¶
func Debugf(template string, args ...interface{})
Debugf uses fmt.Sprintf to log a templated message.
func Errorf ¶
func Errorf(template string, args ...interface{})
Errorf uses fmt.Sprintf to log a templated message.
func Fatal ¶
func Fatal(args ...interface{})
Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
func Fatalf ¶
func Fatalf(template string, args ...interface{})
Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.
func HTTPHandler ¶
HTTPHandler wraps a server-side HTTP handler for logging.
func Infof ¶
func Infof(template string, args ...interface{})
Infof uses fmt.Sprintf to log a templated message.
func OnHTTPClient ¶
OnHTTPClient attaches logging support to an HTTP Client.
func Warnf ¶
func Warnf(template string, args ...interface{})
Warnf uses fmt.Sprintf to log a templated message.
func With ¶
func With(args ...interface{}) *zap.SugaredLogger
With adds a variadic number of fields to the logging context. It accepts a mix of strongly-typed Field objects and loosely-typed key-value pairs. When processing pairs, the first element of the pair is used as the field key and the second as the field value.
For example,
sugaredLogger.With( "hello", "world", "failure", errors.New("oh no"), Stack(), "count", 42, "user", User{Name: "alice"}, )
is the equivalent of
unsugared.With( String("hello", "world"), String("failure", "oh no"), Stack(), Int("count", 42), Object("user", User{Name: "alice"}), )
Note that the keys in key-value pairs should be strings. In development, passing a non-string key panics. In production, the logger is more forgiving: a separate error is logged, but the key-value pair is skipped and execution continues. Passing an orphaned key triggers similar behavior: panics in development and errors in production.
func WriterWithLevel ¶
func WriterWithLevel(f func(args ...interface{})) *io.PipeWriter
WriterWithLevel writes log entries at a specific level.