Lars Yencken avatar Lars Yencken committed 022eeec

Added an explicit LOG_DIR setting, and used this to redirect logging output.

Each different module which produces a log file now puts one into the same
logging directory which defaults to ROOT_DIR/tmp/log.

Comments (0)

Files changed (5)

eval/constructEvalTable.py

 #----------------------------------------------------------------------------#
 
 _tableOutput = os.path.join(os.path.dirname(__file__), 'evalTable.tex')
-_logFile = os.path.join(os.path.dirname(__file__), 'evalTable-%s.log')
+_logFile = os.path.join(settings.LOG_DIR, 'evalTable-%s.log')
 _kanaData = os.path.join(settings.DATA_DIR, 'eval', 'evalData-kana')
 _pinyinData = os.path.join(settings.DATA_DIR, 'eval', 'evalData-pinyin')
 

eval/errorStats.py

 
 #----------------------------------------------------------------------------#
 
-_kanaFile = os.path.join(os.path.dirname(__file__), 'evalTable-kana.log')
-_pinyinFile = os.path.join(os.path.dirname(__file__), 'evalTable-pinyin.log')
+_kanaFile = os.path.join(settings.LOG_DIR, 'evalTable-kana.log')
+_pinyinFile = os.path.join(settings.LOG_DIR, 'evalTable-pinyin.log')
 
 _kanaErrorFile = os.path.join(settings.DATA_DIR, 'eval',
         'kana-errors-kumiko.csv')

pinyin/hanziReadingModel.py

         # XXX To improve this, we could just multiply the dictionary count by
         #     the corpus frequency for that word.
 
+        logFileName = os.path.join(settings.LOG_DIR, 'badEntries.log')
         try:
-            outputLog = sopen('badEntries.log', 'w')
+            outputLog = sopen(logFileName, 'w')
         except IOError:
             outputLog = None
 

pinyin/lookupIndex.py

 
 #----------------------------------------------------------------------------#
 
-_logFile = os.path.join(www.settings.TEMP_DIR, '%s_lookupIndex.log')
+_logFile = os.path.join(www.settings.LOG_DIR, '%s_lookupIndex.log')
 
 #----------------------------------------------------------------------------#
 
 DATA_DIR = path.join(environ['HOME'], 'Data')
 TEMP_DIR = path.join(ROOT_DIR, 'tmp')
 CACHE_DIR = path.join(TEMP_DIR, 'cache')
+LOG_DIR = path.join(TEMP_DIR, 'log')
 
 ADMINS = (
     # ('Your Name', 'your_email@domain.com'),
 
 #----------------------------------------------------------------------------#
 
-for dirName in TEMP_DIR, CACHE_DIR:
+for dirName in TEMP_DIR, CACHE_DIR, LOG_DIR:
     if not path.isdir(dirName):
         mkdir(dirName)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.