Last active
          June 27, 2018 07:35 
        
      - 
      
 - 
        
Save syntaqx/8f5882a5cd6c439a26b4f487e5623e1a to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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