Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def make_service(mqttc=None, name=None):
"""
Service object factory.
Prepare service object for plugin.
Inject appropriate MQTT client and logger objects.
:param mqttc: Instance of PAHO MQTT client object.
:param name: Name used for obtaining a logger instance.
:return: Service object ready for being passed to plugin instance.
"""
name = name or 'unknown'
logger = logging.getLogger(name)
service = Service(mqttc, logger)
return service