Skip to content

Logging Change Over

negolith edited this page Sep 4, 2014 · 6 revisions

Introduction

The initial code taken from lad1337 had many issue. Now that a quasi working version in Python3 exists more exhaustive renovations can take place. One of the major revisions is the logging system. While a logging system exists it is homegrown.

The intent of this project is to change all of the logging code over to the python logging library. The ramifications of this will be a much cleaner logging solution that can be directed to outputs as desired.

Project Tasks

There are several main tasks to complete

  • Investigate the logging library and its functionality when used with multiple modules
  • Write test code for the logging module (presumably outside of git) (tutorials from python are sufficient)
  • Identify the messages currently printed and categorize them into the logging structure
  • make the actual changes to the code

Note: by default the logger does not support logging to multiple outputs. The module is capable of this but requires custom objects. This current push will not include that and log everything to a file although if we are willing adding the multiple layers would be quite useful. This will enable further work to progress without requiring the custom objects. Due to the nature of the logger library if people conform to the rules the future changes should not require any changes on the lower level modules.

If we wish to use multiple emitters please refer to this page for the examples.

This all assumes that the highest level module we care about is connection.

Files Affected

Virtually all of them. Refer to other page for files affected that actually use the logging module. Line Output for Logging Change over

There are various other messages that are just printed that should be handled as well.

Code Changes

Code changes should consist of the following steps.

  1. Open module to be converted
  2. Review log messages and assign priority levels (for now we should probably use the defaults)
  3. Convert current log messages to new format and test new logging
  4. Remove from arguments the log function (this will necessitate finding other references to the functions and modifying as needed) (possibly use a

Clone this wiki locally