RasmusLindroth / tut

TUI for Mastodon with vim inspired keys
https://tut.anv.nu
MIT License
446 stars 29 forks source link

What is the correct way to debug issues? #250

Open xxxserxxx opened 1 year ago

xxxserxxx commented 1 year ago

Is there a way to enable (background) logging? For example, i'm having issues with [M]edia; it's failing silently, and I can't figure out how to figure out why. Is the image-viewer command not working? Why?

There doesn't appear to be a logging or debug option in the config.ini, or on the command line. Can I get at the STDERR or STDOUT of the commands that tut is executing?

RasmusLindroth commented 1 year ago

Right now there's no correct way. I use log.Fatalln() when debugging. But some kind of logging would be a good idea.

But to sort out your issue I think it's because your image viewer doesn't have the time to open the file before tut deletes it. Other people are experiencing this, so I'll try to include a fix in the next release

RasmusLindroth commented 1 year ago

If you try the version 2.0.0 and set delete-temp-files=false under [media]. Can you open the image?

xxxserxxx commented 1 year ago

Yes that does it.

With the upgrade to 2.0.0, I guess there was a switch to using toml instead of ini? The configuration from the old ini file was not carried over -- was that expected? This information is unfortunately not printed during the Arch install, nor is it in the Arch news. Just FYI; I only discovered it because my image viewer suddenly changed.

Want me to close this, or is there more work here? Obviously with delete off, /tmp is going to fill up with media files, so I suppose this is a work-around. If you're tracking it elsewhere, however, I'm fine with closing this ticket.

RasmusLindroth commented 1 year ago

Nah, we can leave this open as some logs would be a nice addition :)

With the upgrade to 2.0.0, I guess there was a switch to using toml instead of ini? The configuration from the old ini file was not carried over -- was that expected? This information is unfortunately not printed during the Arch install, nor is it in the Arch news. Just FYI; I only discovered it because my image viewer suddenly changed.

It was expected it wouldn't bee carried over, but maybe I should have informed about it more clearly.

Obviously with delete off, /tmp is going to fill up with media files, so I suppose this is a work-around.

Tut will remove all files when you close the application, so it shouldn't be that many files. Only if you run the application for days. If you want to clear files while running tut you can run the command :clear-temp

xxxserxxx commented 1 year ago

It was expected it wouldn't bee carried over, but maybe I should have informed about it more clearly.

Eh. Just making sure it was not doing something you were expecting it to.

Tut will remove all files when you close the application,

It isn't, for me. I just tested it by:

$ rm -f /tmp/tutfile*
$ ls -l /tmp/tutfile*
zsh: no matches found: /tmp/tutfile*
$ tut -u ser
### View several images from toots; exit
$ ls -l /tmp/tutfile*
-rw------- 1 ser ser  958704 2023-01-26 12:23 /tmp/tutfile1455743277.jpeg
-rw------- 1 ser ser 1147091 2023-01-26 12:23 /tmp/tutfile1571322673.jpeg
-rw------- 1 ser ser  227157 2023-01-26 12:23 /tmp/tutfile2000636817.jpeg
-rw------- 1 ser ser   88409 2023-01-26 12:23 /tmp/tutfile3341704875.jpeg
-rw------- 1 ser ser   16877 2023-01-26 12:23 /tmp/tutfile3417244843.png

This is with tut 2.0.0, and delete-temp-files=false. If it did delete on exit, that would IMHO be perfectly acceptable.