Пример #1
0
    def __init__(self):
        self.log = getLogger("Updates")
        self.current = current
        self.current_v = StrictVersion(current)

        self.load_release()
        self.do_warnings()
Пример #2
0
    def __init__(self):
        self.log = getLogger("Updates")
        self.current = current
        self.current_v = StrictVersion(current)

        self.load_release()
        self.do_warnings()
Пример #3
0
    def __init__(self,
                 factory_manager=None,
                 path="./plugins",
                 module="plugins"):
        if factory_manager is None:
            raise ValueError("Factory manager cannot be None!")

        self.log = getLogger("Plugins")
        self.loaders = {}

        python_loader = PythonPluginLoader(factory_manager, self)
        self.loaders["python"] = python_loader

        self.factory_manager = factory_manager

        self.module = module
        self.path = path

        try:
            import hy  # noqa
        except ImportError:
            hy = None  # noqa

            self.log.warn("Unable to find Hy - Hy plugins will not load")
            self.log.warn("Install Hy with pip if you need this support")
Пример #4
0
    def __init__(self):
        self.commands = CommandManager()
        self.event_manager = EventManager()
        self.logger = getLogger("Manager")
        self.plugman = PluginManager(self)

        self.metrics = None
Пример #5
0
    def __init__(self):
        configure(None)
        self.logger = getLogger("Permissions")

        self.confdir = tmpdir + "/config/"
        self.datadir = tmpdir + "/data/"

        try:
            os.makedirs(self.confdir)
            os.makedirs(self.datadir)
            self.logger.debug("Config and data dirs created.")
        except Exception:
            pass

        yaml.dump({"editor_warning": False},
                  open(self.confdir + "settings.yml", "w"))

        self.storage = StorageManager(self.confdir, self.datadir)

        self.data = self.storage.get_file(self, "data", formats.YAML,
                                          "permissions.yml")

        self.handler = permissionsHandler(self, self.data)

        super(TestPlugin, self).__init__(
            AttrDict(name="test", module="test_permissions"),
            AttrDict(name="python"),
        )
Пример #6
0
    def __init__(self):
        self.commands = CommandManager()
        self.event_manager = EventManager()
        self.logger = getLogger("Manager")
        self.plugman = PluginManager(self)

        self.metrics = None
Пример #7
0
    def __init__(self, filename):
        self.callbacks = []

        self.logger = getLogger("YamlConfig")
        # Some sanitizing here to make sure people can't escape the config dirs
        filename = filename.strip("..")
        self.filename = filename
        self.exists = self.reload(False)
Пример #8
0
 def __init__(self):
     self.logger = getLogger("Help")
     self.add_topic(
         AliasListTopic("aliases", HelpTopicType.GenericTopic)
     )
     self.add_topic(
         ComandListTopic("commands", HelpTopicType.GenericTopic)
     )
Пример #9
0
    def __init__(self, filename):
        self.callbacks = []

        self.logger = getLogger("YamlConfig")
        # Some sanitizing here to make sure people can't escape the config dirs
        filename = filename.strip("..")
        self.filename = filename
        self.exists = self.reload(False)
Пример #10
0
    def __init__(self, filename, data_dict):
        if filename is None:
            self.filename = ":memory:{}:".format(uuid.uuid4())
        else:
            self.filename = ":memory:{}:".format(filename)

        self.callbacks = []

        self.logger = getLogger("Data")
        self.data = data_dict
Пример #11
0
    def __init__(self, filename, data_dict):
        if filename is None:
            self.filename = ":memory:{}:".format(uuid.uuid4())
        else:
            self.filename = ":memory:{}:".format(filename)

        self.callbacks = []

        self.logger = getLogger("Data")
        self.data = data_dict
Пример #12
0
    def __init__(self, name, factory, config):
        NoChannelsProtocol.__init__(self, name, factory, config)

        self.name = name
        self.log = getLogger(self.name)
        self.event_manager = EventManager()
        self.command_manager = CommandManager()

        reactor.connectTCP(self.config["connection"]["host"],
                           self.config["connection"]["port"], self.factory,
                           120)
Пример #13
0
    def load_plugin(self, info):
        module = info.get_module()
        self.logger.trace("Module: {}".format(module))

        try:
            if module in sys.modules:
                self.logger.trace("Module exists, reloading..")
                reload(sys.modules[module])
                module_obj = sys.modules[module]
            else:
                module_obj = importlib.import_module(module)

            self.logger.trace("Module object: {}".format(module_obj))

            plugin_class = self.find_plugin_class(module_obj)

            if plugin_class is None:
                self.logger.error(
                    "Unable to find plugin class for plugin: {}".format(
                        info.name
                    )
                )
                returnValue((PluginState.LoadError, None))

            plugin = plugin_class(info, self)

        except ImportError:
            self.logger.exception("Unable to import plugin: {}".format(
                info.name
            ))
            returnValue((PluginState.LoadError, None))
        except Exception:
            self.logger.exception("Error loading plugin: {}".format(
                info.name
            ))
            returnValue((PluginState.LoadError, None))
        else:
            try:
                info.set_plugin_object(plugin)
                plugin.logger = getLogger(info.name)

                d = plugin.setup()

                if isinstance(d, Deferred):
                    _ = yield d
            except Exception:
                self.logger.exception("Error setting up plugin: {}".format(
                    info.name
                ))
                returnValue((PluginState.LoadError, None))
            else:
                returnValue((PluginState.Loaded, plugin))
Пример #14
0
    def __init__(self, info, loader):
        from system.factory_manager import FactoryManager
        from system.plugins.manager import PluginManager

        self.commands = CommandManager()
        self.events = EventManager()
        self.factory_manager = FactoryManager()
        self.info = info
        self.logger = getLogger(info.name)
        self.module = self.info.module
        self.plugins = PluginManager()
        self.storage = StorageManager()
        self._loader = loader.name
Пример #15
0
    def __init__(self, name, factory, config):
        NoChannelsProtocol.__init__(self, name, factory, config)

        self.name = name
        self.log = getLogger(self.name)
        self.event_manager = EventManager()
        self.command_manager = CommandManager()

        reactor.connectTCP(
            self.config["connection"]["host"],
            self.config["connection"]["port"],
            self.factory,
            120
        )
Пример #16
0
    def __init__(self, filename):
        self.callbacks = []

        self.logger = getLogger("Data")
        filename = filename.strip("..")

        folders = filename.split("/")
        folders.pop()
        folders = "/".join(folders)

        if not os.path.exists(folders):
            os.makedirs(folders)

        self.filename = filename
        self.reload(False)
Пример #17
0
    def __init__(self, filename):
        self.callbacks = []

        self.logger = getLogger("Data")
        filename = filename.strip("..")

        folders = filename.split("/")
        folders.pop()
        folders = "/".join(folders)

        if not os.path.exists(folders):
            os.makedirs(folders)

        self.filename = filename
        self.reload(False)
Пример #18
0
 def __init__(self, name, factory, config):
     # You don't necessarily need to call the super-class here,
     #   however we do recommend at least copy-pasting the below code
     #   into your __init__.
     # Twisted uses old-style classes, so super() won't work if you intend
     #   on using it!
     self.name = name
     self.factory = factory
     self.config = config
     self.log = getLogger(self.name)
     # Default values for optional main config section
     try:
         self.can_flood = self.config["main"]["can-flood"]
     except KeyError:
         self.can_flood = False
Пример #19
0
    def __init__(self, path, *args, **kwargs):
        self.callbacks = []

        self.logger = getLogger("Redis")

        self.path = path
        self.url = kwargs.get("url", None)

        self.logger.trace("Path: %s" % path)
        self.logger.trace("Args: %s" % (args or "[]"))
        self.logger.trace("KWArgs: %s" % (kwargs or "{}"))

        self.args = args
        self.kwargs = kwargs

        self.reconnect()
Пример #20
0
    def __init__(self, factory, config):
        self.factory = factory
        self.config = config
        self.log = getLogger("TS3")

        self.log.info("Setting up..")

        self.server = config["server"]
        self.identity = config["identity"]

        self.user = self.identity["username"]
        self.passw = self.identity["password"]
        self.sid = self.server["sid"]

        reactor.connectTCP(self.server["address"], self.server["port"],
                           self.factory, 120)
Пример #21
0
    def __init__(self, path, *args, **kwargs):
        self.callbacks = []

        self.logger = getLogger("Redis")

        self.path = path
        self.url = kwargs.get("url", None)

        self.logger.trace("Path: %s" % path)
        self.logger.trace("Args: %s" % (args or "[]"))
        self.logger.trace("KWArgs: %s" % (kwargs or "{}"))

        self.args = args
        self.kwargs = kwargs

        self.reconnect()
Пример #22
0
    def load_plugin(self, info):
        module = info.get_module()
        self.logger.trace("Module: {}".format(module))

        try:
            if module in sys.modules:
                self.logger.trace("Module exists, reloading..")
                reload(sys.modules[module])
                module_obj = sys.modules[module]
            else:
                module_obj = importlib.import_module(module)

            self.logger.trace("Module object: {}".format(module_obj))

            plugin_class = self.find_plugin_class(module_obj)

            if plugin_class is None:
                self.logger.error(
                    "Unable to find plugin class for plugin: {}".format(
                        info.name))
                returnValue((PluginState.LoadError, None))

            plugin = plugin_class(info, self)

        except ImportError:
            self.logger.exception("Unable to import plugin: {}".format(
                info.name))
            returnValue((PluginState.LoadError, None))
        except Exception:
            self.logger.exception("Error loading plugin: {}".format(info.name))
            returnValue((PluginState.LoadError, None))
        else:
            try:
                info.set_plugin_object(plugin)
                plugin.logger = getLogger(info.name)

                d = plugin.setup()

                if isinstance(d, Deferred):
                    _ = yield d
            except Exception:
                self.logger.exception("Error setting up plugin: {}".format(
                    info.name))
                returnValue((PluginState.LoadError, None))
            else:
                returnValue((PluginState.Loaded, plugin))
Пример #23
0
    def __init__(self, factory, config):
        self.factory = factory
        self.config = config
        self.log = getLogger("TS3")

        self.log.info("Setting up..")

        self.server = config["server"]
        self.identity = config["identity"]

        self.user = self.identity["username"]
        self.passw = self.identity["password"]
        self.sid = self.server["sid"]

        reactor.connectTCP(
            self.server["address"],
            self.server["port"],
            self.factory,
            120
        )
Пример #24
0
    def __init__(self, path, *args, **kwargs):
        self.callbacks = []

        self.logger = getLogger("DBAPI")

        path = path.replace("//", "/")
        path = path.split("/", 1)[1]

        self.path = path

        self.logger.trace("Path: %s" % path)
        self.logger.trace("Args: %s" % (args or "[]"))
        self.logger.trace("KWArgs: %s" % (kwargs or "{}"))

        parsed_module = path.split(":", 1)[0]
        self.parsed_module = parsed_module
        self.args = args
        self.kwargs = kwargs

        self.logger.debug(_("Parsed module: %s") % parsed_module)

        self.reconnect()
Пример #25
0
    def __init__(self, path, *args, **kwargs):
        self.callbacks = []

        self.logger = getLogger("DBAPI")

        path = path.replace("//", "/")
        path = path.split("/", 1)[1]

        self.path = path

        self.logger.trace("Path: %s" % path)
        self.logger.trace("Args: %s" % (args or "[]"))
        self.logger.trace("KWArgs: %s" % (kwargs or "{}"))

        parsed_module = path.split(":", 1)[0]
        self.parsed_module = parsed_module
        self.args = args
        self.kwargs = kwargs

        self.logger.debug(_("Parsed module: %s") % parsed_module)

        self.reconnect()
Пример #26
0
    def __init__(self, factory_manager=None,
                 path="./plugins", module="plugins"):
        if factory_manager is None:
            raise ValueError("Factory manager cannot be None!")

        self.log = getLogger("Plugins")
        self.loaders = {}

        python_loader = PythonPluginLoader(factory_manager, self)
        self.loaders["python"] = python_loader

        self.factory_manager = factory_manager

        self.module = module
        self.path = path

        try:
            import hy  # noqa
        except ImportError:
            hy = None  # noqa

            self.log.warn("Unable to find Hy - Hy plugins will not load")
            self.log.warn("Install Hy with pip if you need this support")
Пример #27
0
    def set_language(self, lang=None, mlang=None):
        if lang is None:
            lang = DEFAULT

        if mlang is None:
            mlang = DEFAULT

        self.get_known()

        if self.log and self.logger is None:
            from system.logging.logger import getLogger

            self.logger = getLogger("Translations")

        if lang not in self.known:
            if self.logger is None:
                print("Unknown language '%s', defaulting to '%s'"
                      % (lang, DEFAULT))
            else:
                self.logger.warn("Unknown language '%s', defaulting to '%s'"
                                 % (lang, DEFAULT))

            lang = DEFAULT

        if mlang not in self.known:
            if self.logger is None:
                print("Unknown language '%s', defaulting to '%s'"
                      % (mlang, DEFAULT))
            else:
                self.logger.warn("Unknown language '%s', defaulting to '%s'"
                                 % (mlang, DEFAULT))

            mlang = DEFAULT

        self.language = lang
        self.m_language = mlang
        self.reload()
Пример #28
0
    def set_language(self, lang=None, mlang=None):
        if lang is None:
            lang = DEFAULT

        if mlang is None:
            mlang = DEFAULT

        self.get_known()

        if self.log and self.logger is None:
            from system.logging.logger import getLogger

            self.logger = getLogger("Translations")

        if lang not in self.known:
            if self.logger is None:
                print("Unknown language '%s', defaulting to '%s'" %
                      (lang, DEFAULT))
            else:
                self.logger.warn("Unknown language '%s', defaulting to '%s'" %
                                 (lang, DEFAULT))

            lang = DEFAULT

        if mlang not in self.known:
            if self.logger is None:
                print("Unknown language '%s', defaulting to '%s'" %
                      (mlang, DEFAULT))
            else:
                self.logger.warn("Unknown language '%s', defaulting to '%s'" %
                                 (mlang, DEFAULT))

            mlang = DEFAULT

        self.language = lang
        self.m_language = mlang
        self.reload()
Пример #29
0
    def __init__(self, name, factory, config):
        self.name = name
        self.factory = factory
        self.config = config

        self.received = ""
        self.log = getLogger(self.name)
        self.log.info("Setting up..")

        self.command_manager = CommandManager()
        self.event_manager = EventManager()

        self.username = config["identity"]["username"]
        self.password = config["identity"]["password"]
        self.networking = config["network"]
        self.tokens = config["identity"]["tokens"]

        self.control_chars = config["control_chars"]

        audio_conf = config.get("audio", {})
        self.should_mute_self = audio_conf.get("should_mute_self", True)
        self.should_deafen_self = audio_conf.get("should_deafen_self", True)

        self.userstats_request_rate = config.get("userstats_request_rate", 60)
