Files
sunhpc-go/main.go
2026-02-14 05:36:00 +08:00

47 lines
953 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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)
*/