ckwatson / kernel

Does the math.
GNU General Public License v3.0
0 stars 0 forks source link

Implementing Logging #7

Open ngraymon opened 8 years ago

ngraymon commented 8 years ago

Logging as described in the python documentation would greatly improve the health of the project.

Goals

Files requiring changes

Example change Replacing print("\n Attempting to plot " + str(number_of_plots) + " concentration profiles") with logger.info('\n Attempting to plot " + str(number_of_plots) + " concentration profiles')

or `print("Another issue has been detected. Reaction "

Steps to implement

ngraymon commented 8 years ago

Initial implementation of logging: ckwatson/kernel@1525db050b68d7534a3916d17168e4b357c6d84f ckwatson/web_gui@53a1029620dfd091defee5a0e823e5befc3cdfc1

Current Issues:

Logging errors print to output twice. I believe this is a propagation error because the propagation of the logger is turned off.

tslmy commented 8 years ago

Logging errors print to output twice.

This is because the logger object has 2 handlers attached:

I checked this by turning off one of the handlers. When only one handler exists, the -- logging error -- only shows up once.

It is not a propagation error. It merely means that both the handlers are failing.

I think this "double-printing" error is inevitable at this time, unless we make sure no error would happen when trying to log something.

tslmy commented 8 years ago

About the documentation: should we write them in a Wiki? For the time being, I'll just take a quick note down here:


For each module, add the following lines to the top:

import logging
logger = logging.getLogger(__name__)

Then we can send messages in various circumstances as described here.