nanos / FediFetcher

FediFetcher is a tool for Mastodon that automatically fetches missing replies and posts from other fediverse instances, and adds them to your own Mastodon instance.
https://blog.thms.uk/fedifetcher?utm_source=github
MIT License
293 stars 213 forks source link

Add option not to include timestamp in logs #113

Closed Sir-Photch closed 23 hours ago

Sir-Photch commented 2 months ago

I have written up a PKGBUILD for Arch to simplify installation. Since in this case, FediFetcher is running as a systemd service, its logs are written to the systemd journal that already include timestamps for each line:

Apr 21 14:21:28 myhostname fedi-fetcher[186448]: 2024-04-21 14:21:20.736995 CEST: Added context url https://very.cool.instance/asdf/jkl

I suggest to add an option in the configuration / command line that removes the timestamp from the logging behavior.

nanos commented 2 months ago

Great idea, especially after the introduction of the python logger as contributed by @AndrewKvalheim very recently. Maybe even a more general purpose log-format option? Would need to be carefully thought through, to get the balance right between on the one hand being powerful enough to be actually helpful, and on the other hand not being so difficult that noone understands how it work...


Questions re the pkgbuild if you don't mind (please assume I know nothing in your answers, because I do know literally nothing about PKGBUILD for Arch):

  1. How does updating that build work? Can it potentially be automated using a git workflow?
  2. How re-usable is this for other users? Might it make sense to add it as an option to the README file?

(Whether adding to the readme would be sensible and acceptable would probably depend on the answer to the first question though.)

Sir-Photch commented 2 months ago

How does updating that build work? Can it potentially be automated using a git workflow?

Yes I have seen that it can be done with workflows, but I have no experience there. I'm just watching this repository and would update the PKGBUILD manually. Usually, this only means setting pkgver to the new version, given that nothing else needs to be changed.

How re-usable is this for other users? Might it make sense to add it as an option to the README file?

It absolutely is meant to be re-usable, any other user can install this either via

$ git clone https://aur.archlinux.org/fedi-fetcher.git 
$ cd fedi-fetcher
$ makepkg -si

or

$ paru -Syu fedi-fetcher

depending on what they like to use. The latter uses paru which is one of many AUR helpers that simplify installing from user-submitted build scripts. Then, the only thing left to do is to edit /etc/fedi-fetcher/config.yaml and to systemctl enable --now fedi-fetcher.timer for it to run every hour by default. It's lock file path is set to /run/fedi-fetcher/.lock and state dir is /var/lib/fedi-fetcher, for it to be unix-like :)

You can see the other supplementary files of in the AUR repo here.

Feel free to mention it in the README!

nanos commented 2 months ago

Sorry for the delayed response. I had completely missed yours.

Thanks for taking the time to respond. I think given the above at this stage I would not want to mention it in the readme, unless there was a way of automating the updates. It is an interesting concept though.

Still very happy to look into changing the timestamp logging though

nanos commented 4 days ago

@Sir-Photch, are you able to update the PKGBUILD for Arch to 7.1.3, please?

nanos commented 23 hours ago

This is now possible by supplying the argument "log-format": "%(message)s" in your config.json (or running it fedifetcher with --log-format="%(message)s" if that's your preferred way of running FediFetcher).

Sir-Photch commented 23 hours ago

Very cool. I will update the PKGBUILD and the respective service file accordingly. Thanks!

nanos commented 22 hours ago

Thanks @Sir-Photch