Author: duncan
Date: Tue Jun 12 19:23:03 2007
New Revision: 9685

Modified:
   branches/rel-1/freevo/freevo_config.py
   branches/rel-1/freevo/local_conf.py.example
   branches/rel-1/freevo/src/config.py

Log:
Changed logging level, changed the log name


Modified: branches/rel-1/freevo/freevo_config.py
==============================================================================
--- branches/rel-1/freevo/freevo_config.py      (original)
+++ branches/rel-1/freevo/freevo_config.py      Tue Jun 12 19:23:03 2007
@@ -588,11 +588,6 @@
 HOST_ALIVE_CHECK = 'ping -c 1 -W 1 %s > /dev/null 2>&1'
 
 #
-# store output of started processes for debug
-#
-CHILDAPP_DEBUG = 0
-
-#
 # Directory location to save files when the normal filesystem
 # doesn't allow saving. This directory can save covers and fxd files
 # for read only filesystems like ROM drives. Set this variable to your
@@ -1970,12 +1965,17 @@
 
 DIRECTORY_USE_STAT_FOR_CHANGES = True
 
-# Set to 1 to log mplayer output to ./mplayer_stdout.log and
-# ./mplayer_stderr.log
-MPLAYER_DEBUG = 0
+#
+# store output of started processes for debug
+# Set to 1 to log child application output to <app>_stdout.log and 
<app>_stderr.log
+#
+CHILDAPP_DEBUG = 0
 
 TIME_DEBUG = 0
 
 # The default logging level
 # can be one of CRITICAL (FATAL), ERROR, WARNING (WARN), INFO, DEBUG, NOTSET
-LOGGING = logging.WARNING
+LOGGING = logging.INFO
+
+# When logging is DEBUG or NOTSET then DEBUG level logs messages
+DEBUG = 0

Modified: branches/rel-1/freevo/local_conf.py.example
==============================================================================
--- branches/rel-1/freevo/local_conf.py.example (original)
+++ branches/rel-1/freevo/local_conf.py.example Tue Jun 12 19:23:03 2007
@@ -1658,8 +1658,11 @@
 # LOGGING = logging.DEBUG
 # RECORDSERVER_LOGGING = logging.DEBUG
 # DEBUG = 1
+# messages go to stdout
+# DEBUG_STDOUT = 0
+# messages from starting a child application
 # CHILDAPP_DEBUG = 1
-# MPLAYER_DEBUG = 1
+# timing messages
 # TIME_DEBUG = 0
 
 

Modified: branches/rel-1/freevo/src/config.py
==============================================================================
--- branches/rel-1/freevo/src/config.py (original)
+++ branches/rel-1/freevo/src/config.py Tue Jun 12 19:23:03 2007
@@ -51,6 +51,11 @@
 import logging
 
 
+DINFO = 0
+DWARNING = -1
+DERROR = -2
+DCRITICAL = -3
+
 locale.setlocale(locale.LC_TIME,'')
 
 if float(sys.version[0:3]) >= 2.3:
@@ -60,8 +65,6 @@
 
 VERSION = version.__version__
 
-LOGGING = logging.WARNING
-
 # For Internationalization purpose
 # an exception is raised with Python 2.1 if LANG is unavailable.
 import gettext
@@ -99,28 +102,29 @@
         logging.basicConfig(level=LOGGING, \
             #datefmt='%a, %H:%M:%S',
             format='%(asctime)s %(levelname)-8s %(message)s', \
-            filename=logfile+'.log', filemode='a')
+            filename=logfile, filemode='a')
         self.logfile = logfile
-        try:
-            self.fp = open(logfile, 'a')
-        except IOError:
-            print 'Could not open logfile: %s' % logfile
-            self.fp = open('/dev/null','a')
-        self.softspace = 0
+        #try:
+        #    self.fp = open(logfile, 'a')
+        #except IOError:
+        #    print 'Could not open logfile: %s' % logfile
+        #    self.fp = open('/dev/null','a')
 
     def write(self, msg):
         global DEBUG_STDOUT
         if isinstance(msg, unicode):
             msg = msg.encode(LOCALE)
         if DEBUG_STDOUT:
-            sys.__stdout__.write(msg)
-        self.fp.write(msg)
-        self.fp.flush()
+            print >> sys.__stdout__, s
+            sys.__stdout__.flush
+            #sys.__stdout__.write(msg)
+        #self.fp.write(msg)
+        #self.fp.flush()
         return
 
     def log(self, msg):
-        self.fp.write(msg)
-        self.fp.flush()
+        #self.fp.write(msg)
+        #self.fp.flush()
         return
 
     def flush(self):
@@ -259,13 +263,14 @@
 DEBUG_STDOUT = 1
 
 #
-# Debug all modules?
-# 0 = Debug output off
-# 1 = Some debug output
-# A higher number will generate more detailed output from some modules.
+# debugging messages are set by the logging level
+# except for higher debugging message levels
+# the DEBUG setting is overridden in local_conf.py
 #
 DEBUG = 0
 
+LOGGING = logging.DEBUG
+
 #
 # find the log directory
 #
@@ -285,9 +290,10 @@
     sys.stderr = Logger(sys.argv[0] + ':stderr')
     ts = time.asctime(time.localtime(time.time()))
     sys.stdout.log('-' * 79 + '\n')
-    sys.stdout.log('Freevo (%s) start at %s\n' % (VERSION, ts))
+    sys.stdout.log('Freevo (%s) started at %s\n' % (VERSION, ts))
     sys.stdout.log('-' * 79 + '\n')
 
+
 def _stack_function_(message='', limit=None):
     import traceback
     stack = traceback.extract_stack()
@@ -297,12 +303,13 @@
         else:
             logging.debug('%s\n*** %s' % (message, '*** 
'.join(traceback.format_list(stack)[0:-1])))
 
-DINFO = 0
-DWARNING = -1
-DERROR = -2
-DCRITICAL = -3
 
 def _debug_function_(s, level=1):
+    '''The debug function that is mapped to the _debug_ builtin
+    There are different levels of debugging and logging. Debug messages
+    range from 1 (default) to 9 (most verbose), logging messages range
+    from NOTSET to DCRITICAL
+    '''
     if DEBUG < level:
         return
     try:
@@ -311,8 +318,11 @@
         if isinstance( s, unicode ):
             s = s.encode(encoding, 'replace')
         s = '%s (%s): %s' % (where[0][where[0].rfind('/')+1:], where[1], s)
-        # print debug message
-        print s
+        # print the message for info, warning, error and critical
+        if level <= DINFO and DEBUG_STDOUT:
+            sys.__stdout__.write(s+'\n')
+            sys.__stdout__.flush()
+        # log all the messages
         if level <= DCRITICAL:
             logging.critical(s)
         elif level == DERROR:
@@ -507,7 +517,7 @@
 for dirname in cfgfilepath:
     overridefile = dirname + '/local_conf.py'
     if os.path.isfile(overridefile):
-        if DEBUG: print 'Loading cfg overrides: %s' % overridefile
+        _debug_('Loading cfg overrides: %s' % overridefile, DINFO)
         execfile(overridefile, globals(), locals())
 
         try:
@@ -562,9 +572,9 @@
         import version
         import revision
     logging.getLogger('').setLevel(LOGGING)
-    logging.warn('=' * 80)
-    logging.warn('Log opened for Freevo %s r%s' % (version.__version__, 
revision.__revision__))
-    logging.warn('-' * 80)
+    logging.info('=' * 80)
+    logging.info('Log opened for Freevo %s r%s' % (version.__version__, 
revision.__revision__))
+    logging.info('-' * 80)
 
 #
 # force fullscreen when freevo is it's own windowmanager

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to