コード例 #1
0
ファイル: pyfa.py プロジェクト: w9jds/Pyfa
                    # reset=False,
                )
            ])
    except:
        print(
            "Critical error attempting to setup logging. Falling back to console only."
        )
        logging_mode = "Console Only"
        logging_setup = NestedSetup([
            # make sure we never bubble up to the stderr handler
            # if we run out of setup handling
            NullHandler(),
            StreamHandler(sys.stdout, bubble=False)
        ])

    with logging_setup.threadbound():
        pyfalog.info("Starting Pyfa")

        pyfalog.info("Logbook version: {0}", logbook_version)

        pyfalog.info("Running in logging mode: {0}", logging_mode)
        pyfalog.info("Writing log file to: {0}", config.logPath)

        # Output all stdout (print) messages as warnings
        try:
            sys.stdout = LoggerWriter(pyfalog.warning)
        except:
            pyfalog.critical(
                "Cannot redirect.  Continuing without writing stdout to log.")

        # Output all stderr (stacktrace) messages as critical
コード例 #2
0
ファイル: config.py プロジェクト: Sectoid/Pyfa
def defLogging():
    global debug
    global logPath
    global loggingLevel
    global logging_setup

    try:
        if debug:
            logging_setup = NestedSetup([
                # make sure we never bubble up to the stderr handler
                # if we run out of setup handling
                NullHandler(),
                StreamHandler(
                        sys.stdout,
                        bubble=False,
                        level=loggingLevel
                ),
                TimedRotatingFileHandler(
                        logPath,
                        level=0,
                        backup_count=3,
                        bubble=True,
                        date_format='%Y-%m-%d',
                ),
            ])
        else:
            logging_setup = NestedSetup([
                # make sure we never bubble up to the stderr handler
                # if we run out of setup handling
                NullHandler(),
                FingersCrossedHandler(
                        TimedRotatingFileHandler(
                                logPath,
                                level=0,
                                backup_count=3,
                                bubble=False,
                                date_format='%Y-%m-%d',
                        ),
                        action_level=ERROR,
                        buffer_size=1000,
                        # pull_information=True,
                        # reset=False,
                )
            ])
    except:
        print("Critical error attempting to setup logging. Falling back to console only.")
        logging_setup = NestedSetup([
            # make sure we never bubble up to the stderr handler
            # if we run out of setup handling
            NullHandler(),
            StreamHandler(
                    sys.stdout,
                    bubble=False
            )
        ])

    with logging_setup.threadbound():

        # Output all stdout (print) messages as warnings
        try:
            sys.stdout = LoggerWriter(pyfalog.warning)
        except:
            pyfalog.critical("Cannot redirect.  Continuing without writing stdout to log.")

        # Output all stderr (stacktrace) messages as critical
        try:
            sys.stderr = LoggerWriter(pyfalog.critical)
        except:
            pyfalog.critical("Cannot redirect.  Continuing without writing stderr to log.")
コード例 #3
0
ファイル: config.py プロジェクト: thauser/Pyfa
def defLogging():
    global debug
    global logPath
    global loggingLevel
    global logging_setup

    try:
        if debug:
            logging_setup = NestedSetup([
                # make sure we never bubble up to the stderr handler
                # if we run out of setup handling
                NullHandler(),
                StreamHandler(sys.stdout, bubble=False, level=loggingLevel),
                TimedRotatingFileHandler(
                    logPath,
                    level=0,
                    backup_count=3,
                    bubble=True,
                    date_format='%Y-%m-%d',
                ),
            ])
        else:
            logging_setup = NestedSetup([
                # make sure we never bubble up to the stderr handler
                # if we run out of setup handling
                NullHandler(),
                FingersCrossedHandler(
                    TimedRotatingFileHandler(
                        logPath,
                        level=0,
                        backup_count=3,
                        bubble=False,
                        date_format='%Y-%m-%d',
                    ),
                    action_level=ERROR,
                    buffer_size=1000,
                    # pull_information=True,
                    # reset=False,
                )
            ])
    except:
        print(
            "Critical error attempting to setup logging. Falling back to console only."
        )
        logging_setup = NestedSetup([
            # make sure we never bubble up to the stderr handler
            # if we run out of setup handling
            NullHandler(),
            StreamHandler(sys.stdout, bubble=False)
        ])

    with logging_setup.threadbound():

        # Output all stdout (print) messages as warnings
        try:
            sys.stdout = LoggerWriter(pyfalog.warning)
        except:
            pyfalog.critical(
                "Cannot redirect.  Continuing without writing stdout to log.")

        # Output all stderr (stacktrace) messages as critical
        try:
            sys.stderr = LoggerWriter(pyfalog.critical)
        except:
            pyfalog.critical(
                "Cannot redirect.  Continuing without writing stderr to log.")
コード例 #4
0
ファイル: pyfa.py プロジェクト: PaulKPetersonCO/Pyfa
                )
            ])
    except:
        print("Critical error attempting to setup logging. Falling back to console only.")
        logging_mode = "Console Only"
        logging_setup = NestedSetup([
            # make sure we never bubble up to the stderr handler
            # if we run out of setup handling
            NullHandler(),
            StreamHandler(
                    sys.stdout,
                    bubble=False
            )
        ])

    with logging_setup.threadbound():
        pyfalog.info("Starting Pyfa")

        pyfalog.info("Logbook version: {0}", logbook_version)

        pyfalog.info("Running in logging mode: {0}", logging_mode)
        pyfalog.info("Writing log file to: {0}", config.logPath)

        # Output all stdout (print) messages as warnings
        try:
            sys.stdout = LoggerWriter(pyfalog.warning)
        except:
            pyfalog.critical("Cannot redirect.  Continuing without writing stdout to log.")

        # Output all stderr (stacktrace) messages as critical
        try: