Skip to content

Instantly share code, notes, and snippets.

@thanhpp
Last active August 10, 2022 08:03
Show Gist options
  • Save thanhpp/dfd0ead37311a3e22a440439e9c542c1 to your computer and use it in GitHub Desktop.
Save thanhpp/dfd0ead37311a3e22a440439e9c542c1 to your computer and use it in GitHub Desktop.
exampleLogger.go
type A1 struct {
logger *zap.SuggaredLogger
}
type A2 struct {
logger *zap.SuggaredLogger
}
type A struct {
logger *zap.SuggaredLogger
a1 *A1
a2 *A2
}
func setup() {
lg := zap.S().With("name", "a")
a := &A{
logger: lg,
}
a.a1 = &A1{lg.With("name-lv1", "a1")}
a.a2 = &A2{lg.With("name-lv1", "a2")}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment