def client(self): if self._client is None: if self.client_name: self._client = CLIENT_HOLDER.get_client(self.client_name) else: self._client = CLIENT_HOLDER.default_client return self._client
def setUp(self): self.orig_default_client = CLIENT_HOLDER.global_config.get('default') client = CLIENT_HOLDER.get_client(self.client_name) client_config = { 'sender_class': 'metlog.senders.DebugCaptureSender', } self.client = client_from_dict_config(client_config, client) CLIENT_HOLDER.set_default_client_name(self.client_name)
def get_metlog_client(name=None): """ Return the specified Metlog client from the CLIENT_HOLDER. :param name: Name of metlog client to fetch. If not provided the holder's specified default client will be used. """ if name is not None: client = CLIENT_HOLDER.get_client(name) else: client = CLIENT_HOLDER.default_client return client
def setUp(self): self.orig_default_client = CLIENT_HOLDER.global_config.get('default') client = CLIENT_HOLDER.get_client(self.client_name) client_config = {'sender_class': 'metlog.senders.DebugCaptureSender', 'plugins': {'plugin_section_name': ('metlog_raven.raven_plugin:config_plugin', {'dsn': 'udp://*****:*****@somehost.com:5000/2'})} } self.client = client_from_dict_config(client_config, client) CLIENT_HOLDER.set_default_client_name(self.client_name)
def setUp(self): self.orig_default_client = CLIENT_HOLDER.global_config.get('default') client = CLIENT_HOLDER.get_client(self.client_name) self.dsn = "udp://*****:*****@somehost.com:9000/2" client_config = {'sender_class': 'metlog.senders.DebugCaptureSender', 'plugins': {'plugin_section_name': ['metlog_raven.raven_plugin:config_plugin', {'dsn': self.dsn}] }} self.client = client_from_dict_config(client_config, client) CLIENT_HOLDER.set_default_client_name(self.client_name)
def setup_metlog(config_dict, default=False): """ Instantiate a Metlog client and add it to the client holder. :param config_dict: Dictionary object containing the metlog client configuration. :param default: Should this be specified as CLIENT_HOLDER's default client? Note that the first client to be added will automatically be specified as the default, regardless of the value of this argument. """ name = config_dict.get('logger', '') client = CLIENT_HOLDER.get_client(name) client = client_from_dict_config(config_dict, client) if default: CLIENT_HOLDER.set_default_client_name(name)
def setUp(self): self.orig_default_client = CLIENT_HOLDER.global_config.get('default') client = CLIENT_HOLDER.get_client(self.client_name) client_config = { 'sender_class': 'metlog.senders.DebugCaptureSender', 'plugins': { 'plugin_section_name': ('metlog_raven.raven_plugin:config_plugin', { 'dsn': 'udp://*****:*****@somehost.com:5000/2' }) } } self.client = client_from_dict_config(client_config, client) CLIENT_HOLDER.set_default_client_name(self.client_name)
def setUp(self): self.orig_default_client = CLIENT_HOLDER.global_config.get('default') client = CLIENT_HOLDER.get_client(self.client_name) self.dsn = "udp://*****:*****@somehost.com:9000/2" client_config = { 'sender_class': 'metlog.senders.DebugCaptureSender', 'plugins': { 'plugin_section_name': ['metlog_raven.raven_plugin:config_plugin', { 'dsn': self.dsn }] } } self.client = client_from_dict_config(client_config, client) CLIENT_HOLDER.set_default_client_name(self.client_name)