Skip to content

Instantly share code, notes, and snippets.

@syntaqx
Last active June 27, 2018 07:35
Show Gist options
  • Save syntaqx/8f5882a5cd6c439a26b4f487e5623e1a to your computer and use it in GitHub Desktop.
Save syntaqx/8f5882a5cd6c439a26b4f487e5623e1a to your computer and use it in GitHub Desktop.
package main
import "go.uber.org/zap"
func main() {
debug := false // should come from cli flags or something
log, err := zap.NewProduction()
if err != nil {
panic(err)
}
// If we are in debug mode, we should use the more readable dev logger.
if debug {
devLogger, err := zap.NewDevelopment()
if err != nil {
panic(err)
}
log = devLogger
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment