-
Notifications
You must be signed in to change notification settings - Fork 11
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
Share log attr between cli classes #759
Open
evrose54
wants to merge
9
commits into
main
Choose a base branch
from
share-log-attr-between-cli-classes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e1e696d
modified CLI to support a shared LOG attribute
evrose54 fbec14b
refactored log level to be handled by argparse rather than separate f…
evrose54 7c16e26
added functionality to support adding --log-level anywhere in your co…
evrose54 5ccf086
added release notes for this PR
evrose54 8160562
figured out to have log level shown in the help messages while also p…
evrose54 cc2563b
updated release notes for new changes
evrose54 b4613b4
Merge branch 'main' into share-log-attr-between-cli-classes
jsolbrig c87ee9a
updated order of logging levels in the cli
evrose54 6bc6b9f
Merge branch 'main' into share-log-attr-between-cli-classes
evrose54 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
docs/source/releases/latest/share-log-attr-between-cli-classes.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Refactoring Updates: | ||
- description: | | ||
*From GEOIPS#714: 7-26-24, Discuss how to share LOG attribute in the CLI* | ||
|
||
Since we've started developing the GeoIPS CLI, we've known that there was a need to | ||
have a shared logger object among all of the CLI command classes for debugging | ||
purposes and to output basic information to the user if requested. We can now do | ||
this using the '--log-level' / '-log' flag. Depending on the log level set, all | ||
levels that match or are of higher 'order' than the log level provided will be | ||
outputted. This functionality matches that used in 'run_procflow'. Logging is now | ||
a supported utility throughout the CLI, and can be used in any CLI class via | ||
self.LOG.<log_level>(log_statement). Note that self.LOG.<log_level> does not have to | ||
match the provided '--log-level' ran in the command. This flag is strictly just the | ||
LOG level filter. I.e. if '--log-level info' was provided, levels | ||
['info', 'debug', 'interactive'] would be shown. The lower the level, the more | ||
logging channels will output. | ||
files: | ||
modified: | ||
- geoips/commandline/commandline_interface.py | ||
- geoips/commandline/geoips_command.py | ||
related-issue: | ||
number: 714 | ||
repo_url: https://github.com/NRLMMD-GEOIPS/geoips | ||
title: Share Logger Object to CLI Command Classes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think this line should be reverted to the previous order.
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.
It seems
interactive
is set to level 35. Debug is 10, info is 20, warning is 30, error is 40, critical is 50. So the list should actually be in the order of[debug, info, warning, interactive, error, critical]
.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 has since been addressed.