當前位置: 首頁>>代碼示例>>Python>>正文


Python Logging.logEvent方法代碼示例

本文整理匯總了Python中Logging.Logging.logEvent方法的典型用法代碼示例。如果您正苦於以下問題:Python Logging.logEvent方法的具體用法?Python Logging.logEvent怎麽用?Python Logging.logEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Logging.Logging的用法示例。


在下文中一共展示了Logging.logEvent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from Logging import Logging [as 別名]
# 或者: from Logging.Logging import logEvent [as 別名]
class Core:
    """
        Initializes all the submodules and serves as a connection point between different modules.
    """
    
    def __init__(self, justPlots = False):
        self.__name__ = "Core"
        
        self.configManager = ConfigurationManager()
        
        # These return True of False depending on whether loading the conf was a success.
        # It should be checked if the conf was loaded successfully and failures should be logged.
        self.configManager.loadConf(CONFIG_CORE, True)
        self.configManager.loadConf(CONFIG_SETTINGS, True)
        self.configManager.loadConf(CONFIG_FORMS, True)
        self.configManager.loadConf(CONFIG_URLMAP, True)
        self.configManager.loadConf(CONFIG_MESSAGES, True)
        
        self.moduleManager = ModuleManager(self)
        self.settingsManager = SettingsManager(self)
        self.clientManager = ClientManager(self)
        self.sensorManager = SensorManager(self)
        self.deviceManager = DeviceManager(self)
        self.taskManager = TaskManager(self)
        self.messageManager = MessageManager(self)
        self.logging = Logging(self)

        if self.settingsManager.equals("plottype", "matplotlib"):
            from Plot import Plot
            self.plot = Plot(self)

        self.protocol = Protocol(self)
        if not justPlots: self.connection = Connection(self)
        if not justPlots: self.scheduler = Scheduler()
        if not justPlots: self.webServer = WebServer(self.connection.getLocalIP(), self.settingsManager.getValueByName("listenport")) # Currently binds to localhost. But this needs to be fixed so other connections can be listened to too.

    def initialize(self):
        self.logging.logDebug(self.__name__ + "." + "initialize")
        self.scheduler.initialize()
        
        startup = Startup(self)
        startup.addSensors()
        startup.addDevices()
        #startup.addTasks()
        #startup.addSensorLogging()
        #startup.addDailyPlots()
        #startup.addWeeklyPlots()
        #startup.addSensorControl()

        #modules = []

        #for moduleList in self.configManager.getConf(CONFIG_FORMS).getItem("modules", ""):
        #    modules.append(moduleList["module"])

        self.moduleManager.loadModules(self.configManager.getConf(CONFIG_FORMS).getItem("modules", ""))

        self.webServer.setUp()
    
    def quit(self):
        """
            Gives threads a signal to shut down, gives them some time to do so and then exits the program
            gracefully.
        """
        
        self.logging.logEvent("Core: Shutting down", "orange")
        self.connection.running = False
        sleep(1)
        from os import _exit
        _exit(0)
開發者ID:Urokhtor,項目名稱:Naga-Automation-Suite,代碼行數:71,代碼來源:Core.py


注:本文中的Logging.Logging.logEvent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。