-
Notifications
You must be signed in to change notification settings - Fork 347
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
Standardize logging - final places #4665
Standardize logging - final places #4665
Conversation
To check that all executables have the standardized logging, when we check the repo for files which don't have
returns nothing The common pycbc options added to the parser is slightly more complicated, as some of the pygrb codes use a common parser setup, so we see:
but the common options are called within
|
2b23f53
to
f862733
Compare
f862733
to
46ceb20
Compare
34af289
to
f8ba7ce
Compare
f8ba7ce
to
ee9b6e2
Compare
ee9b6e2
to
1c93b22
Compare
Codeclimate failures are unrelated to these changes |
Note i realised i skipped a couple of places for the init_logging check, and saw
of these, |
@@ -0,0 +1,3 @@ | |||
[BASIC] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This silences the codeclimate "logger is not a valid name" complaints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other variables are the pyint defaults
@@ -86,7 +86,8 @@ def add_common_pycbc_options(parser): | |||
'logging at the info level, but -vv or ' | |||
'--verbose --verbose provides debug logging.') | |||
|
|||
def init_logging(verbose=False, | |||
|
|||
def init_logging(verbose=False, default_level=0, to_file=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably the best place to start the review - the more significant change is here:
- We add a default_level kwarg so that the code can define the default level of logging to be higher, but --verbose still adds incremental logging levels
- We add a to_file kwarg, so that we can define logging to a file through the init_logging interface. If wanting logging to more than one file, or to both stderr and the file, we can call init_logging twice with different to_file values
@@ -57,9 +61,8 @@ def pygrb_initialize_plot_parser(description=None, version=None): | |||
formatter_class = argparse.ArgumentDefaultsHelpFormatter | |||
parser = argparse.ArgumentParser(description=description, | |||
formatter_class=formatter_class) | |||
add_common_pycbc_options(parser) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outwith this change, all the changes in pycbc
directory are:
- adding the named logger to the module
- updating
logging
-->logger
to use the named logger - some reordering/reformatting of imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure that 99% of my changes (the most I've ever done by far) are related to simple changes or wanting to understand a bit more the 'standardised' part of things. I imagine I'm just misinformed on a few pythonic things, such as my import pycbc
comment so if you answer it once then feel free to ignore the rest.
74e64c3
to
cd834e5
Compare
fc8e050
to
ae7093f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lfg
Final places where we need to standardise including the logging
This looks like more places than it is because I've added two things in order to simplify logging setup:
default_level
kwarg to init_logging, which means we can easily state that logging should happen, but--verbose
make it a higher levelto_file
kwarg, which sets up logging to a file instead of to the stderr