This commit is contained in:
2026-02-15 07:18:14 +08:00
parent d7cd899983
commit 8a7bf8a39c
39 changed files with 1578 additions and 2868 deletions

34
main.go
View File

@@ -10,37 +10,3 @@ func main() {
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)
*/