本文整理汇总了Python中utils.Logger.start方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.start方法的具体用法?Python Logger.start怎么用?Python Logger.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.Logger
的用法示例。
在下文中一共展示了Logger.start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from utils import Logger [as 别名]
# 或者: from utils.Logger import start [as 别名]
def main():
global test
#count, data = self.db.query(query)
l = Logger()
l.start("Begin DataFetcher Self Test")
db = statmon.datasource.MySQLDataSource(l,host='statmon.basis.is')
test = TestA(db=db)
#test = DataFetcher(db=db,logger=l)
#l.show(test.getDatasets())
l.end()
示例2: main
# 需要导入模块: from utils import Logger [as 别名]
# 或者: from utils.Logger import start [as 别名]
def main():
"""Unit tests for config.py"""
from utils import Logger
l = Logger()
l.start('Starting Unit Tests for Config')
l.start('config = Config()')
global config
config = Config()
l.end()
testReg(l,config,'root',description='Root Item')
testGetValue(l,config,'root')
testSetValue(l,config,'root',value='foo')
testGetValue(l,config,'root',wanted='foo')
testReg(l,config,'.root.sub1',description='Sub-Root Item 1')
testGetValue(l,config,'.root.sub1')
testSetValue(l,config,'.root.sub1',value='foo')
testGetValue(l,config,'.root.sub1',wanted='foo')
rootConfig = config.root
testReg(l,rootConfig,'.sub2',description='Sub-Root Item 2')
testGetValue(l,rootConfig,'.sub2')
testSetValue(l,rootConfig,'.sub2',value='foo')
testGetValue(l,rootConfig,'.sub2',wanted='foo')
subConfig2 = rootConfig.sub2
testReg(l,subConfig2,'.sub2sub',description='Sub-Sub-Root Item 1')
testGetValue(l,subConfig2,'.sub2sub')
testSetValue(l,subConfig2,'.sub2sub',value='foo')
testGetValue(l,subConfig2,'.sub2sub',wanted='foo')
typesConfig = rootConfig._get('.types',create=True)
testReg(l,typesConfig,'.typeNoneType',description = 'Test Setting - None Type')
testReg(l,typesConfig,'.typeStr',description = 'Test Setting - Str Type',default='Blabla')
testReg(l,typesConfig,'.typeInt',description = 'Test Setting - Int Type',default=123)
testReg(l,typesConfig,'.typeFloat',description = 'Test Setting - Float Type',default=1.23)
testReg(l,typesConfig,'.typeBool',description = 'Test Setting - Bool Type',default=True)
testReg(l,typesConfig,'.typeList',description = 'Test Setting - List Type',default=[1,'a',None])
testReg(l,typesConfig,'.typeDict',description = 'Test Setting - Dict Type',default={'a':1,'b':'a','c':None})
testReg(l,rootConfig,'.types',description = 'Test Types')
global before
before = config.getAll()
l.start("""config.saveXML('config.xml')""")
config.saveXML('config.xml')
l.end()
l.start('newConfig = Config()')
newConfig = Config()
l.end()
l.start("""newConfig.loadXML('config.xml')""")
newConfig.loadXML('config.xml')
l.end()
global after
after = newConfig.getAll()
newTypesConfig = newConfig.root.types
testGetValue(l,newTypesConfig,'.typeNoneType')
testGetValue(l,newTypesConfig,'.typeStr',wanted='Blabla')
testGetValue(l,newTypesConfig,'.typeInt',wanted=123)
testGetValue(l,newTypesConfig,'.typeFloat',wanted=1.23)
testGetValue(l,newTypesConfig,'.typeBool',wanted=True)
testGetValue(l,newTypesConfig,'.typeList',wanted=[1,'a',None])
testGetValue(l,newTypesConfig,'.typeDict',wanted={'a':1,'b':'a','c':None})
l.start("""newConfig.saveXML('newConfig.xml')""")
newConfig.saveXML('newConfig.xml')
l.end()
l.start("""system('diff config.xml newConfig.xml')""")
import os
code = os.system('diff config.xml newConfig.xml')
assert(code == 0)
l.end('code = %d' % code)
l.start("""system('rm -f config.xml newConfig.xml')""")
import os
code = os.system('rm -f config.xml newConfig.xml')
assert(code == 0)
l.end('code = %d' % code)
l.end()