当前位置: 首页>>代码示例>>Python>>正文


Python logging_support_raw.LoggingSupport类代码示例

本文整理汇总了Python中nta.utils.logging_support_raw.LoggingSupport的典型用法代码示例。如果您正苦于以下问题:Python LoggingSupport类的具体用法?Python LoggingSupport怎么用?Python LoggingSupport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LoggingSupport类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUpModule

def setUpModule():
  LoggingSupport.initTestApp()
开发者ID:AmitShah,项目名称:numenta-apps,代码行数:2,代码来源:swap_controller_test.py

示例2: len

  (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
开发者ID:nivertech,项目名称:numenta-apps,代码行数:29,代码来源:model_scheduler_service.py

示例3: setUpModule

def setUpModule():
  LoggingSupport.initTestApp()

  global g_log  # pylint: disable=W0603
  g_log = getExtendedLogger("custom_datasource_adapter_test")
开发者ID:marionleborgne,项目名称:numenta-apps,代码行数:5,代码来源:custom_datasource_adapter_test.py

示例4: testLoggingAppPath

 def testLoggingAppPath(self):
   # getApplicationLogFilePath() should return path to ../app_name.log
   app_name = "py"  # Because called with py.test
   with self._redirectLogBase(app_name, _SAMPLE_CONNECTION_CONTENTS):
     temp_ls = LS()
     temp_ls.initLogging("DEBUG", "stderr", True)
     self.assertEqual(os.path.abspath(os.path.join(temp_ls.getLoggingRootDir(), "processes", app_name + ".log")), temp_ls.getApplicationLogFilePath())
开发者ID:darian19,项目名称:what,代码行数:7,代码来源:logging_support_test.py

示例5: testLogFilePathExists

 def testLogFilePathExists(self):
   # Directory containing the log file should be created; loggin_support.py line 250-257
   with self._redirectLogBase("logging_example", _SAMPLE_CONNECTION_CONTENTS):
     temp_ls = LS()
     temp_ls.initLogging("DEBUG", "stderr", True)
     path = temp_ls.getApplicationLogFilePath()
     self.assertTrue(os.path.isdir(os.path.dirname(path)))
开发者ID:darian19,项目名称:what,代码行数:7,代码来源:logging_support_test.py

示例6: testLoggingConfigPath

 def testLoggingConfigPath(self):
   # getLoggingConfTemplatePath() should return path to ../logging.conf
   tempLS = LS()
   tempLS.initLogging()
   self.assertEqual(os.path.join(logging_support_raw._APPLICATION_CONF_DIR,
                                 "logging.conf"),
                    tempLS.getLoggingConfTemplatePath())
开发者ID:dm1973,项目名称:numenta-apps,代码行数:7,代码来源:logging_support_test.py

示例7: testLoggingRootPath

 def testLoggingRootPath(self):
   # getLoggingRootDir() should return the temp path
   with self._redirectLogBase("logging_example", _SAMPLE_CONNECTION_CONTENTS):
     tempLS = LS()
     tempLS.initLogging("DEBUG", "stderr", True)
     self.assertEqual(tempLS.getLoggingRootDir(),
                      os.path.join(self._tempDir, "log"))
开发者ID:dm1973,项目名称:numenta-apps,代码行数:7,代码来源:logging_support_test.py

示例8: testInitLoggingInputs

 def testInitLoggingInputs(self):
   # Invalid loggingLevel throws a ValueError
   temp_ls = LS()
   with self.assertRaises(ValueError):
     temp_ls.initLogging("DEBUGGING")
   # Invalid console throws a ValueError
   with self.assertRaises(ValueError):
     temp_ls.initLogging("DEBUG", "stderror")
开发者ID:darian19,项目名称:what,代码行数:8,代码来源:logging_support_test.py

示例9: testInitLoggingNullHandlers

 def testInitLoggingNullHandlers(self):
   # Null handlers should throw ConfigParser.NoOptionError and print a
   # sys.stderr message
   tempLS = LS()
   with self.assertRaises(ConfigParser.NoOptionError):
     tempLS.initLogging(None, None)
     self.assertEqual(sys.stderr.getvalue(),
                      ("WARNING: logging_support is disabling logging output "
                       "because all output handlers are disabled"))
开发者ID:dm1973,项目名称:numenta-apps,代码行数:9,代码来源:logging_support_test.py

示例10: testLoggingAppPath

 def testLoggingAppPath(self):
   # getApplicationLogFilePath() should return path to ../appName.log
   appName = os.path.splitext(os.path.basename(sys.argv[0]))[0]
   with self._redirectLogBase(appName, _SAMPLE_CONNECTION_CONTENTS):
     tempLS = LS()
     tempLS.initLogging("DEBUG", "stderr", True)
     self.assertEqual(os.path.abspath(os.path.join(tempLS.getLoggingRootDir(),
                                                   "processes",
                                                   appName + ".log")),
                      tempLS.getApplicationLogFilePath())
   self.assertIn(appName, ["py", "run_tests"])
开发者ID:dm1973,项目名称:numenta-apps,代码行数:11,代码来源:logging_support_test.py

示例11: testLoggingInitForUsageExamples

  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))
开发者ID:darian19,项目名称:what,代码行数:13,代码来源:logging_support_test.py


注:本文中的nta.utils.logging_support_raw.LoggingSupport类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。