Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetupLogger ¶
SetupLogger returns a context with a logger setup on it.
Example ¶
package main import ( "context" "os" configlogging "github.com/google/kf/v2/pkg/kf/commands/config/logging" "go.uber.org/zap" "knative.dev/pkg/logging" ) func main() { logger := logging.FromContext(configlogging.SetupLogger(context.Background(), os.Stdout)) logger.Debug("debug message") logger.Info("info message") logger.Warn("warning message") logger.Error("error message") logger.With(zap.Namespace("some namespace")).Info("info message with namespace") logger.With(zap.String("some key", "some value")).Debug("debug message with key/value") logger.With(zap.Namespace("ns1")).With(zap.Namespace("ns2")).Info("info message with multiple namespaces") }
Output: DEBUG debug message info message WARN warning message ERROR error message [some namespace] info message with namespace DEBUG [some key/some value] debug message with key/value [ns1] [ns2] info message with multiple namespaces
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.