d0vgan / nppexec

NppExec (plugin for Notepad++)
GNU General Public License v3.0
133 stars 23 forks source link

show and reload file content periodically #101

Open mischlrebl opened 3 weeks ago

mischlrebl commented 3 weeks ago

hello

I am wondering if it is possible to watch and track a log file in the console - like the Monitoring (tail -f) function in npp?

would be very handy to work with split screen on the files and to see the messages below.

thanks in advance

d0vgan commented 3 weeks ago

The closest built-in command in NppExec is con_load, though it loads an entire file into the Console window. To achieve your goal, you may probably run some external log viewer/watcher implemented as a console application in NppExec's Console. The following is related: https://stackoverflow.com/questions/187587/a-windows-equivalent-of-the-unix-tail-command

d0vgan commented 3 weeks ago

My favorite sfk (Swiss File Knife) seems to do the job as well: sfk tail -f log.txt

https://d0vgan.github.io/nppexec/?q=4.6.8

mischlrebl commented 2 weeks ago

thanks a lot for the answer and especially your efforts for the investigation.

while it works on the command line: `C:\Users\Asus2022A\Desktop>sfk200.exe tail -f C:\Users\Asus2022A\Desktop\div\py\logs\stdout.log

2024-11-11 16:23:00.865 | INFO | icon.py | start, streamlit: 1.38.0`

it does not in NppExec: ` ================ READY ================

sfk200.exe tail -f C:\Users\Asus2022A\Desktop\div\py\logs\stdout.log

sfk200.exe tail -f C:\Users\Asus2022A\Desktop\div\py\logs\stdout.log

Process started (PID=36352) >>>`

sfk200 basic and others work

Any ideas?

d0vgan commented 2 weeks ago

You are correct, it doesn't work in NppExec's Console. I did not check that. The reason of why it does not work is described here, Q1: https://d0vgan.github.io/nppexec/?q=FAQ To sum up, in such situations you need to run a program in its own console window.

d0vgan commented 2 weeks ago

This version of tail seems to work in NppExec's Console: https://github.com/JavaScriptDude/cygtail On that page, click the "<>Code" button and then click "Download ZIP" there.

tail -f log.txt
mischlrebl commented 2 weeks ago

thanks a lot for your efforts, works like a charm!

together with the highlighting it is a full log viewer now

d0vgan commented 2 weeks ago

If it's not a secret, what highlighting are you using? I'm considering to describe this use-case in the NppExec Manual.

mischlrebl commented 2 weeks ago

it is no rocket science... would be for sure an interesting and real use case.

2024-11-14 17_28_35-C__Users_ml_Streamlit_docs_readme md - Notepad++ 2024-11-14 17_29_05-C__Users_ml_Streamlit_docs_readme md - Notepad++

d0vgan commented 2 weeks ago

Wow, seeing this, it's really inspiring! The truth is, I never thought about NppExec in terms of log viewing - but you actually transformed it into a real log viewer!

d0vgan commented 2 weeks ago

Added to the Manual: https://d0vgan.github.io/nppexec/?q=4.6.18

mischlrebl commented 2 weeks ago

thank you for the documentation which allows everyone to set it up easily by its own.

the wonderful tool makes it possible to implement it by no time. it has been an obvious use case in terms of npp using as an ide where all necessary parts are integrated into one application.

a small hint to the highligthing: as the execution of masks is proceeded from top to bottom the presedence has to be considered. the success line in the log would also match with the lib.py case - which seems not to be applicated as there was already a match before