1 Star 0 Fork 0

GitSharp/fetch-github-hosts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
log.go 521 Bytes
一键复制 编辑 原始数据 按行查看 历史
Licoy 提交于 2023-06-01 12:27 . feat: 增加启动自动获取及优化UI
package main
import (
"fmt"
"io"
"time"
)
type FetchLog struct {
w io.Writer
}
func NewFetchLog(w io.Writer) *FetchLog {
return &FetchLog{w}
}
func (f *FetchLog) Print(msg string) {
now := time.Now().Format("2006-01-02 15:04:05")
fmt.Fprintf(f.w, "[%s] %s\n", now, msg)
}
type guiLogWriter struct {
addFn func(string)
}
func NewGuiLogWriter(addFn func(string)) io.Writer {
return &guiLogWriter{addFn}
}
func (g *guiLogWriter) Write(p []byte) (n int, err error) {
g.addFn(string(p))
return len(p), nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gitsharp/fetch-github-hosts.git
git@gitee.com:gitsharp/fetch-github-hosts.git
gitsharp
fetch-github-hosts
fetch-github-hosts
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385