SleeplessOne1917 / lemmy-bot

A bot library for Lemmy, the fediverse link aggregator.
https://www.npmjs.com/package/lemmy-bot
GNU Affero General Public License v3.0
93 stars 11 forks source link

[Feature request] Optional flag to disable logs #65

Closed ornato-t closed 1 year ago

ornato-t commented 1 year ago

immagine

I don't really like having my logs spammed by the library's activity, I'd prefer handling my own logging in my app, only for the operations where I deem it necessary.

I propose creating an additional, optional flag in the new LemmyBot() constructor to disable the output of logs from the library.

If @SleeplessOne1917 likes the idea I could also implement such a feature myself and submit a PR for it.

SleeplessOne1917 commented 1 year ago

This seems like a good feature. I'm planning on updating the bot once v0.19 of Lemmy is released and the API is a bit more stable. If you don't want to wait for that, I'll galdly accept a PR.

ornato-t commented 1 year ago

I'm down to try and take a crack at this. I was thinking of adding an enableLogs boolean proprety to the constructor defaulting to true and only showing ordinary logs if said proprety is set to true.

I was also thinking that this shouldn't cover errors. I see that in some cases you are catching them, console logging a message and exiting the process manually, that should definitely be outputed regardless of the configuration.