Write formatted log message to stderr.
338165
def write_log(title, message=''):
    """"""

    sys.stderr.write(''.join([
        title.center(40).center(60, '-'), '\n', message
    ]))
529196
function writeToConsoleOrStderr(message) {
	if (typeof console == 'object' && typeof console.warn == 'function')
		console.warn(message);
	else if (typeof process == 'object' && typeof process.stderr == 'object' && typeof process.stderr.write == 'function')
		process.stderr.write(message);
	else
		throw new Error(message);
}
176473
def die(msg, errlvl=1, prefix="Error: "):
    """"""
    stderr("%s%s\n" % (prefix, msg))
    sys.exit(errlvl)
85465
def write_error(*args, **kwargs):
    """"""
    if _logger:
        kwargs.pop("end", None)
        kwargs.pop("file", None)
        _logger.error(*args, **kwargs)
    else:
        print(*args, file=sys.stderr, **kwargs)
1309186
def __logfile_error(self, e):
        
        from sys import stderr
        msg = "Warning, error writing log file %s: %s\n"
        msg = msg % (self.logfile, str(e))
        stderr.write(DebugLog.log_text(msg))
        self.logfile = None
        self.fd      = None
1275006
def log_to_syslog():
    
    # Get root logger
    rl = logging.getLogger()
    rl.setLevel('INFO')

    # Stderr gets critical messages (mostly config/setup issues)
    #   only when not daemonized
    stderr = logging.StreamHandler(stream=sys.stderr)
    stderr.setLevel(logging.CRITICAL)
    stderr.setFormatter(logging.Formatter(
        '%(asctime)s %(name)s: %(levelname)s %(message)s'))
    rl.addHandler(stderr)

    # All interesting data goes to syslog, using root logger's loglevel
    syslog = SysLogHandler(address='/dev/log', facility=SysLogHandler.LOG_MAIL)
    syslog.setFormatter(logging.Formatter(
        '%(name)s[%(process)d]: %(levelname)s %(message)s'))
    rl.addHandler(syslog)
1149700
def error(self, message):
        """"""
        sys.stderr.write('error: %s\n\n' % message)
        self.print_help()
        sys.exit(2)
31676
def log(self, *msg, sep='', end='\n', flush=False):
        """"""
        if not self.quiet:
            print(*msg, sep=sep, end=end, flush=flush)
714757
def my_log_message(verbose, prio, msg):
    
    syslog.syslog(prio, msg)
    if verbose or prio == syslog.LOG_ERR:
        sys.stderr.write("%s\n" % (msg))
1268845
def out(msg, error=False):
        "  "
        pipe = stdout
        if error:
            pipe = stderr
            msg = color_msg(msg, "warning")

        pipe.write("%s\n" % msg)
148752
def err(*args):
    
    for value in args:
        sys.stderr.write(value)

    sys.stderr.write(os.linesep)
996135
def log_end_message(log):
    
    if not log in MESSAGE_LOG.keys():
        log = -1

    res = colors.color_text(*MESSAGE_LOG[log][1])

    sys.stdout.write("\r[" + res + "] " + MESSAGE + "\n")
689603
def err_exit(msg, rc=1):
    
    print(msg, file=sys.stderr)
    sys.exit(rc)
1323239
def write_out(self, message, verbosity_level=1):
        
        if self.verbosity and self.verbosity >= verbosity_level:
            sys.stdout.write(smart_str(message))
            sys.stdout.flush()
571156
def error(self, message: str) -> None:
        """"""
        if len(self._custom_error_message) > 0:
            message = self._custom_error_message
            self._custom_error_message = ''

        lines = message.split('\n')
        linum = 0
        formatted_message = ''
        for line in lines:
            if linum == 0:
                formatted_message = 'Error: ' + line
            else:
                formatted_message += '\n       ' + line
            linum += 1

        sys.stderr.write(Fore.LIGHTRED_EX + '{}\n\n'.format(formatted_message) + Fore.RESET)
        # sys.stderr.write('{}\n\n'.format(formatted_message))
        self.print_help()
        sys.exit(1)
802611
def fatal(self, msg):
        
        if not self.log_to_file:
            msg = strip_whitespace(colors['red'] + "[+] " + msg +
                    colors['endc'])
        else:
            msg = "[" + time.strftime("%c") + "] " + msg

        raise RuntimeError(msg)
894686
def exception(self, exception):
        """"""
        if self.writelog:
            self.logger.exception(exception)
        if self.verbose:
            for line in  traceback.format_exception(
                    None, exception, exception.__traceback__):
                print(line, end='', file=sys.stderr, flush=True)