AnthonyChiavelli / VisualGit

Graphical, educational python app for working with git repositories
GNU General Public License v3.0
7 stars 2 forks source link

Logging #3

Open kahmali opened 10 years ago

kahmali commented 10 years ago

Logging is messy. Let's clean it up somehow.

This is a broad issue. Currently we need to do something like this:

logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
ch.setFormatter(formatter)
logger.addHandler(ch)

at some global level (currently the module level), so that we can do stuff like this within that scope:

logger.debug("Debug statement here")

I'd really prefer not to have that cruft in every module, so at the least we need to refactor it out somehow. Suggestions?

AnthonyChiavelli commented 10 years ago

I've implemented two loggers, one for program level logging (stuff we care about) and one for all git interactions (stuff the user cares about). The former logs to the console (only stderr I think) and the latter to a file in the logs/ directory of the project. My code will create this directory and fail gracefully if it cannot be created.

kahmali commented 10 years ago

I'm not getting any output in the console or log file when trying to use either logger ("app_logger" and "git_interaction_log").