def started(self): logger.info("isDay: %s" % self.libraries['Times'].isDay) logger.info("isLight: %s" % self.libraries['Times'].isLight) logger.info("isTwilight: %s" % self.libraries['Times'].isTwilight) logger.info("isDark: %s" % self.libraries['Times'].isDark) logger.info("isNight: %s" % self.libraries['Times'].isNight) logger.info("Time is now: %f" % time.time()) logger.info("My longitude is: %s " % str(getConfigValue('location', 'latitude', 0)) ) if self.libraries['Times'].isLight: delayed = int( self.libraries['Times'].CLnowDark.getTime() - time.time() ) logger.info("It will be dark in %d seconds." % delayed ) else: delayed = int( self.libraries['Times'].CLnowLight.getTime() - time.time() ) logger.info("It will be light in %d seconds." % int(time.time()) ) # test times if self.libraries['Times'].isLight == self.libraries['Times'].isDark: logger.error("It can't be light and dark at same time!!") if self.libraries['Times'].isDay == self.libraries['Times'].isNight: logger.error("It can't be day and night at same time!!") # self.outMsg = namedtuple('outMsg', "time, device_id, message") # self.outMessages = {} msg = self.devices[1].getMessage(self, cmdobj=self.available_commands['open']) self.outMessages[msg.msgUUID] = self.outMsg(time.time(), self.devices[1].device_id, msg)
def reset_log_levels(): """ Used to reset the logs to their proper levels after configurations are downloaded. Also called when recieved a config update. """ #TODO: Test this! from yombo.core.helpers import getConfigValue global loggers global logLevels for key, aLog in loggers: newLevel = getConfigValue('logging', key, 10) aLog.setLevel(newlevel)