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

Implement Format Devices #7

Merged
merged 2 commits into from
Dec 13, 2016
Merged

Implement Format Devices #7

merged 2 commits into from
Dec 13, 2016

Conversation

pleonex
Copy link
Contributor

@pleonex pleonex commented Nov 11, 2016

Implement a new device that allows to show the parsed output in different format. The default and current implementation is Markdown but in the future we could implement XML or JSON devices.

Copy link
Contributor

@iblancasa iblancasa left a comment

Choose a reason for hiding this comment

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

A good practice when you are programming in Python is adding the type of the parameters. For example:

def write_statistics_packets(self, state):
   """Write the packet statistics."""
   Params:
      +state (dict): state of blablabl...

Also, there are a lot of methods where the parameters are not in the documentation. Example:

def dict_regex_search(content, regex):
    """Apply the regex over all the fields of the dictionary."""
  CODE 

In this case, we should document what are content and regex parameters and what is their "mission"

def write_message(self, content, state):
"""Write the message.

The content argument is a dictionary with at least 'description' item.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that is not a good idea to explain the "content" param in this way. Please, follow the same style as in the other functions

@@ -16,82 +16,104 @@
"""Logger functions.

The module contains functions to log the new messages.
The 'content' dictionary is defined in the FormatDevice class.
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure about how to describe this param but I think that this is not correct

class MarkdownFormatDevice(FormatDevice):
"""Format device for Markdown.

Functions:
Copy link
Contributor

Choose a reason for hiding this comment

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

Methods

The module contains the abstract class representation for a formatter of the
parsed logs.

Classes:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that this comment it is not necessary: we only have a class in this file (with the same name of the class).

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Package LogParser."""
Copy link
Contributor

Choose a reason for hiding this comment

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

Package LogParser or LogParser Packgage?

@pleonex
Copy link
Contributor Author

pleonex commented Dec 12, 2016 via email

@pleonex pleonex mentioned this pull request Dec 12, 2016
@pleonex
Copy link
Contributor Author

pleonex commented Dec 12, 2016

I have created #11 to track the documentation discussion. Do you agree to make these changes in other PR? If so, is there any change pending in this PR?

@iblancasa iblancasa merged commit 5e6b602 into master Dec 13, 2016
@iblancasa
Copy link
Contributor

Perfect!

@pleonex pleonex deleted the formatters branch December 13, 2016 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants