✏️ 调整 log 格式

This commit is contained in:
fumiama 2021-09-27 21:27:30 +08:00
parent 52a8a9de6f
commit 3623a88b16
2 changed files with 6 additions and 13 deletions

View File

@ -61,11 +61,6 @@ func controller() {
} }
}() }()
if log.GetLevel() != log.DebugLevel {
gin.SetMode(gin.ReleaseMode)
gin.DefaultWriter = io.Discard
}
engine := gin.New() engine := gin.New()
// 支持跨域 // 支持跨域
engine.Use(cors()) engine.Use(cors())

14
main.go
View File

@ -43,7 +43,7 @@ import (
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime" // 来份涩图 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime" // 来份涩图
// 以下为内置依赖,勿动 // 以下为内置依赖,勿动
log "github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot" zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/driver" "github.com/wdvxdr1123/ZeroBot/driver"
@ -58,19 +58,17 @@ var (
"* Project: https://github.com/FloatTech/ZeroBot-Plugin", "* Project: https://github.com/FloatTech/ZeroBot-Plugin",
} }
banner = strings.Join(contents, "\n") banner = strings.Join(contents, "\n")
// 是否禁用gui
disableGui bool
) )
func init() { func init() {
// 解析命令行参数,输入`-g`即可禁用gui var en bool
flag.BoolVar(&disableGui, "g", false, "Disable the gui") // 解析命令行参数,输入 `-g` 即可启用 gui
flag.BoolVar(&en, "g", false, "Enable the gui")
flag.Parse() flag.Parse()
if !disableGui { if en {
control.InitGui() control.InitGui()
} }
// log.SetLevel(log.DebugLevel)
log.SetLevel(log.DebugLevel)
} }
func main() { func main() {