Ai
1 Star 0 Fork 0

magicianlyx/GoLog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
log_fluent.go 705 Bytes
一键复制 编辑 原始数据 按行查看 历史
package GoLog
import (
"fmt"
)
// +---------------------------------------------------------+
// + +
// + ConsoleLog +
// + +
// +---------------------------------------------------------+
// 多线程异步写入日志
type FluentLog struct {
log *BufferLog
}
func NewFluentLog() *FluentLog {
writer := func(msg IMsg) {
content := msg.ToContent()
fmt.Printf("%s", content)
}
log := NewBufferLog(50, writer)
return &FluentLog{log: log}
}
func (c *FluentLog) Write(msg IMsg) {
c.log.Write(msg)
}
func (c *FluentLog) Stop() {
c.log.Stop()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/magicianlyx/GoLog.git
git@gitee.com:magicianlyx/GoLog.git
magicianlyx
GoLog
GoLog
20c45f9b998d

搜索帮助