Golang global logging using uber zap

1. pass-it-down

2. Injection

func main() {
logger, _ := zap.NewProduction()
otherPackage1.Logger = logger
otherPackage2.Logger = logger
.... // tedious >_<
}
// other package
package otherPackage1
var Logger *zap.Logger
...
func…

--

--

--

love writing bit sized programming memo, acoustic guitarist, proud daddy of 5 and great listener (to my kids)

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Modeling Status Updates on PostgreSQL using JSON

Long-Term Strategic Partnerships With Technology Resource Providers

HTML Best Practices: Avoid Unnecessary Presentational Markup

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jim Kang

Jim Kang

love writing bit sized programming memo, acoustic guitarist, proud daddy of 5 and great listener (to my kids)

More from Medium

Generics in Golang.

Very basic JWT Authentication with Golang

Golang language variable declaration methods and use scenarios

MySQL: Init GORM from YAML with rk-boot