@staticmethods called more than once
Christian
mining.facts at gmail.com
Tue May 21 11:26:46 EDT 2013
Hi,
i'm somewhat confused working with @staticmethods. My logger and configuration methods are called n times, but I have only one call.
n is number of classes which import the loger and configuration class
in the subfolder mymodule. What might be my mistake mistake?
Many thanks
Christian
### __init__.py ###
from mymodule.MyLogger import MyLogger
from mymodule.MyConfig import MyConfig
##### my_test.py ##########
from mymodule import MyConfig,MyLogger
#Both methods are static
key,logfile,loglevel = MyConfig().get_config('Logging')
log = MyLogger.set_logger(key,logfile,loglevel)
log.critical(time.time())
#Output
2013-05-21 17:20:37,192 - my_test - 17 - CRITICAL - 1369149637.19
2013-05-21 17:20:37,192 - my_test - 17 - CRITICAL - 1369149637.19
2013-05-21 17:20:37,192 - my_test - 17 - CRITICAL - 1369149637.19
2013-05-21 17:20:37,192 - my_test - 17 - CRITICAL - 1369149637.19
More information about the Python-list
mailing list