def __init__(self, config):
        self._configure(config)
        self._log_handlers = []
        # Parse command line args
        self.config['server_number'] += self.config['args']['server_number']
        self.config['procname'] += "_{}".format(self.config['server_number'])
        # setup all our log handlers
        for log_cfg in self.config['loggers']:
            if log_cfg['type'] == "StreamHandler":
                kwargs = dict(stream=sys.stdout)
            else:
                kwargs = dict()
            handler = getattr(logging, log_cfg['type'])(**kwargs)
            log_level = getattr(logging, log_cfg['level'].upper())
            handler.setLevel(log_level)
            fmt = log_cfg.get('format', '%(asctime)s [%(name)s] [%(levelname)s] %(message)s')
            formatter = logging.Formatter(fmt)
            handler.setFormatter(formatter)
            self._log_handlers.append((log_cfg.get('listen'), handler))
        self.logger = self.register_logger(self.__class__.__name__)

        setproctitle.setproctitle(self.config['procname'])
        self.version = powerpool.__version__
        self.version_info = powerpool.__version_info__
        self.sha = getattr(powerpool, '__sha__', "unknown")
        self.rev_date = getattr(powerpool, '__rev_date__', "unknown")
        if self.sha == "unknown":
            # try and fetch the git version information
            try:
                output = subprocess.check_output("git show -s --format='%ci %h'",
                                                 shell=True).strip().rsplit(" ", 1)
                self.sha = output[1]
                self.rev_date = output[0]
            # celery won't work with this, so set some default
            except Exception as e:
                self.logger.info("Unable to fetch git hash info: {}".format(e))

        self.algos = {}
        self.server_start = datetime.datetime.utcnow()
        self.logger.info("=" * 80)
        self.logger.info("PowerPool stratum server ({}) starting up..."
                         .format(self.config['procname']))

        if __debug__:
            self.logger.warn(
                "Python not running in optimized mode. For better performance "
                "set enviroment variable PYTHONOPTIMIZE=2")
            # Only try to detect blocking if running in debug mode.
            # NOTE: BlockingDetector can cause (rare) PowerPool crashes
            gevent.spawn(BlockingDetector(raise_exc=False))

        # Detect and load all the hash functions we can find
        for name, algo_data in self.config['algorithms'].iteritems():
            self.algos[name] = algo_data.copy()
            self.algos[name]['name'] = name
            mod = algo_data['module']
            try:
                self.algos[name]['module'] = import_helper(mod)
            except __HOLE__:
                self.algos[name]['module'] = None
            else:
                self.logger.info("Enabling {} hashing algorithm from module {}"
                                 .format(name, mod))

        self.event_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.events_enabled = self.config['events']['enabled']
        if self.events_enabled:
            self.logger.info("Transmitting statsd formatted stats to {}:{}".format(
                self.config['events']['host'], self.config['events']['port']))
        self.events_address = (self.config['events']['host'].encode('utf8'),
                               self.config['events']['port'])

        # Setup all our stat managers
        self._min_stat_counters = []
        self._sec_stat_counters = []

        if self.config['datagram']['enabled']:
            listener = (self.config['datagram']['host'],
                        self.config['datagram']['port'] +
                        self.config['server_number'])
            self.logger.info("Turning on UDP control server on {}"
                             .format(listener))
            DatagramServer.__init__(self, listener, spawn=None)
dataset/ETHPy150Open simplecrypto/powerpool/powerpool/main.py/PowerPool.__init__