我有几个不同的模块,它们都有:
if not __name__ == '__main__':
try:
logger = logging.getLogger()
except:
from MainApp.lib import setLogging
logger = setLogging.initLogging("install.log")
else:
from MainApp.lib import setLogging
logger = setLogging.initLogging("install.log")
setLogging.enableDebugLogging()
例如,是否可以在 __init__.py 级别定义所有这些?