This commit is contained in:
2026-02-14 05:36:00 +08:00
commit d7cd899983
37 changed files with 4169 additions and 0 deletions

46
main.go Normal file
View File

@@ -0,0 +1,46 @@
package main
import (
"os"
"sunhpc/cmd"
)
func main() {
if err := cmd.Execute(); err != nil {
os.Exit(1)
}
}
/*
// 初始化日志verbose=true 显示调试信息)
log.Init(true)
// 基础用法
log.Info("服务启动成功")
log.Infof("用户 %s 已添加", "testuser")
log.Warn("磁盘使用率超过 80%")
log.Warnf("节点 %s 网络延迟过高", "node01")
log.Error("配置文件解析失败")
log.Errorf("无法连接到数据库: %v", err)
log.Debug("正在执行命令: ssh root@192.168.1.1")
log.Debugf("加载了 %d 个节点配置", len(nodes))
// 致命错误
if err != nil {
log.Fatal("初始化失败: ", err)
}
// 临时禁用颜色(例如输出重定向时)
if !isTerminal {
log.EnableColor(false)
}
// 设置日志级别
log.SetLevel(log.WarnLevel) // 只显示警告及以上级别
// 启用调用者信息
log.EnableCaller(true)
*/