本文整理汇总了Python中nta.utils.logging_support_raw.LoggingSupport.initService方法的典型用法代码示例。如果您正苦于以下问题:Python LoggingSupport.initService方法的具体用法?Python LoggingSupport.initService怎么用?Python LoggingSupport.initService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nta.utils.logging_support_raw.LoggingSupport
的用法示例。
在下文中一共展示了LoggingSupport.initService方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testLoggingInitForUsageExamples
# 需要导入模块: from nta.utils.logging_support_raw import LoggingSupport [as 别名]
# 或者: from nta.utils.logging_support_raw.LoggingSupport import initService [as 别名]
def testLoggingInitForUsageExamples(self):
g_log = logging.getLogger("my_example")
assert isinstance(g_log, logging.Logger)
with self._redirectLogBase("logging_example", _SAMPLE_CONNECTION_CONTENTS):
# Test logging init for a tool
self.assertEqual(LS.initTool(), LS.initLogging(None, console="stderr", logToFile=True))
# Test logging init for a service
self.assertEqual(LS.initService(), LS.initLogging(None, console="stderr", logToFile=False))
# Test logging init for a test app
self.assertEqual(LS.initTestApp(), LS.initLogging(None, console="stderr", logToFile=False))
示例2: len
# 需要导入模块: from nta.utils.logging_support_raw import LoggingSupport [as 别名]
# 或者: from nta.utils.logging_support_raw.LoggingSupport import initService [as 别名]
(options, args) = parser.parse_args(argv[1:])
if len(args) > 0:
parser.error("Didn't expect any positional args (%r)." % (args,))
options.concurrency = _getDefaultConcurrency(options.concurrency)
needRestart = True
while needRestart:
with ModelSchedulerService(concurrency=options.concurrency) as scheduler:
needRestart = scheduler.run()
if __name__ == "__main__":
LoggingSupport.initService()
logger = _getLogger()
logger.setLogPrefix('<%s, SERVICE=SCHED> ' % getStandardLogPrefix())
try:
logger.info("{TAG:SWAP.SCHED.START}")
main(sys.argv)
except SystemExit as e:
if e.code != 0:
logger.exception("{TAG:SWAP.SCHED.STOP.ABORT}")
raise
except:
logger.exception("{TAG:SWAP.SCHED.STOP.ABORT}")
raise