Esempio n. 1
0
    def fatal(self, msg):
        """
        For errors so grave that the program (or thread) cannot continue.
        """
        if not self.log_to_file:
            msg = strip_whitespace(colors['red'] + "[+] " + msg +
                    colors['endc'])
        else:
            msg = "[" + time.strftime("%c") + "] " + msg

        raise RuntimeError(msg)
Esempio n. 2
0
    def fatal(self, msg):
        """
        For errors so grave that the program (or thread) cannot continue.
        """
        if not self.log_to_file:
            msg = strip_whitespace(colors['red'] + "[+] " + msg +
                                   colors['endc'])
        else:
            msg = "[" + time.strftime("%c") + "] " + msg

        raise RuntimeError(msg)
Esempio n. 3
0
    def warn(self, msg, whitespace_strp=True):
        """
        For things that have gone seriously wrong but don't merit a program
        halt.
        Outputs to stderr, so JsonOutput does not need to override.
        @param msg: warning to output.
        @param whitespace_strp: whether to strip whitespace.
        """
        if self.errors_display:
            if whitespace_strp:
                msg = strip_whitespace(msg)

            if not self.log_to_file:
                msg = colors['warn'] + "[+] " + msg + colors['endc']
            else:
                msg = "[" + time.strftime("%c") + "] " + msg

            print(msg, file=self.error_log)
Esempio n. 4
0
    def warn(self, msg, whitespace_strp=True):
        """
        For things that have gone seriously wrong but don't merit a program
        halt.
        Outputs to stderr, so JsonOutput does not need to override.
        @param msg: warning to output.
        @param whitespace_strp: whether to strip whitespace.
        """
        if self.errors_display:
            if whitespace_strp:
                msg = strip_whitespace(msg)

            if not self.log_to_file:
                msg = colors['warn'] + "[+] " + msg + colors['endc']
            else:
                msg = "[" + time.strftime("%c") + "] " + msg

            self.print(msg, file=self.error_log)