Skip to content

Instantly share code, notes, and snippets.

Last active August 10, 2020 18:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
var sugarLogger *zap.SugaredLogger
func main() {
defer sugarLogger.Sync()
func InitLogger() {
logger, _ := zap.NewProduction()
sugarLogger = logger.Sugar()
func SimpleHttpGet(url string) {
sugarLogger.Debugf("Trying to hit GET request for %s", url)
resp, err := http.Get(url)
if err != nil {
sugarLogger.Errorf("Error fetching URL %s : Error = %s", url, err)
} else {
sugarLogger.Infof("Success! statusCode = %s for URL %s", resp.Status, url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment