internal/service/logger/logger.go
func Init(opts Opts) (logger *zap.Logger, err error) {
	var (
		cfg     zap.Config
		options []zap.Option
		lvl     zapcore.Level
	)
	switch opts.Environment {
	case "production":
		cfg = zap.NewProductionConfig()
	case "stackdriver":
		cfg = NewStackdriverConfig()
		options = append(options, zap.Fields(zap.Object("serviceContext", &ServiceContext{
			Service: "mnemosyned",
			Version: opts.Version,
		})))
	case "development":
		cfg = zap.NewDevelopmentConfig()
	default:
		cfg = zap.NewProductionConfig()
	}

	if err = lvl.Set(opts.Level); err != nil {
		return nil, err
	}
	cfg.Level.SetLevel(lvl)

	logger, err = cfg.Build(options...)
	if err != nil {
		return nil, err
	}
	logger.Info("logger has been initialized", zap.String("environment", opts.Environment))

	return logger, nil
}
func Init(opts Opts) (logger *zap.Logger, err error) {
	var (
		cfg     zap.Config
		options []zap.Option
		lvl     zapcore.Level
	)
	switch opts.Environment {
	case "production":
		cfg = zap.NewProductionConfig()
	case "stackdriver":
		cfg = NewStackdriverConfig()
		options = append(options, zap.Fields(zap.Object("serviceContext", &ServiceContext{
			Service: "mnemosyned",
			Version: opts.Version,
		})))
	case "development":
		cfg = zap.NewDevelopmentConfig()
	default:
		cfg = zap.NewProductionConfig()
	}

	if err = lvl.Set(opts.Level); err != nil {
		return nil, err
	}
	cfg.Level.SetLevel(lvl)

	logger, err = cfg.Build(options...)
	if err != nil {
		return nil, err
	}
	logger.Info("logger has been initialized", zap.String("environment", opts.Environment))

	return logger, nil
}
// Init allocates new logger based on given options.