Example #1
0
    def log_startup(recorder=None, safe_mode=None, **kwargs):
        from octoprint.logging import get_divider_line

        logger = logging.getLogger("octoprint.server")

        logger.info(get_divider_line("*"))
        logger.info("Starting OctoPrint {}".format(__display_version__))
        if safe_mode:
            logger.info(
                "Starting in SAFE MODE. Third party plugins will be disabled!")

        if recorder and len(recorder):
            logger.info(
                get_divider_line("-",
                                 "Logged during platform initialization:"))

            from octoprint.logging.handlers import CombinedLogHandler
            handler = CombinedLogHandler(*logging.getLogger().handlers)
            recorder.setTarget(handler)
            recorder.flush()

            logger.info(get_divider_line("-"))

        from octoprint import urllib3_ssl
        if not urllib3_ssl:
            logging.getLogger("octoprint.server")\
             .warn("requests/urllib3 will run in an insecure SSL environment. "
                      "You might see corresponding warnings logged later "
                      "(\"InsecurePlatformWarning\"). It is recommended to either "
                      "update to a Python version >= 2.7.9 or alternatively "
                      "install PyOpenSSL plus its dependencies. For details see "
                      "https://urllib3.readthedocs.org/en/latest/security.html#openssl-pyopenssl")
        logger.info(get_divider_line("*"))
Example #2
0
    def log_startup(recorder=None, safe_mode=None, **kwargs):
        from octoprint.logging import get_divider_line
        from octoprint.logging.handlers import PluginTimingsLogHandler

        logger = logging.getLogger("octoprint.startup")
        PluginTimingsLogHandler.arm_rollover()

        logger.info(get_divider_line("*"))
        logger.info("Starting OctoPrint {}".format(__display_version__))
        if safe_mode:
            logger.info(
                "Starting in SAFE MODE. Third party plugins will be disabled!")
            if safe_mode == "flag":
                reason = "command line flag"
            elif safe_mode == "settings":
                reason = "setting in config.yaml"
            elif safe_mode == "incomplete_startup":
                reason = "problem during last startup"
            else:
                reason = "unknown"
            logger.info("Reason for safe mode: {}".format(reason))

        if recorder and len(recorder):
            logger.info(
                get_divider_line("-",
                                 "Logged during platform initialization:"))

            from octoprint.logging.handlers import CombinedLogHandler

            handler = CombinedLogHandler(*logging.getLogger().handlers)
            recorder.setTarget(handler)
            recorder.flush()

            logger.info(get_divider_line("-"))

        from octoprint import urllib3_ssl

        if not urllib3_ssl:
            logging.getLogger("octoprint.server").warning(
                "requests/urllib3 will run in an insecure SSL environment. "
                "You might see corresponding warnings logged later "
                '("InsecurePlatformWarning"). It is recommended to either '
                "update to a Python version >= 2.7.9 or alternatively "
                "install PyOpenSSL plus its dependencies. For details see "
                "https://urllib3.readthedocs.org/en/latest/security.html#openssl-pyopenssl"
            )
        logger.info(get_divider_line("*"))