qbit_manage icon indicating copy to clipboard operation
qbit_manage copied to clipboard

[FR]: Machine redable logs

Open ryanwalder opened this issue 2 years ago • 3 comments
trafficstars

Is your feature request related to a problem? Please elaborate.

The current logging system is great for interactive running of qbit_manage but it is unfortunately not machine readable which makes meaningful logging of qbit_manage impossible.

Describe the solution you'd like

I would like to have an option in the config which switches the output from the human readable logging to something machine readable.

Example:

|===================================== Updating Tags ======================================|
|    Torrent Name: FooBar.1974.720P.BluRay.x264.FLAC.2.0                            |
|         New Tag: trackerName                                                                     |
|         Tracker: http://my.tracker                                    |
|     Share Limit: Max Seed Time = None min                                                |
| Updated 1 new tags.                                                                      |

Could become:

JSON format:

{"timestamp": "2023-03-18 14:54:39,806", "log_level": "INFO", "subsystem": "tag_updater", "torrent_name": "FooBar.1974.720P.BluRay.x264.FLAC.2.0", "new_tag": "trackerName", "share_limit": {"max_seed_time": "None"}

Or use a library like syslog without custom formatting to output something like:

2023-03-18 14:54:39,806 qbit_manage: [INFO] Updated Tags for FooBar.1974.720P.BluRay.x264.FLAC.2.0 new tag: trackerName share limit: None

Does your solution involve any of the following?

  • [X] New config option
  • [ ] New command option

Describe alternatives you've considered

No reasonable alternative.

Who will this benefit?

This would allow people who prefer standard logging methods to use their preferred tooling to search logs using standard tools like grep this would also benefit those who have centralised logging in their setups (Graylog, Loki, ELK etc.).

Additional Information

No response

ryanwalder avatar Mar 18 '23 15:03 ryanwalder

Unfortunately to make this change would require a lot of refactoring as each line is sent separately. However, would it help if I added a feature that could save the webhook jsons into a file for you to process?

bobokun avatar May 22 '23 13:05 bobokun

maybe see if chatgpt can do some refactoring?

bakerboy448 avatar May 24 '23 05:05 bakerboy448

Unfortunately to make this change would require a lot of refactoring as each line is sent separately. However, would it help if I added a feature that could save the webhook jsons into a file for you to process?

That could possibly work, would ideally need timestamps though.

ryanwalder avatar May 24 '23 14:05 ryanwalder