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

Logging structure decisions #40

Open
LOHMgit opened this issue Sep 8, 2022 · 3 comments
Open

Logging structure decisions #40

LOHMgit opened this issue Sep 8, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@LOHMgit
Copy link
Collaborator

LOHMgit commented Sep 8, 2022

We need to log to stdout because this is how Pachyderm will be able to track the logs from the container. So, I don't think that we need to set file related things. In terms of logging more generally, maybe we want to do something like this, but at a higher level for the API (such that all the scripts and API itself can import this). However, let's push that to a new PR. For now, I think something like the following would suffice:

import logging
logging.warning('Watch out!') # will print a message to the console
logging.info('I told you so') # will not print anything

@LOHMgit
Copy link
Collaborator Author

LOHMgit commented Sep 27, 2022

def get_logger():
module_name = file.split('/')[-1].split('.')[0]
#set the root logger to a debug level
logger = logging.getLogger(module_name)
logger.setLevel(logging.DEBUG)
logger.handlers = []
#set up a stream handler
s_handler = logging.StreamHandler()
s_handler.setLevel(logging.DEBUG)
log_format = logging.Formatter(fmt='%(asctime)s | %(levelname)s | %(message)s | %(name)s',
datefmt='%Y-%m-%d %H:%M:%S')
s_handler.setFormatter(log_format)
logger.addHandler(s_handler)
return logger

Here is how I was handling it before...

@woodwardmw
Copy link
Collaborator

@LOHMgit I think we're mostly using print statements to modal now. Is there any advantage to doing this kind of logging?

@LOHMgit LOHMgit self-assigned this Feb 23, 2023
@LOHMgit LOHMgit added the enhancement New feature or request label Feb 23, 2023
@LOHMgit
Copy link
Collaborator Author

LOHMgit commented Mar 31, 2023

@woodwardmw Does SIL have any centralized logging service that they use?

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

2 participants