通过系统级的命令(如`tail -f`)来实时监控文件变动

2021-12-02 13:28:17 +08:00
 licoycn

最近在写一款微型日志监控,奈何没有找到好的监听文件变动的依赖,于是就自己写了一个,主要用法类似于 tail 命令,如:

tail -100f system.log

windows 下就是

Get-Content -Path system.log -Tail 100 -Wait

开源地址: https://github.com/Licoy/stail

977 次点击
所在节点    分享创造
2 条回复
fighterhit
2021-12-12 02:28:25 +08:00
无意间看到有个 golang 版的 tail -f 实现 https://github.com/hpcloud/tail
licoycn
2021-12-12 09:40:13 +08:00
@fighterhit #1 这个我用过,是通过 fsnotify 来实现的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/819519

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX