1 Star 0 Fork 0

光光/gologger

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 716 Bytes
一键复制 编辑 原始数据 按行查看 历史
package main
import (
"fmt"
"os"
"time"
"gitee.com/fengpiaoyao/gologger"
"gopkg.in/ini.v1"
)
func main() {
cfg, err := ini.Load("my.ini")
if err != nil {
fmt.Printf("Fail to read file: %v", err)
os.Exit(1)
}
logLv := cfg.Section("log").Key("level").String()
outPutType := cfg.Section("log").Key("type").String()
mylog := gologger.FotmatLog(logLv, outPutType, cfg.Section("log").Key("path").String())
for {
_, err := os.Open("d:/mytest.txt")
if err != nil {
mylog.ERROR("错误信息", err)
}
mylog.DEBUG("debug日志")
mylog.INFO("info日志")
mylog.WARNING("WARNING")
name := "什么啊"
mylog.ERROR("ERROR,id %s", name)
mylog.FATAL("FATAL")
time.Sleep(time.Second)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/fengpiaoyao/gologger.git
git@gitee.com:fengpiaoyao/gologger.git
fengpiaoyao
gologger
gologger
v0.2.2

搜索帮助