Skip to content
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

adding logging to io.genomio.fasta.process #206

Closed
wants to merge 3 commits into from
Closed

Conversation

vsitnik
Copy link
Contributor

@vsitnik vsitnik commented Nov 9, 2023

No description provided.

@vsitnik vsitnik changed the base branch from main to hackathon_nov23 November 9, 2023 22:54
from ensembl.utils.argparse import ArgumentParser

# logging references module, but can be overridden by a specific logger
import logging
logger = logging # by default
Copy link
Contributor Author

@vsitnik vsitnik Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we can just replace logger with logging and do something like

logging = None
import logging
def ...
    logging.info(...)

def main:
    ...
    logging = setup_logging(...)
    ...    

Or make a more cruel thing.
Just treat import logging as definition of a global var. So just

#  logging = None
import logging

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not happy with the logger approach either, so that is why I have opted for accessing the logging.root instead in my PR.

Copy link
Contributor Author

@vsitnik vsitnik Nov 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the reassigning of logging way,
because in this case you're allowing the module to be used/imported from the outside without calling main function and setup we have in it.
So if you use main -- you define your own logger (however prettified) and assign it to global logging (replacing it, basically).
But if you import this module from outside, you preserve logging default settings (perhaps, already modified by the calling/upstream code).

In this case this module itself doesn't import other models with logging.
I think, it's worth to update the root logger to propagate changes downstream, instead as in your PR !207.

@MatBarba MatBarba changed the base branch from hackathon_nov23 to main November 15, 2023 11:20
Copy link
Contributor

@MatBarba MatBarba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the new logging handler in ensembl-py now, this PR needs to use that one instead

@vsitnik vsitnik closed this Nov 21, 2023
@vsitnik vsitnik deleted the hnov23/fasta branch November 21, 2023 12:21
@vsitnik
Copy link
Contributor Author

vsitnik commented Nov 21, 2023

replaced with #222

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants