log.go 317 B

12345678910111213141516
  1. package pkg
  2. import "go.uber.org/zap"
  3. func InitLog() *zap.Logger {
  4. config := zap.NewDevelopmentConfig()
  5. config.OutputPaths = append(config.OutputPaths, "logfile.log")
  6. logger, err := config.Build()
  7. if err != nil {
  8. panic("Error creating config: " + err.Error())
  9. }
  10. zap.ReplaceGlobals(logger)
  11. return logger
  12. }