Ai
2 Star 5 Fork 0

SillyMan/Ping多个主机的Web版本

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
mixlog.go 810 Bytes
一键复制 编辑 原始数据 按行查看 历史
SillyMan 提交于 2021-01-07 21:48 +08:00 . first commit
package main
import (
"os"
"path/filepath"
"gitee.com/sillyman/mixlog"
)
// debugFilePth 当debug开启时,详细的日志输出到此文件
const debugFilePth = "./logs/debug.log"
// MustInitMixlog 初始化日志系统
func MustInitMixlog(debug bool) {
stdout := mixlog.NewHandlerToWriter(
mixlog.LvlInfo,
mixlog.MustNewFormatter("{{.Time}} - {{.Lvl}} - {{.Message}}", "15:04:05.99"),
os.Stdout,
false,
)
if debug {
if err := os.MkdirAll(filepath.Dir(debugFilePth), 0755); err != nil {
panic(err)
}
mixlog.SetGlobalHandlers(
stdout,
mixlog.MustNewHandlerToFile(
mixlog.LvlDebug,
mixlog.MustNewFormatter(mixlog.FormatFuncNameShortFileName, "2006-01-02T15:04:05.000-07:00"),
debugFilePth,
false,
),
)
} else {
mixlog.SetGlobalHandlers(stdout)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/sillyman/PingHostsWebView.git
git@gitee.com:sillyman/PingHostsWebView.git
sillyman
PingHostsWebView
Ping多个主机的Web版本
11e63cd92578

搜索帮助