爱意满满的作品展示区。
licoycn

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

  •  2
     
  •   licoycn ·
    Licoy · Dec 2, 2021 · 1505 views
    This topic created in 1641 days ago, the information mentioned may be changed or developed.

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

    tail -100f system.log
    

    windows 下就是

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

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

    fighterhit
        1
    fighterhit  
       Dec 12, 2021
    无意间看到有个 golang 版的 tail -f 实现 https://github.com/hpcloud/tail
    licoycn
        2
    licoycn  
    OP
       Dec 12, 2021
    @fighterhit #1 这个我用过,是通过 fsnotify 来实现的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   947 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 22:48 · PVG 06:48 · LAX 15:48 · JFK 18:48
    ♥ Do have faith in what you're doing.