-
Notifications
You must be signed in to change notification settings - Fork 49
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
Log files updates #165
Log files updates #165
Conversation
* Add docs * Log file per level * Log files name consistency * Clean up a few instances where it just had `warn` instead of `warning`
Codecov Report
@@ Coverage Diff @@
## develop #165 +/- ##
===========================================
+ Coverage 80.6% 80.82% +0.22%
===========================================
Files 36 36
Lines 2527 2556 +29
Branches 319 320 +1
===========================================
+ Hits 2037 2066 +29
- Misses 386 387 +1
+ Partials 104 103 -1
Continue to review full report at Codecov.
|
|
||
Please see the [code of conduct](https://github.com/panoptes/POCS/blob/develop/CODE_OF_CONDUCT.md) for our | ||
Please see the [code of conduct](https://github.com/panoptes/POCS/blob/develop/CODE_OF_CONDUCT.md) |
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 should probably be a link to the primary branch (which is changeable), so please remove "blob/develop/" from the URL.
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.
Unfortunately those kind of links don't work in github. The blob/develop
is the only way to link to an active item in to the repo AFAIK.
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.
Got it.
CONTRIBUTING.md
Outdated
@@ -22,22 +26,84 @@ playground rules and follow them during all your contributions. | |||
|
|||
|
|||
# Setting up Local Environment | |||
- Follow instructions on the [Coding in PANOPTES](https://github.com/panoptes/POCS/wiki/Coding-in-PANOPTES). | |||
- Follow instructions on the |
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.
and in README.md... which probably means we need to spend some time (not immediately) to organize the docs into sensible locations.
CONTRIBUTING.md
Outdated
instead of `My File.py`. | ||
- Define any project specific terminology or abbreviations you use in the file you use them. | ||
- Variable/function/class and file names should be meaningful and descriptive. | ||
- File names should be underscored, not contain spaces ex. my_file.py. |
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.
Two duplicate (older) lines.
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.
Wow, I think I have merged this incorrectly every single time. ;)
CONTRIBUTING.md
Outdated
continue. | ||
- The logger supports variable information without the use of the `format` method. | ||
- There is a `say` method that is meant to be used in friendly manner to convey information to a | ||
user. This should be used only for personable output and is typically displayed in the "chat box" |
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.
By "personable output", shall I assume that you mean something like "messages intended for the operator"?
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.
Sort of yes. I made a change to description above. The say
method is only available to the POCS
class (not in PanBase
and therefore not in all classes) and should be very friendly output. As in something that you could feasibly send to twitter if you wanted your unit to do such a thing.
The only place so far that there is really operator output was for the drift alignment stuff and that was simply to support Nem the one time he was doing that. During normal operations the say
output doesn't include anything technical.
The method is also a place that could easily be internationalized, which I have an Issue for, which would mostly be for fun. But that way someone can make their unit "speak" in whatever language they want.
CONTRIBUTING.md
Outdated
- ERROR (i.e. `self.logger.error()`) should be used at critical levels when operation cannot | ||
continue. | ||
- The logger supports variable information without the use of the `format` method. | ||
- There is a `say` method that is meant to be used in friendly manner to convey information to a |
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.
There is a say
method available on sub-classes of PanBase that is meant...
pocs/core.py
Outdated
@@ -43,6 +43,11 @@ def __init__(self, state_machine_file='simple_state_table', messaging=False, **k | |||
PanBase.__init__(self, **kwargs) | |||
|
|||
self.logger.info('Initializing PANOPTES unit') |
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.
Remove old, non-parameterized message.
pocs/images.py
Outdated
@@ -115,7 +115,8 @@ def pointing_error(self): | |||
namedtuple: Pointing error information | |||
""" | |||
if self._pointing_error is None: | |||
assert self.pointing is not None, self.logger.warn("No WCS, can't get pointing_error") | |||
assert self.pointing is not None, self.logger.warning( | |||
"No WCS, can't get pointing_error") |
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.
WCS?
pocs/utils/logger.py
Outdated
|
||
# Configure the logger | ||
logging.config.dictConfig(log_config) | ||
|
||
# Get the logger and set as attribute to class | ||
logger = logging.getLogger(profile) | ||
|
||
# Don't want log messages from state machine library |
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 appreciate the comment as I had no idea what this was about. I wonder if this is the kind of thing that could be in conf_files/log.yaml. What do you think?
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 don't think we ever want to show these. There is a lot of output that is generated (something like: prepare, before enter, enter, after enter, before exit, exit, etc) and we already have our own logging for entering/exiting each state.
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.
Got it. In that case, please say so succinctly.
Don't want log messages from state machine library, it is very noisy and we have our own logging of state transitions.
super(PanLogger, self).__init__() | ||
self.logger = logger | ||
|
||
def _process_str(self, fmt, *args, **kwargs): |
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 don't understand why this method is necessary. According to the python documentation, the loggers do exactly this formatting.
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 supports the actual format style, e.g. {:0.2f}
, {:40s}
, rather than just supporting {}
as placeholders. The loggers support this via the %f
syntax, which is simply for backwards-compatibility. This allows us to just get rid of actual format
calls in the logger but still keep the same syntax.
I could definitely be wrong about this but the format specifiers didn't seem to work for me otherwise.
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.
OK. Perhaps add a comment explaining that?
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.
Update now that I'm trying to use the logger: it is confusing to have PanLogger use a different formatting convention from python's loggers, even though the API is otherwise identical.
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.
Not sure I follow. You should be able to use either convention.
warn
instead ofwarning
Replaces #163 which replaces #160. The difference with #163 here is just that it has a cleaner history without extraneous commits.