2 Star 0 Fork 1

web-bird/bird

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
log.go 516 Bytes
一键复制 编辑 原始数据 按行查看 历史
悟道人 提交于 2021-08-03 21:45 +08:00 . 保存
package utils
import (
"fmt"
"os"
)
type Log struct {
f *os.File
}
func NewLog(file string) *Log {
object := new(Log)
var err error
object.f, err = os.OpenFile(file, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0666)
if err != nil {
panic("日志" + file + "创建失败:" + err.Error())
}
return object
}
func (this *Log) Save(args ...interface{}) {
this.f.WriteString(fmt.Sprint(args...))
}
//
func (this *Log) Savef(format string, args ...interface{}) {
this.f.WriteString(fmt.Sprintf(format, args...))
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/web-bird/bird.git
git@gitee.com:web-bird/bird.git
web-bird
bird
bird
ac7d4c82d0c1

搜索帮助