import "code.cloudfoundry.org/lager" func main() { logger := lager.NewLogger("my-app") logger.RegisterSink(lager.NewWriterSink(os.Stdout, lager.DEBUG)) logger.Debug("debug message") }
import "code.cloudfoundry.org/lager" func main() { logger := lager.NewLogger("my-app") logger.RegisterSink(lager.NewWriterSink(os.Stdout, lager.DEBUG)) name := "Alice" logger.Debug("hello %s", name) }
import "code.cloudfoundry.org/lager" func main() { logger := lager.NewLogger("my-app") logger.RegisterSink(lager.NewWriterSink(os.Stdout, lager.DEBUG)) childLogger := logger.Session("child-app") childLogger.Debug("debug message") }This example creates a hierarchical logger setup, with a parent logger named "my-app" and a child logger named "child-app". We register the same console writer sink as before with the parent logger instance. We then create a new child logger using the `Session()` method and pass it the name "child-app". Finally, we call the `Debug()` method on this child logger instance to log a debug message. Package library: go code.cloudfoundry.org.lager.