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

Log files updates #165

Merged
merged 7 commits into from
Dec 4, 2017
Merged

Log files updates #165

merged 7 commits into from
Dec 4, 2017

Conversation

wtgee
Copy link
Member

@wtgee wtgee commented Dec 3, 2017

  • Add docs
  • Log file per level
  • Log files name consistency
  • Clean up a few instances where it just had warn instead of warning

Replaces #163 which replaces #160. The difference with #163 here is just that it has a cleaner history without extraneous commits.

* Add docs
* Log file per level
* Log files name consistency
* Clean up a few instances where it just had `warn` instead of `warning`
@wtgee wtgee requested a review from jamessynge December 3, 2017 06:35
@wtgee wtgee mentioned this pull request Dec 3, 2017
@codecov
Copy link

codecov bot commented Dec 3, 2017

Codecov Report

Merging #165 into develop will increase coverage by 0.21%.
The diff coverage is 90.47%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ
pocs/mount/mount.py 57.84% <0%> (ø) ⬆️
pocs/core.py 79.82% <66.66%> (-0.09%) ⬇️
pocs/utils/logger.py 96.36% <97.29%> (+4.36%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b3929e...418cad3. Read the comment docs.


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)
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two duplicate (older) lines.

Copy link
Member Author

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"
Copy link
Contributor

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"?

Copy link
Member Author

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
Copy link
Contributor

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')
Copy link
Contributor

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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WCS?


# 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
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

@jamessynge jamessynge Dec 4, 2017

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):
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Member Author

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.

jamessynge
jamessynge previously approved these changes Dec 4, 2017
@wtgee wtgee merged commit cfb1515 into panoptes:develop Dec 4, 2017
@wtgee wtgee deleted the log-file-updates branch December 4, 2017 03:04
@wtgee wtgee mentioned this pull request Dec 29, 2017
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.

2 participants