func NewExecutor(ctx context.Context) cmd.Executor {
	return func(cfg config.ServiceConfig) {
		var writers []io.Writer
		gelfWriter, err := gelf.NewWriter(cfg.ExtraConfig)
		if err == nil {
			writers = append(writers, GelfWriter{gelfWriter})
			gologging.UpdateFormatSelector(func(w io.Writer) string {
				switch w.(type) {
				case GelfWriter:
					return "%{message}"
				default:
					return gologging.DefaultPattern
				}
			})
		}
		logger, enableLogstashError := logstash.NewLogger(cfg.ExtraConfig, writers...)
		if enableLogstashError != nil {
			var enableGologgingError error
			logger, enableGologgingError = gologging.NewLogger(cfg.ExtraConfig, writers...)
			if enableGologgingError != nil {
				logger, err = logging.NewLogger("DEBUG", os.Stdout, "")
				if err != nil {
					return
				}
				logger.Error("unable to create gologging logger")
			} else {
				logger.Debug("use gologging as logger")
			}
		} else {
			logger.Debug("use logstash as logger")
		}
		if cfg.Plugin != nil {
			LoadPlugins(cfg.Plugin.Folder, cfg.Plugin.Pattern, logger)
		}
		reg := RegisterSubscriberFactories(ctx, cfg, logger)
		metricsController := metrics.New(ctx, cfg.ExtraConfig, logger)
		if err := influxdb.Register(ctx, &cfg, metricsController, logger); err != nil {
			logger.Warning(err)
		}
		rejecter, err := bloomfilter.Register(ctx, "melody-bf", cfg, logger, reg)
		if err != nil {
			logger.Warning("bloomFilter:", err.Error())
		}
		tokenRejecterFactory := jose.ChainedRejecterFactory([]jose.RejecterFactory{
			jose.RejecterFactoryFunc(func(_ logging.Logger, _ *config.EndpointConfig) jose.Rejecter {
				return jose.RejecterFunc(rejecter.RejectToken)
			}),
		})
		routerFactory := router.NewFactory(router.Config{
			Engine:         NewEngine(cfg, logger, gelfWriter),
			ProxyFactory:   NewProxyFactory(logger, NewBackendFactoryWithContext(ctx, logger, metricsController), metricsController),
			HandlerFactory: NewHandlerFactory(logger, tokenRejecterFactory, metricsController),
			MiddleWares:    []gin.HandlerFunc{},
			Logger:         logger,
			RunServer:      router.RunServerFunc(server.New(logger, melodyrouter.DefaultRunServer)),
		})
		logger.Info("melody server listening on port:", cfg.Port, "🎁")
		routerFactory.NewWithContext(ctx).Run(cfg)
	}
}
NewExecutor return an new executor
package melody
import (
	"context"
	"io"
	"melody/cmd"
	"melody/config"
	"melody/logging"
	bloomfilter "melody/middleware/melody-bloomfilter"
	gelf "melody/middleware/melody-gelf"
	gologging "melody/middleware/melody-gologging"
	influxdb "melody/middleware/melody-influxdb"
	jose "melody/middleware/melody-jose"
	logstash "melody/middleware/melody-logstash"
	metrics "melody/middleware/melody-metrics/gin"
	melodyrouter "melody/router"
	router "melody/router/gin"
	server "melody/transport/http/server/plugin"
	"os"
	"github.com/gin-gonic/gin"
)