Пример #30
0
    def __init__(self, name, factory, config):
        self.name = name
        self.factory = factory
        self.config = config

        self.received = ""
        self.log = getLogger(self.name)
        self.log.info("Setting up..")

        self.command_manager = CommandManager()
        self.event_manager = EventManager()

        self.username = config["identity"]["username"]
        self.password = config["identity"]["password"]
        self.networking = config["network"]
        self.tokens = config["identity"]["tokens"]

        self.control_chars = config["control_chars"]

        audio_conf = config.get("audio", {})
        self.should_mute_self = audio_conf.get("should_mute_self", True)
        self.should_deafen_self = audio_conf.get("should_deafen_self", True)

        self.userstats_request_rate = config.get("userstats_request_rate", 60)
Пример #31
0
    def __init__(self, conf_path="config/", data_path="data/"):
        self.conf_path = conf_path
        self.data_path = data_path

        self.log = getLogger("Storage")
Пример #32
0
    def __init__(self, data_dict):
        self.callbacks = []

        self.logger = getLogger("Data")
        self.data = data_dict
Пример #33
0
 def __init__(self):
     self.logger = getLogger("Commands")
     self.event_manager = EventManager()
Пример #34
0
# coding=utf-8

"""
Logging-related decorators for wrapping functions. Also includes a way
of deprecating things.
"""
import inspect

import logbook as logging
import traceback
from system.logging import logger as log

__author__ = 'Sean'

_log = log.getLogger(__name__)


def log_message(message, level=None, logger=None, before=True):
    """
    Log a message before or after calling the wrapped function. If logging
    after, the result of the function is passed into the log message for
    formatting as *wrapped_result*.

    :param message: The message to log
    :param level: The level to log at (default: logging.INFO)
    :param logger: The logger to log to (default: generic logger)
    :param before: Log before or after the function call (default: before)
    """

    if level is None:
        level = logging.INFO
Пример #35
0
 def __init__(self):
     self.logger = getLogger("Events")
Пример #36
0
    def __init__(self):
        self.log = getLogger("GetchUnix")
        import tty
        import sys

        self.log.trace(_("Loaded: %s, %s") % (tty, sys))
Пример #37
0
 def __init__(self):
     self.logger = getLogger("Events")
Пример #38
0
 def __init__(self, parsed_args):
     self.parsed_args = parsed_args
     self.factory_manager = FactoryManager()
     self.factory_manager.setup_logging(self.parsed_args)
     self.logger = getLogger("Core")
Пример #39
0
    def __init__(self):
        self.token_regex = re.compile(r"\{[^}]*\}")
        self.parse_regex = re.compile(r"(?<!\\):")
        self.escape_regex = re.compile(r"\\:")

        self.logger = getLogger("Tokens")
