[gedit-latex] init: Do not print debug log messages to stdout by default.



commit 0b896c73ded3c64f79a362b22d5f4a624780d473
Author: Josà Aliste <jaliste src gnome org>
Date:   Sun Jan 29 16:26:25 2012 +0100

    init: Do not print debug log messages to stdout by default.
    
    To print debug messages on stdout, the environment variable
    GEDIT_LATEX_PLUGIN_DEBUG must be defined.

 latex/__init__.py |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/latex/__init__.py b/latex/__init__.py
index 9fa6d26..003d38c 100644
--- a/latex/__init__.py
+++ b/latex/__init__.py
@@ -18,10 +18,15 @@
 # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 # Street, Fifth Floor, Boston, MA  02110-1301, USA
 
-import logging
+import logging, os
+
+if os.getenv("GEDIT_LATEX_PLUGIN_DEBUG") is not None:
+    log_level = logging.DEBUG
+else:
+    log_level = logging.ERROR
 
 logging.basicConfig(
-    level=logging.DEBUG,
+    level=log_level,
     format="%(levelname)-8s:%(name)-30s: %(message)s (l.%(lineno)d)")
 
 from gi.repository import Gio
@@ -33,6 +38,4 @@ if "org.gnome.gedit.plugins.latex" not in Gio.Settings.list_schemas():
 from appactivatable import LaTeXAppActivatable
 from windowactivatable import LaTeXWindowActivatable
 
-
-
 # ex:ts=4:et:



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