1 Star 0 Fork 0

SuperManager/leaf3389

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
leaf.go 1.10 KB
一键复制 编辑 原始数据 按行查看 历史
黄柠檬 提交于 2024-08-07 15:36 . init
package leaf
import (
"github.com/name5566/leaf/cluster"
"github.com/name5566/leaf/conf"
"github.com/name5566/leaf/console"
"github.com/name5566/leaf/log"
"github.com/name5566/leaf/log/zap"
"github.com/name5566/leaf/module"
"os"
"os/signal"
"syscall"
)
func Run(mods ...module.Module) {
// logger
config := &log.Config{
Debug: conf.LogDebug,
Level: conf.LogLevel,
Net: "udp",
Addr: conf.LogAddr,
Tag: conf.LogTag,
Filename: conf.LogPath,
MaxSize: conf.LogMaxSize,
MaxAge: conf.LogMaxAge,
MaxBackups: conf.LogMaxBackups,
LocalTime: conf.LogLocalTime,
Compress: conf.LogCompress,
}
log.SetLogger(zap.NewLogger(config.BuildOption()...))
log.Infof("meta fish %v starting up", version)
// module
for i := 0; i < len(mods); i++ {
module.Register(mods[i])
}
module.Init()
// cluster
cluster.Init()
// console
console.Init()
// close
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Kill, syscall.SIGTERM)
sig := <-c
log.Infof("dhf closing down (signal: %v)", sig)
console.Destroy()
cluster.Destroy()
module.Destroy()
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kongkekongke/leaf3389.git
git@gitee.com:kongkekongke/leaf3389.git
kongkekongke
leaf3389
leaf3389
master

搜索帮助