Пример #40
0
commands!
"""

from functools import wraps
import Queue
import time

from twisted.internet.defer import Deferred
from twisted.internet.task import LoopingCall
from twisted.python.failure import Failure

from system.logging import logger as log

__author__ = 'Sean'

_log = log.getLogger(__name__)


class RateLimitExceededError(Exception):
    """
    Raised when the rate limit is exceeded
    """

    pass


def _raise_rate_limit_exceeded_error():
    """
    Function to raise a `RateLimitExceededError`
    """
    raise RateLimitExceededError("Rate limit exceeded")
Пример #41
0
def main():
    if (not args.no_upgrade) and is_virtualenv():
        update(git=False)

    if os.path.dirname(sys.argv[0]):
        os.chdir(os.path.dirname(sys.argv[0]))

    from system.logging.logger import getLogger
    from system import constants
    from system.decorators import threads

    sys.stdout = getwriter('utf-8')(sys.stdout)
    sys.stderr = getwriter('utf-8')(sys.stderr)

    ultros = Ultros(args)
    versions = VersionManager()

    if not os.path.exists("logs"):
        os.mkdir("logs")

    logger = getLogger("System")

    requests_log = logging.getLogger("requests")
    requests_log.setLevel(logging.WARNING)

    logger.info(_("Starting up, version \"%s\"") % constants.__version__)
    logger.info(constants.__version_info__)

    # Write PID to file
    fh = open("ultros.pid", "w")
    fh.write(str(os.getpid()))
    fh.flush()
    fh.close()

    logger.info(_("PID: %s") % os.getpid())

    try:
        logger.debug("Starting..")
        ultros.start()

    except Exception:
        logger.critical(_("Runtime error - process cannot continue!"))
        logger.exception("")
    except SystemExit as e:
        logger.trace("SystemExit caught!")

        logger.debug("Stopping threadpool..")
        threads.pool.stop()

        logger.debug("Removing pidfile..")
        os.remove("ultros.pid")
        exit(e.code)
    finally:
        try:
            logger.debug("Unloading manager..")
            ultros.stop()

            logger.debug("Stopping threadpool..")
            threads.pool.stop()

            logger.debug("Removing pidfile..")
            os.remove("ultros.pid")

            if args.catch:
                raw_input(_("Press enter to exit."))
        except Exception:
            pass
Пример #42
0
    def __init__(self):
        self.token_regex = re.compile(r"\{[^}]*\}")
        self.parse_regex = re.compile(r"(?<!\\):")
        self.escape_regex = re.compile(r"\\:")

        self.logger = getLogger("Tokens")
Пример #43
0
    def __init__(self):
        self.log = getLogger("GetchWindows")
        import msvcrt

        self.log.trace(_("Loaded: %s") % msvcrt)
Пример #44
0
    def __init__(self, config=None, manager=None):
        if config is None or manager is None:
            raise ValueError("Config and manager must not be None!")

        self.config = config
        self.manager = manager
        self.log = getLogger("Metrics")

        self.storage = StorageManager()
        self.events = EventManager()
        self.packages = Packages(get=False)

        self.data = self.storage.get_file(self, "data", JSON, "metrics.json")

        self.task = LoopingCall(self.submit_metrics)

        if "metrics" in config:
            self.status = config["metrics"]
            if self.status == "on":
                self.status = True
            elif self.status == "off":
                self.status = False
        else:
            self.log.warn("\n%s\n" % warning)
            self.log.warn(
                _("We couldn't find a \"metrics\" option in your settings.yml"
                  " file!"))
            self.log.warn(
                _("Metrics will default to being turned on. If this is not what"
                  " you want, please create a \"metrics\" option in your "
                  "settings and set it to \"off\"."))
            self.log.warn(
                _("If you want to keep metrics enabled, set the option to"
                  " \"on\"."))
            self.log.warn(
                _("This warning will be shown on every startup until the option"
                  " has been set."))
            self.status = True

        if "send-exceptions" not in config:
            self.log.warn(
                _("We couldn't find a \"send-exceptions\" option in your "
                  "settings.yml file!"))
            self.log.warn(
                _("Exception sending will default to being turned on. If this "
                  "is not what you want, please create a \"send-exceptions\" "
                  "option in your settings and set it to \"off\"."))
            self.log.warn(
                _("If you want to keep exception sending enabled, set the "
                  "option to \"on\"."))
            self.log.warn(
                _("This warning will be shown on every startup until the option"
                  " has been set."))

        self.send_exceptions = config.get("send-exceptions", True)

        with self.data:
            if self.status is True:
                if "uuid" not in self.data:
                    try:
                        uuid = self.get(self.uuid_url)
                    except Exception:
                        self.log.exception(_("Error getting UUID"))
                        return
                    self.data["uuid"] = uuid
                    self.data["status"] = "enabled"
            elif "uuid" not in self.data:
                self.data["status"] = "disabled"

        if self.status is False:
            if self.data["status"] == "disabled":
                self.log.info(_("Metrics are disabled."))
                return
        elif self.status is "destroy":
            if "uuid" not in self.data:
                self.log.info(_("Metrics are disabled."))
                return

        self.task.start(self.interval)
Пример #45
0
    def __init__(self, conf_path="config/", data_path="data/"):
        self.conf_path = conf_path
        self.data_path = data_path

        self.log = getLogger("Storage")
Пример #46
0
    def __init__(self, data_dict):
        self.callbacks = []

        self.logger = getLogger("MemoryConfig")
        self.exists = True
        self.data = data_dict
Пример #47
0
    def __init__(self, protocol_name, config, factory_manager):
        self.name = protocol_name
        self.config = config
        self.factory_manager = factory_manager

        self.logger = getLogger("F: {}".format(self.name))
Пример #48
0
    def __init__(self):
        self.log = getLogger("GetchWindows")
        import msvcrt

        self.log.trace(_("Loaded: %s") % msvcrt)
Пример #49
0
    def __init__(self, protocol_name, config, factory_manager):
        self.name = protocol_name
        self.config = config
        self.factory_manager = factory_manager

        self.logger = getLogger("F: {}".format(self.name))
Пример #50
0
 def __init__(self):
     self.logger = getLogger("Help")
     self.add_topic(AliasListTopic("aliases", HelpTopicType.GenericTopic))
     self.add_topic(ComandListTopic("commands", HelpTopicType.GenericTopic))
Пример #51
0
    def __init__(self):
        self.log = getLogger("GetchUnix")
        import tty
        import sys

        self.log.trace(_("Loaded: %s, %s") % (tty, sys))
Пример #52
0
    def __init__(self, factory_manager, plugin_manager):
        self.logger = getLogger(self.logger_name or self.__class__.__name__)

        self.factory_manager = factory_manager
        self.plugin_manager = plugin_manager
Пример #53
0
    def __init__(self, config=None, manager=None):
        if config is None or manager is None:
            raise ValueError("Config and manager must not be None!")

        self.config = config
        self.manager = manager
        self.log = getLogger("Metrics")

        self.storage = StorageManager()
        self.events = EventManager()
        self.packages = Packages(get=False)

        self.data = self.storage.get_file(self, "data", JSON, "metrics.json")

        self.task = LoopingCall(self.submit_metrics)

        if "metrics" in config:
            self.status = config["metrics"]
            if self.status == "on":
                self.status = True
            elif self.status == "off":
                self.status = False
        else:
            self.log.warn("\n%s\n" % warning)
            self.log.warn(_(
                "We couldn't find a \"metrics\" option in your settings.yml"
                " file!"
            ))
            self.log.warn(_(
                "Metrics will default to being turned on. If this is not what"
                " you want, please create a \"metrics\" option in your "
                "settings and set it to \"off\"."
            ))
            self.log.warn(_(
                "If you want to keep metrics enabled, set the option to"
                " \"on\"."
            ))
            self.log.warn(_(
                "This warning will be shown on every startup until the option"
                " has been set."
            ))
            self.status = True

        if "send-exceptions" not in config:
            self.log.warn(_(
                "We couldn't find a \"send-exceptions\" option in your "
                "settings.yml file!"
            ))
            self.log.warn(_(
                "Exception sending will default to being turned on. If this "
                "is not what you want, please create a \"send-exceptions\" "
                "option in your settings and set it to \"off\"."
            ))
            self.log.warn(_(
                "If you want to keep exception sending enabled, set the "
                "option to \"on\"."
            ))
            self.log.warn(_(
                "This warning will be shown on every startup until the option"
                " has been set."
            ))

        self.send_exceptions = config.get("send-exceptions", True)

        with self.data:
            if self.status is True:
                if "uuid" not in self.data:
                    try:
                        uuid = self.get(self.uuid_url)
                    except Exception:
                        self.log.exception(_("Error getting UUID"))
                        return
                    self.data["uuid"] = uuid
                    self.data["status"] = "enabled"
            elif "uuid" not in self.data:
                self.data["status"] = "disabled"

        if self.status is False:
            if self.data["status"] == "disabled":
                self.log.info(_("Metrics are disabled."))
                return
        elif self.status is "destroy":
            if "uuid" not in self.data:
                self.log.info(_("Metrics are disabled."))
                return

        self.task.start(self.interval)