本文整理汇总了Python中lsst.pex.logging.Log.addPreamblePropertyString方法的典型用法代码示例。如果您正苦于以下问题:Python Log.addPreamblePropertyString方法的具体用法?Python Log.addPreamblePropertyString怎么用?Python Log.addPreamblePropertyString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lsst.pex.logging.Log
的用法示例。
在下文中一共展示了Log.addPreamblePropertyString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testEventLogger
# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import addPreamblePropertyString [as 别名]
def testEventLogger(broker, runid, sliceid, props, input=None, logname=None,
logtopic="LSSTLogging"):
"""
test logging through a broker. This will send a single message to a
the logger, and, if input is a list of string or and file input object,
it will also send all input message in order. If broker is None, the
log messages will not got to any event broker, only to the screen.
@param broker the host running the event broker
@param runid the runid to assume for the log (ignored if broker is None)
@param sliceid the sliceid to assume for the log (ignored if broker is None)
@param props a set of properties to attach to all messages
@param input if not None, messages to send, either in the form of
of a list of strings or a file object to read from
@param logname the log name to send messages to
@param logtopic the event topic to use (def: "LSSTLogging")
"""
if broker:
thresh = Log.getDefaultLog().getThreshold()
setEventLogger(broker, runid, sliceid, thresh <= Log.DEBUG, logtopic)
Log.getDefaultLog().setThreshold(thresh)
logger.log(VERB, "Created event logger")
else:
logger.log(VERB, "Messages only going to screen")
logger.setShowAll(Log.getDefaultLog().getThreshold() <= Log.DEBUG)
if logname is None:
logname = "showEvents"
uselog = Log(Log.getDefaultLog(), logname)
for key in props.keys():
uselog.addPreamblePropertyString(key, props[key])
testLogger(uselog, input)