[gnome-games/applygsoc2009: 23/76] Make logger working



commit b466522b6481cb992efe2cd2d567b346eb4da628
Author: Pablo Castellano <pablog src gnome org>
Date:   Thu Aug 26 11:22:38 2010 +0200

    Make logger working

 gnome-sudoku/src/lib/main.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/main.py b/gnome-sudoku/src/lib/main.py
index df4b230..f253a29 100644
--- a/gnome-sudoku/src/lib/main.py
+++ b/gnome-sudoku/src/lib/main.py
@@ -5,6 +5,7 @@ try:
 except ImportError, err:
     print ("PyGTK not found. Please make sure it is installed properly and referenced in your PYTHONPATH environment variable.")
 
+import logging
 import os.path
 import threading
 
@@ -25,6 +26,9 @@ from defaults import (APPNAME, APPNAME_SHORT, AUTHORS, COPYRIGHT, DESCRIPTION, D
         IMAGE_DIR, LICENSE, MIN_NEW_PUZZLES, UI_DIR, VERSION, WEBSITE, WEBSITE_LABEL)
 from gtk_goodies import gconf_wrapper, Undo, dialog_extras
 
+logging.basicConfig()
+logger = logging.getLogger("main")
+
 ICON_FACTORY = gtk.IconFactory()
 STOCK_PIXBUFS = {}
 for filename, stock_id in [('footprints.png', 'tracks'), ]:
@@ -937,6 +941,9 @@ class TrackerBox (gtk.VBox):
 def start_game (debug=False):
     if debug:
         print 'Starting GNOME Sudoku in debug mode'
+		logger.setLevel(logging.DEBUG)
+    else:
+        logger.setLevel(logging.INFO)
 
     ##  You must call g_thread_init() before executing any other GLib
     ##  functions in a threaded GLib program.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]