1 Star 0 Fork 0

magicianlyx / GoLog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
log_console.go 698 Bytes
一键复制 编辑 原始数据 按行查看 历史
package GoLog
import (
"fmt"
)
// +---------------------------------------------------------+
// + +
// + ConsoleLog +
// + +
// +---------------------------------------------------------+
// 多线程异步写入日志
type ConsoleLog struct {
log *BufferLog
}
func NewConsoleLog() *ConsoleLog {
writer := func(msg IMsg) {
fmt.Printf("%s", msg.ToColorfulContent())
}
log := NewBufferLog(50, writer)
return &ConsoleLog{log: log}
}
func (c *ConsoleLog) Write(msg IMsg) {
c.log.Write(msg)
}
func (c *ConsoleLog) Stop() {
c.log.Stop()
}
Go
1
https://gitee.com/magicianlyx/GoLog.git
git@gitee.com:magicianlyx/GoLog.git
magicianlyx
GoLog
GoLog
20c45f9b998d

搜索帮助