本文整理汇总了Python中comoonics.ComLog.setLevel方法的典型用法代码示例。如果您正苦于以下问题:Python ComLog.setLevel方法的具体用法?Python ComLog.setLevel怎么用?Python ComLog.setLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comoonics.ComLog
的用法示例。
在下文中一共展示了ComLog.setLevel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testlogger
# 需要导入模块: from comoonics import ComLog [as 别名]
# 或者: from comoonics.ComLog import setLevel [as 别名]
def testlogger(self):
import logging
import inspect
import os.path
from comoonics import ComLog
_mylogger=logging.getLogger("comoonics.ComLog")
logging.basicConfig()
_mylogger.setLevel(logging.DEBUG)
#from comoonics.db.ComDBLogger import DBLogger
#registerHandler("DBLogger", DBLogger)
_filenames=("loggingconfig.ini")
ComLog.getLogger().info("Testing ComLog:")
loggers={"test1": logging.DEBUG,
"test2": logging.INFO,
"test3": logging.WARNING}
for loggername in loggers.keys():
print "%s level: %s" %(loggername, logging.getLevelName(loggers[loggername]))
ComLog.setLevel(loggers[loggername], loggername)
self.__testLogger(loggername, ComLog.getLogger(loggername))
print("mylogger without level")
self.__testLogger("mylogger", ComLog.getLogger("mylogger"))
cp=None
print("ComLog._classregistry: %s" %ComLog._classregistry)
for _filename in _filenames:
logging.shutdown()
print("Testing configfile %s/%s cwd: %s" %(os.path.dirname(inspect.getfile(self.__class__)), _filename, os.path.curdir))
ComLog.fileConfig(os.path.join(os.path.dirname(inspect.getfile(self.__class__)), _filename), None, )
rootlogger=ComLog.getLogger()
self.__testLogger("root", rootlogger)
print("handlernames: %s" %rootlogger.manager.loggerDict.keys())
for _lname in [ "atix", "atix", "atix.atix1" ]:
self.__testLogger(_lname, logging.getLogger(_lname))
self.__testLogger(_lname+".test", logging.getLogger(_lname+".test"))
示例2: _testCdsls
# 需要导入模块: from comoonics import ComLog [as 别名]
# 或者: from comoonics.ComLog import setLevel [as 别名]
def _testCdsls(self, repository, clusterinfo, results):
self.cwd.pushd(os.path.join(repository.root, repository.getMountpoint()))
# setupCDSLRepository._createCDSLFiles(".")
_dirs=results.keys()
_dirs.sort()
repository.buildInfrastructure(clusterinfo)
for _path in _dirs:
_cdsl=None
try:
_cdsl=repository.getCdsl(_path)
except CdslNotFoundException:
if results[_path][1] == True:
_cdsl=getCdsl(_path, CDSL_HOSTDEPENDENT_TYPE, repository, clusterinfo)
elif results[_path][1] == False:
_cdsl=getCdsl(_path, CDSL_SHARED_TYPE, repository, clusterinfo)
if _cdsl:
self.assert_(repository.commit(_cdsl))
ComLog.setLevel(logging.DEBUG, "comoonics.cdsl")
repository.refresh()
ComLog.setLevel(logging.INFO, "comoonics.cdsl")
for cdsl in repository.getCdsls():
self.assert_(repository.delete(cdsl))
repository.removeInfrastructure(clusterinfo)
# setupCDSLRepository._removeCDSLFiles(".")
self.cwd.popd()
示例3: setVerbose
# 需要导入模块: from comoonics import ComLog [as 别名]
# 或者: from comoonics.ComLog import setLevel [as 别名]
def setVerbose(flag):
if flag:
try:
import logging
from comoonics import ComLog
logging.basicConfig()
ComLog.setLevel(logging.DEBUG)
except ImportError:
pass
示例4: test
# 需要导入模块: from comoonics import ComLog [as 别名]
# 或者: from comoonics.ComLog import setLevel [as 别名]
def test():
from comoonics import ComLog
import logging
from comoonics.assistant.ComECAssistantController import ECAssistantController
from comoonics.assistant.ComAssistantTui import AssistantTui
ComLog.setLevel(logging.DEBUG)
ac=ECAssistantController("./localclone.xml", "./infodef.xml", "/opt/atix/comoonics-cs/xsl/localclone.xsl", scan=True)
ac2=ECAssistantController("./createlivecd.xml", "./createlivecd.infodef.xml", scan=True)
at = AssistantTui([ac2, ac])
result = at.run()
示例5: test
# 需要导入模块: from comoonics import ComLog [as 别名]
# 或者: from comoonics.ComLog import setLevel [as 别名]
def test():
ComLog.setLevel(logging.DEBUG)
manager=ConfigurationManager("/tmp/cmtest")
manager.scanConfigs()
manager.scanConfigTemplates()
manager.scanConfigInfodefs()
tui = ConfigurationManagerTui(manager)
result = tui.run()
# at.cleanup()
# ac.printDocument()
if result==None: return None
set=manager.getConfigStore().getConfigTypeStoreByName(result.get("type")).getConfigset(result.get("name"))
infodef=manager.getConfigStore().getConfigTypeStoreByName(result.get("type")).getConfigInfodefset()
return [set, infodef, direction]
示例6: test
# 需要导入模块: from comoonics import ComLog [as 别名]
# 或者: from comoonics.ComLog import setLevel [as 别名]
def test():
ComLog.setLevel(logging.DEBUG)
ac=ECAssistantController("./localclone.xml", "./infodef.xml", "/opt/atix/comoonics-cs/xsl/localclone.xsl", scan=False)
for _info in ac.getNeededInfo():
print "Name : %s" %_info.getName()
print "Value : %s" %_info.getValue()
print "Comment : %s" %_info.getComment()
print "Type : %s" %_info.getType()
print "---------------------------------"
print _info
_info.setValue("allesneu")
ac.run()
示例7: setUp
# 需要导入模块: from comoonics import ComLog [as 别名]
# 或者: from comoonics.ComLog import setLevel [as 别名]
def setUp(self):
from comoonics import ComSystem
ComSystem.setExecMode(ComSystem.SIMULATE)
from comoonics import ComLog
import logging
import inspect
import os.path
ComLog.setLevel(logging.DEBUG)
self.helper=getClusterHelper()
path=os.path.dirname(inspect.getfile(self.__class__))
f=open(os.path.join(path, self.OUTPUT_TEST_FILE))
import StringIO
buf=StringIO.StringIO()
for line in f:
buf.write(line)
self.TEST_OUTPUT=buf.getvalue()
示例8: _test
# 需要导入模块: from comoonics import ComLog [as 别名]
# 或者: from comoonics.ComLog import setLevel [as 别名]
def _test():
from comoonics import ComSystem, ComLog
import logging
ComSystem.__EXEC_REALLY_DO=""
ComLog.setLevel(logging.DEBUG)
_validcommands=["sysreport-show-parts"]
_plugin=SysreportPlugin("../../../../sysreport")
print "Help of plugin %s: " %_plugin.getName()
print _plugin.help()
print "Short help: %s" %_plugin.help_short()
for _command in _plugin.getCommands():
print "Help of command %s:" %_command
print _plugin.help(_command)
for _command in _validcommands:
print "doCommand %s:" %_command
_plugin.doCommand(_command)
示例9: parse_cmdline
# 需要导入模块: from comoonics import ComLog [as 别名]
# 或者: from comoonics.ComLog import setLevel [as 别名]
def parse_cmdline(args=sys.argv):
parser = OptionParser(description=__doc__, usage="usage: %prog [options] action [arguments]", version=__version__)
# Flags
parser.add_option("-v", "--verbose", default=False, action="store_true", help="toggle debugmode and be more helpful")
# parser.add_option("-a", "--ask", dest="ask", default=False, action="store_true", help="ask before any being command executed")
# parser.add_option("-S", "--simulate", dest="simulate", default=False, action="store_true", help="don't execute anything just simulate. Only valid for developer. It might not do what you expect!")
# Options
backup_options=OptionGroup(parser, "Backup Options")
backup_options.add_option("-t", "--taskname", default="",
help="Specify the name of the job to be executed. Default %default")
backup_options.add_option("-T", "--type", default=comoonics.storage.ComArchive.ArchiveHandler.NONE,
help="Set the backup format type. Default: %default")
backup_options.add_option("-c", "--compression", default=comoonics.storage.ComArchive.ArchiveHandler.NONE,
help="Set the compression of this backup handler (if any). Default %default.")
backup_options.add_option("-f", "--format", default=comoonics.storage.ComArchive.ArchiveHandler.NONE,
help="Set the backup format of this backup handler (if any). Default %default.")
backup_options.add_option("-p", "--property", dest="properties", default=list(), action="append",
help="List of properties to be added to initialization (dependent on implementation). Each property must be name=value pair. Default %default")
parser.add_option_group(backup_options)
try:
parser.setGlobalDefaultsFilename(get_defaultsfiles()[0])
parser.setLocalDefaultsFilename(get_defaultsfiles()[1], get_defaultsenvkey())
except (TypeError, NameError):
pass
(options, args) = parser.parse_args(args)
if options.verbose:
ComLog.setLevel(logging.DEBUG)
else:
ComLog.setLevel(logging.INFO)
if not args or len(args) < 3:
parser.error("To few arguments given to command.")
properties=dict()
for property in options.properties:
try:
name,value=property.split("=",1)
properties[name]=value
except ValueError:
warnings.warn("Skipping property %s because of wrong format. Expecting name=value." %property)
return (options, args[1], args[2:], properties)
示例10: init
# 需要导入模块: from comoonics import ComLog [as 别名]
# 或者: from comoonics.ComLog import setLevel [as 别名]
def init(self):
import os.path
import logging
from comoonics import ComSystem
ComSystem.setExecMode(ComSystem.SIMULATE)
super(test_ClusterInfo, self).init()
#create comclusterRepository Object
self.clusterRepository = getClusterRepository(os.path.join(self._testpath, "cluster2.conf"))
#create comclusterinfo object
self.clusterInfo = getClusterInfo(self.clusterRepository)
# setup the cashes for clustat for redhat cluster
ComLog.setLevel(logging.DEBUG)
self.clusterInfo.helper.setSimOutput()
self.nics=list()
for node in self.clusterInfo.getNodes():
node.helper.output=self.clusterInfo.helper.output
for nic in node.getNics():
self.nics.append(nic)
示例11: setDebug
# 需要导入模块: from comoonics import ComLog [as 别名]
# 或者: from comoonics.ComLog import setLevel [as 别名]
def setDebug(option, opt, value, parser):
ComLog.setLevel(logging.DEBUG)
setattr(parser.values, option.dest, True)
示例12: setFast
# 需要导入模块: from comoonics import ComLog [as 别名]
# 或者: from comoonics.ComLog import setLevel [as 别名]
def setFast(option, opt, value, parser):
setattr(parser.values, option.dest, False)
def setConfigPath(option, opt, value, parser):
print "setConfigPath %s" %value
print option
print opt
print parser
CONFIGURATION_PATH=value
def exit(value, text=""):
print text
sys.exit(value)
ComLog.setLevel(logging.INFO)
log=ComLog.getLogger("comoonics-assistant")
parser = OptionParser(description=__doc__, version=__version__)
# Default Options
parser.add_option("-D", "--debug", dest="debug", default=False, action="callback", callback=setDebug, help="Debug")
parser.add_option("-s", "--simulate", dest="debug", default=False, action="callback", callback=setSimulate, help="Simulate")
parser.add_option("-a", "--ask", dest="debug", default=False, action="callback", callback=setAsk, help="Ask")
parser.add_option("-X", "--xml", dest="really", default=True, action="callback", callback=setReally)
parser.add_option("-F", "--fast", dest="scan", default=True, action="callback", callback=setFast)
parser.add_option("-p", "--path", dest="configpath", help="Set path for configuration files",
action="store", default=CONFIGURATION_PATH, type="string")
#
(options, args) = parser.parse_args()
示例13: setDebug
# 需要导入模块: from comoonics import ComLog [as 别名]
# 或者: from comoonics.ComLog import setLevel [as 别名]
def setDebug(option, opt, value, parser):
ComLog.setLevel(logging.DEBUG)
示例14: formatRow
# 需要导入模块: from comoonics import ComLog [as 别名]
# 或者: from comoonics.ComLog import setLevel [as 别名]
@author: marc
'''
def formatRow(_row, _colnames):
orderedrow=list()
for colname in _colnames:
orderedrow.append(str(_row[colname]))
return ', '.join(orderedrow)
def formatColNames(_row):
return ', '.join(_row)
from comoonics.cmdb.ComSoftwareCMDB import SoftwareCMDB
import logging
logging.basicConfig()
from comoonics import ComLog
ComLog.setLevel(logging.DEBUG)
software_cmdb=SoftwareCMDB(hostname="generix4", user="hoi", password="Digital", database="hoi_config", table="software_cmdb")
result=software_cmdb._getDiffsFromSources(["lilr641", "lilr602"], "lilr601", None, 0, 0, ['name LIKE "%GFS-kernel%"'])
print result
result=software_cmdb._getDiffsFromSources(["lilr641", "lilr601", "lilr602"], None, None, 0, 0, ['name LIKE "%GFS-kernel%"'])
print result
#colnames=software_cmdb.getColnamesForMaster()
#vrs=software_cmdb.getDiffsFromSourcesByMaster(["lilr641", "lilr602", "lilr621"], "lilr601", colnames, 0, 0, ['name="bash"'])
#print vrs
#row=vrs.fetch_row(1,1)
#select=None
#if not colnames:
# colnames=row[0].keys()
#if not select:
# select=colnames
示例15: setQuiet
# 需要导入模块: from comoonics import ComLog [as 别名]
# 或者: from comoonics.ComLog import setLevel [as 别名]
def setQuiet(option, opt, value, parser):
from comoonics import ComLog
import logging
ComLog.setLevel(logging.CRITICAL)