main.go
1.1 KB
package main
import (
"fmt"
"github.com/beego/beego/v2/server/web"
"github.com/linmadan/egglib-go/log/logrus"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/constant"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/constant"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/redis"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/log"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/log"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/port/beego"
)
func main() {
log.Logger.Info("server start ....")
log.Logger.Info(fmt.Sprintf("ENABLE_KAFKA_LOG:%v", constant.ENABLE_KAFKA_LOG))
if constant.ENABLE_KAFKA_LOG {
w, _ := logrus.NewKafkaWriter(constant.KAFKA_HOST, constant.TOPIC_LOG_STASH, false)
log.Logger.AddHook(w)
}
bw := log.NewBeegoLogWriter(log.LoggerConfig{
Filename: constant.LOG_FILE,
Level: 7,
MaxSize: 1024 * 1024 * 2,
})
log.Logger.AddHook(bw)
log.Logger.Info("server start!")
web.Run()
}