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

Why did I decide to study Software Engineering?

2 Amazon leadership principles through the lens of an Engineer

Good practices on mobile monitorization

Girls are better at coding than boys

Adapting to Andela.

Twitter Scraping with Tweepy

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.

Unit Testing & Debugging Setup For Golang with VS Code

Build simple gRPC server with Golang

Series: Intro to Managing Golang Kafka Consumer Lag