def set_debug_level(self, level): LOGGER.debug('set_debug_level: {}'.format(level)) if level is None: level = 30 level = int(level) if level == 0: level = 30 LOGGER.info('set_debug_level: Set GV1 to {}'.format(level)) self.setDriver('GV1', level) # 0=All 10=Debug are the same because 0 (NOTSET) doesn't show everything. if level <= 10: LOGGER.setLevel(logging.DEBUG) elif level == 20: LOGGER.setLevel(logging.INFO) elif level == 30: LOGGER.setLevel(logging.WARNING) elif level == 40: LOGGER.setLevel(logging.ERROR) elif level == 50: LOGGER.setLevel(logging.CRITICAL) else: LOGGER.debug("set_debug_level: Unknown level {}".format(level)) # this is the best way to control logging for modules, so you can # still see warnings and errors #if level < 10: # self.set_module_logs(logging.DEBUG) #else: # # Just warnigns for the modules unless in module debug mode # self.set_module_logs(logging.WARNING) # Or you can do this and you will never see mention of module logging if level < 10: LOG_HANDLER.set_basic_config(True, logging.DEBUG) else: # This is the polyinterface default LOG_HANDLER.set_basic_config(True, logging.WARNING)
def set_debug_level(self, level): LOGGER.debug('set_debug_level: {}'.format(level)) if level is None: level = 10 level = int(level) if level == 0: level = 30 LOGGER.info('set_debug_level: Set GV1 to {}'.format(level)) self.set_driver('GV1', level) # 0=All 10=Debug are the same because 0 (NOTSET) doesn't show everything. if level <= 10: LOGGER.setLevel(logging.DEBUG) elif level == 20: LOGGER.setLevel(logging.INFO) elif level == 30: LOGGER.setLevel(logging.WARNING) elif level == 40: LOGGER.setLevel(logging.ERROR) elif level == 50: LOGGER.setLevel(logging.CRITICAL) else: LOGGER.debug("set_debug_level: Unknown level {}".format(level)) if level < 10: LOG_HANDLER.set_basic_config(True, logging.DEBUG) else: # This is the polyinterface default LOG_HANDLER.set_basic_config(True, logging.WARNING)
def set_debug_level(self,level=None): LOGGER.debug('set_debug_level: {}'.format(level)) if level is None: try: level = self.getDriver('GV1') if level is None: level = logging.DEBUG except: # First run so driver isn't set, use DEBUG level = logging.DEBUG level = int(level) if level == 0: level = 30 LOGGER.info('set_debug_level: Set GV1 to {}'.format(level)) self.set_driver('GV1', level) # For now we don't want to see all this # TODO: Add another level = 8 logging.getLogger("websockets.protocol").setLevel(logging.WARNING) # 0=All 10=Debug are the same because 0 (NOTSET) doesn't show everything. if level <= 10: # this is the best way to control logging for modules, so you can # still see warnings and errors #if level < 10: # self.set_module_logs(logging.DEBUG) #else: # # Just warnigns for the modules unless in module debug mode # self.set_module_logs(logging.WARNING) # Or you can do this and you will never see mention of module logging if level < 10: LOG_HANDLER.set_basic_config(True,logging.DEBUG) else: # This is the polyinterface default LOG_HANDLER.set_basic_config(True,logging.WARNING) LOGGER.setLevel(logging.DEBUG) elif level == 20: LOGGER.setLevel(logging.INFO) elif level == 30: LOGGER.setLevel(logging.WARNING) elif level == 40: LOGGER.setLevel(logging.ERROR) elif level == 50: LOGGER.setLevel(logging.CRITICAL) else: LOGGER.debug("set_debug_level: Unknown level {}".format(level))
import requests import socket import ssl import logging import time from threading import Thread,Event #import pylutron_caseta.smartbridge as smartbridge from pylutron_caseta.smartbridge import Smartbridge from pylutron_caseta import (FAN_MEDIUM, OCCUPANCY_GROUP_OCCUPIED, OCCUPANCY_GROUP_UNOCCUPIED) #logging.basicConfig(format='%(asctime)s %(levelname)s:%(message)s', level=logging.DEBUG) #LOG_HANDLER.set_log_format('%(asctime)s %(threadName)-10s %(name)-18s %(levelname)-8s %(module)s:%(funcName)s: %(message)s') LOG_HANDLER.set_basic_config(True,logging.DEBUG) from cryptography import x509 from cryptography.x509.oid import NameOID from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.hazmat.primitives.serialization import load_pem_private_key from urllib.parse import urlencode from lutron_caseta_nodes.LutronCasetaNodes import SerenaHoneycombShade, QsWirelessShade, Scene # We need an event loop for pylutron_caseta since we run in a # which doesn't have a loop mainloop = asyncio.get_event_loop()