绑定日志与命令行关联
This commit is contained in:
@@ -8,18 +8,9 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// 初始化日志
|
||||
logOpts := logging.Options{
|
||||
Level: "info",
|
||||
LogFile: "devpack.log",
|
||||
Verbose: false,
|
||||
Quiet: false,
|
||||
NoColor: false,
|
||||
}
|
||||
_, err := logging.Init(logOpts)
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
// 日志由 rootCmd.PersistentPreRunE 根据 CLI 参数自动初始化
|
||||
// 程序退出时关闭日志文件句柄
|
||||
defer logging.G().Close()
|
||||
|
||||
if err := commands.Execute(); err != nil {
|
||||
os.Exit(1)
|
||||
|
||||
Reference in New Issue
Block a user