This should meet a basic logging and configuration needs for the first users and use cases. There are improvements that can be made (mentioned below), but for now, I think this gets us to 80% or more of what we need:
Note: I'm holding off on a bit of details in the README that will change in an upcoming PR working on configuration features
Changes
Main feature: logging to multiple locations - standard out, a debug-level plaintext log, and a debug-level json log
Logging configuration now happens indepently from other config, and at module init (due to that chicken and egg) (may change soon)
(unintentional/unrelated, 12dccfb) some new methods added to FileClasses/*.py
Before
$ fileflux filter seqlength type: fasta file: example.fasta
Found type: fasta, we can work with this...
Matched Fasta or fasta to fasta
...
After
$ fileflux filter seqlength type: fasta file: example.fasta
[23:32:12 INFO] - Found type: fasta, we can work with this...
[23:32:12 INFO] - Matched Fasta or fasta to fasta
...
and generates
~/.caragols/logs/log.txt # DEBUG level, with more info, plain text
[2024-05-09T23:32:12-0700 INFO caragols main.py:cli:45] - Found type: fasta, we can work with this...
[2024-05-09T23:32:12-0700 INFO caragols main.py:cli:49] - Matched Fasta or fasta to fasta
~/.caragols/logs/log.jsonl # DEBUG level, json
{"asctime": "2024-05-09T23:32:12-0700", "msecs": 558.0, "levelname": "INFO", "name": "caragols", "filename": "main.py", "module": "main", "process": 11789, "processName": "MainProcess", "thread": 8358968000, "funcName": "cli", "lineno": 45, "message": "Found type: fasta, we can work with this..."}
{"asctime": "2024-05-09T23:32:12-0700", "msecs": 558.0, "levelname": "INFO", "name": "caragols", "filename": "main.py", "module": "main", "process": 11789, "processName": "MainProcess", "thread": 8358968000, "funcName": "cli", "lineno": 49, "message": "Matched Fasta or fasta to fasta"}
References
For learning more about python logging, the docs are decent, but this video by mCoding is good
Configuration for logging via file - right now needs some runtime variables, like creating a sub directory for the user, so the logging config is managed in python. This perhaps could be improved also by using dynaconf
This should meet a basic logging and configuration needs for the first users and use cases. There are improvements that can be made (mentioned below), but for now, I think this gets us to 80% or more of what we need:
Note: I'm holding off on a bit of details in the README that will change in an upcoming PR working on configuration features
Changes
Before
After
and generates
References
For learning more about python logging, the docs are decent, but this video by mCoding is good
Future improvements