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

cleanup how logging is handled #122

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open

Conversation

nstelter-slac
Copy link
Collaborator

@nstelter-slac nstelter-slac commented Aug 6, 2024

see commit comment and doc update for more details

we want to log and also to print to terminal, without calls to both log and print. easiest way seems to use log statement and set it up to also write to the terminal.

prints can of course still be used for debugging or anything else, but to avoid confusion with mixed logs and prints it might best to use just log calls for any significant output.

can just use the BasicSuiteScripts class "logger" object with different log levels:

    bss.logger.info("useful info from the code")
    bss.logger.error("script hit an error")
    bss.logger.exception("script hit a python exception)

Idea is that logging should be used for most output (prints for debugging and other
messy output could still be fine). This is to avoid confusion when mixing logs and prints.

Should try to use appropriate log level: logger.info(), logger.error(), logger.exception()

In this patch:
-setup moved to inside library, no longer per highlevel script
-remove logs folder and by default have single log.txt file in project root
-add cmdline option to specify log-file, so can still easily have one-off and script specific log-files

Followup patch will update suite_scripts files to remove redundant print calls
@nstelter-slac nstelter-slac changed the title Improve logging cleanup how logging is handled Aug 6, 2024
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.

1 participant