-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from rticommunity/formatters
Implement Format Devices
- Loading branch information
Showing
5 changed files
with
497 additions
and
299 deletions.
There are no files selected for viewing
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,20 @@ | ||
# Log Parser for RTI Connext. | ||
# | ||
# Copyright 2016 Real-Time Innovations, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# 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.""" | ||
|
||
__version__ = "1.2a2" | ||
__license__ = "Apache" | ||
__copyright__ = "Copyright 2016 Real-Time Innovations, Inc." |
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,65 @@ | ||
# Log Parser for RTI Connext. | ||
# | ||
# Copyright 2016 Real-Time Innovations, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# 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. | ||
"""Device for the output format. | ||
The module contains the abstract class representation for a formatter of the | ||
parsed logs. | ||
Classes: | ||
+ FormatDevice: Abstract base class for format device implementations. | ||
""" | ||
|
||
|
||
class FormatDevice(object): | ||
"""Abstract base class for format device implementations. | ||
You will need to implement the following methods: | ||
+ write_header: write the header if any. | ||
+ write_configurations: write the configuration messages. | ||
+ write_warnings: write the warning messages. | ||
+ write_errors: write the error messages. | ||
""" | ||
|
||
def write_header(self, state): | ||
"""Write the header if any.""" | ||
raise NotImplementedError("write_header not implemented") | ||
|
||
def write_message(self, content, state): | ||
"""Write the message. | ||
The content argument is a dictionary with at least 'description' item. | ||
The optional items are: | ||
+ kind: the kind or remark for the message. | ||
+ timestamp: the timestamp of the message. | ||
+ input_line: the current input line. | ||
+ output_line: the current output line. | ||
+ inout: [packets-only] 'in' if it's input packet, 'out' otherwise. | ||
+ remote: [packets-only] the remote address of the sender/receiver. | ||
+ entity: [packets-only] the local entity sending/receiving. | ||
""" | ||
raise NotImplementedError("write_message not implemented") | ||
|
||
def write_configurations(self, state): | ||
"""Write the configuration messages.""" | ||
raise NotImplementedError("write_configurations not implemented") | ||
|
||
def write_warnings(self, state): | ||
"""Write the warning messages.""" | ||
raise NotImplementedError("write_warnings not implemented") | ||
|
||
def write_errors(self, state): | ||
"""Write the error messages.""" | ||
raise NotImplementedError("write_errors not implemented") |
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.