make fpdb and hud write separate log files, refine py2exe some more

This commit is contained in:
sqlcoder 2010-02-10 23:33:50 +00:00
parent 0449c06e29
commit a93562c229
5 changed files with 18 additions and 8 deletions

View File

@ -105,14 +105,17 @@ def get_config(file_name, fallback = True):
sys.exit() sys.exit()
return (file_name,True) return (file_name,True)
def get_logger(file_name, config = "config", fallback = False, log_dir=None): def get_logger(file_name, config = "config", fallback = False, log_dir=None, log_file=None):
(conf_file,copied) = get_config(file_name, fallback = fallback) (conf_file,copied) = get_config(file_name, fallback = fallback)
if log_dir is None: if log_dir is None:
log_dir = os.path.join(get_exec_path(), 'log') log_dir = os.path.join(get_exec_path(), 'log')
#print "\nget_logger: checking log_dir:", log_dir #print "\nget_logger: checking log_dir:", log_dir
check_dir(log_dir) check_dir(log_dir)
file = os.path.join(log_dir, 'logging.out') if log_file is None:
file = os.path.join(log_dir, 'fpdb-log.txt')
else:
file = os.path.join(log_dir, log_file)
if conf_file: if conf_file:
try: try:
@ -469,7 +472,7 @@ class Config:
self.dir_config = os.path.dirname(self.file) self.dir_config = os.path.dirname(self.file)
self.dir_log = os.path.join(self.dir_config, 'log') self.dir_log = os.path.join(self.dir_config, 'log')
self.dir_database = os.path.join(self.dir_config, 'database') self.dir_database = os.path.join(self.dir_config, 'database')
self.log_file = os.path.join(self.dir_log, 'logging.out') self.log_file = os.path.join(self.dir_log, 'fpdb-log.txt')
log = get_logger("logging.conf", "config", log_dir=self.dir_log) log = get_logger("logging.conf", "config", log_dir=self.dir_log)
# Parse even if there was no real config file found and we are using the example # Parse even if there was no real config file found and we are using the example

View File

@ -27,7 +27,7 @@ from time import *
try: try:
import matplotlib import matplotlib
matplotlib.use('GTK') matplotlib.use('GTKCairo')
from matplotlib.figure import Figure from matplotlib.figure import Figure
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar

View File

@ -72,7 +72,8 @@ class HUD_main(object):
print "\nHUD_main: starting ..." print "\nHUD_main: starting ..."
self.db_name = db_name self.db_name = db_name
self.config = Configuration.Config(file=options.config, dbname=db_name) self.config = Configuration.Config(file=options.config, dbname=db_name)
log = Configuration.get_logger("logging.conf", "hud", log_dir=self.config.dir_log) log = Configuration.get_logger("logging.conf", "hud", log_dir=self.config.dir_log, log_file='HUD-log.txt')
print "Logfile is " + os.path.join(self.config.dir_log, 'HUD-log.txt')
log.info("HUD_main starting: using db name = %s" % (db_name)) log.info("HUD_main starting: using db name = %s" % (db_name))
try: try:

View File

@ -689,7 +689,7 @@ class fpdb:
"""Loads profile from the provided path name.""" """Loads profile from the provided path name."""
self.config = Configuration.Config(file=options.config, dbname=options.dbname) self.config = Configuration.Config(file=options.config, dbname=options.dbname)
log = Configuration.get_logger("logging.conf", "fpdb", log_dir=self.config.dir_log) log = Configuration.get_logger("logging.conf", "fpdb", log_dir=self.config.dir_log)
print "Logfile is " + os.path.join(self.config.dir_log, 'logging.out') + "\n" print "Logfile is " + os.path.join(self.config.dir_log, self.config.log_file) + "\n"
if self.config.example_copy: if self.config.example_copy:
self.info_box( "Config file" self.info_box( "Config file"
, "has been created at:\n%s.\n" % self.config.file , "has been created at:\n%s.\n" % self.config.file

View File

@ -53,7 +53,7 @@ Py2exe script for fpdb.
# sqlcoder notes: this worked for me with the following notes: # sqlcoder notes: this worked for me with the following notes:
#- I used the following versions: #- I used the following versions:
# python 2.5.4 # python 2.5.4
# gtk+ 2.14.7 # gtk+ 2.14.7 (gtk_2.14.7-20090119)
# pycairo 1.4.12-2 # pycairo 1.4.12-2
# pygobject 2.14.2-2 # pygobject 2.14.2-2
# pygtk 2.12.1-3 # pygtk 2.12.1-3
@ -137,7 +137,13 @@ setup(
options = {'py2exe': { options = {'py2exe': {
'packages' : ['encodings', 'matplotlib'], 'packages' : ['encodings', 'matplotlib'],
'includes' : ['cairo', 'pango', 'pangocairo', 'atk', 'gobject' 'includes' : ['cairo', 'pango', 'pangocairo', 'atk', 'gobject'
,'PokerStarsToFpdb', 'matplotlib.numerix.random_array'], ,'matplotlib.numerix.random_array'
,'AbsoluteToFpdb', 'BetfairToFpdb'
,'CarbonToFpdb', 'EverleafToFpdb'
,'FulltiltToFpdb', 'OnGameToFpdb'
,'PartyPokerToFpdb', 'PokerStarsToFpdb'
,'UltimateBetToFpdb', 'Win2dayToFpdb'
],
'excludes' : ['_tkagg', '_agg2', 'cocoaagg', 'fltkagg'], # surely we need this? '_gtkagg' 'excludes' : ['_tkagg', '_agg2', 'cocoaagg', 'fltkagg'], # surely we need this? '_gtkagg'
'dll_excludes': ['libglade-2.0-0.dll', 'libgdk-win32-2.0-0.dll' 'dll_excludes': ['libglade-2.0-0.dll', 'libgdk-win32-2.0-0.dll'
,'libgobject-2.0-0.dll'], ,'libgobject-2.0-0.dll'],