Skip to content

Implement a consistent logging for refinegems #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cb-Hades opened this issue Feb 24, 2025 · 1 comment
Open

Implement a consistent logging for refinegems #155

cb-Hades opened this issue Feb 24, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@cb-Hades
Copy link
Collaborator

cb-Hades commented Feb 24, 2025

Due to the nature of refineGEMs (being a toolbox), it would be helpful to have a consistent logger that can be accessed and viewed from other tools that call functions from refinegems and not have everything being written to the root logger.

A good solution might be to write a logger with the Python logging module that can be imported from every module in refinegems, similar to COBRApy or Memote.

❕When implementing logging, keep in mind to handle exceptions correctly.

Modules

  • gapfill (with note as logging option if something is between info and warning)
  • db_access
  • set_up -> e.g. file size in ..utility.set_up.download_url, out put of DIAMOND calls
  • ...

Notes

  • one logger for all modules or one for each submodule? Hierarchical? -> Important: correct propagation

  • maybe add some decorator for special logging cases --> BUT: see above (how to log in hierachical logger?)

  • Idea: do it similarly to COBRApy?

  • Coloured text could be used for logging:

from colorama import init as colorama_init
from colorama import Fore

def coloured_example_text():
     colorama_init(autoreset=True)
     print(f'{Fore.RED}To use the KEGG comparison the specification of the organismid (KEGG organism code) is obligatory.\n' +
       'If there is no organism code available for your organism in KEGG but an entry for your organism exists in BioCyc, use the option \'BioCyc\'.\n' +
       'If no entry for your organism exists in KEGG and/or BioCyc, the gap analysis cannot be done.')
@cb-Hades cb-Hades added the enhancement New feature or request label Feb 24, 2025
cb-Hades added a commit that referenced this issue May 16, 2025
@cb-Hades
Copy link
Collaborator Author

I added a logger for all modules currently using logging and changed logging.xxx to logger.xxx.
The logger can now be propagated with the refinegems keyword.

cb-Hades added a commit that referenced this issue May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant