Write a raw message to the log using a function or the default
file logging.
976674
private static function write ($struct) {
		$handler = self::handler ();

		if (! $handler instanceof \Closure) {
			$handler = \Analog\Handler\File::init ($handler);
		}
		return $handler ($struct);
	}
229297
def write_line(self, message):
        """"""

        self.out.write(message + "\n")
        self.out.flush()
935190
def log_to_file(filename, level=DEBUG):
    """"""
    l = logging.getLogger("paramiko")
    if len(l.handlers) > 0:
        return
    l.setLevel(level)
    f = open(filename, 'w')
    lh = logging.StreamHandler(f)
    lh.setFormatter(logging.Formatter('%(levelname)-.3s [%(asctime)s.%(msecs)03d] thr=%(_threadid)-3d %(name)s: %(message)s',
                                      '%Y%m%d-%H:%M:%S'))
    l.addHandler(lh)
548672
def _raw(self, msg):
        
        self.device.write(msg)
        if self.auto_flush:
            self.flush()
1190997
def logFile(fileName, printFunction=logger.info):
    
    printFunction("Reporting file: %s" % fileName)
    shortName = fileName.split("/")[-1]
    fileHandle = open(fileName, 'r')
    line = fileHandle.readline()
    while line != '':
        if line[-1] == '\n':
            line = line[:-1]
        printFunction("%s:\t%s" % (shortName, line))
        line = fileHandle.readline()
    fileHandle.close()
539584
def Write(self, grr_message):
    """"""
    grr_message = grr_message.SerializeToString()

    try:
      with io.open(self.logfile, "wb") as fd:
        fd.write(grr_message)
    except (IOError, OSError):
      # Check if we're missing directories and try to create them.
      if not os.path.isdir(os.path.dirname(self.logfile)):
        try:
          os.makedirs(os.path.dirname(self.logfile))
          with io.open(self.logfile, "wb") as fd:
            fd.write(grr_message)
        except (IOError, OSError):
          logging.exception("Couldn't write nanny transaction log to %s",
                            self.logfile)
1363048
def msg(message, *args, **kwargs):
    """"""
    global log_file
    if log_file is None:
        log_file = sys.stderr
    if long_msg:
        file_name, line = caller_trace()
        file_name, file_type = os.path.splitext(file_name)
        if file_name.endswith('/__init__'):
            file_name = os.path.basename(os.path.dirname(file_name))
        elif file_name.endswith('/__main__'):
            file_name = "(-m) {0}".format(
                os.path.basename(os.path.dirname(file_name)))
        else:
            file_name = os.path.basename(file_name)
        head = '{0}{1} ({2}): '.format(file_name, file_type, line)
    else:
        head = '[SERVER] '
    out = StringIO()
    for line in message.format(*args, **kwargs).split('\n'):
        out.write('{0}{1}\n'.format(head, line))
    out.flush()
    out.seek(0)
    if _msg_stderr:
        sys.stderr.write(out.read())
        sys.stderr.flush()
    else:
        log_file.write(out.read())
        log_file.flush()
    out.close()
149811
def _log(self, message, stream, color=None, newline=False):
        '''
        
        '''

        if color and self.color_term:
            colorend = Logger.COLOR_END
        else:
            color = colorend = ''

        stream.write('{color}{message}{colorend}\n'.format(
            color=color,
            message=message,
            colorend=colorend
        ))

        if newline:
            sys.stdout.write('\n')

        stream.flush()
1311781
def log(self, logfile=None):
        """"""
        if logfile is None:
            logfile = sys.stderr
        tb = self.plaintext.rstrip() + u"\n"
        logfile.write(to_native(tb, "utf-8", "replace"))
645339
def printlog(self, string, verbose=None, flush=False):
        """"""
        if self.writelog:
            self.logger.info(string)
        if verbose or (self.verbose and verbose is None):
            print(string, flush=flush)
1374974
def writeln (self, msg):
        """"""
        self.fd.write(u"%s%s" % (msg, unicode(os.linesep)))
1002366
def log(logger, level, message):
    """"""

    if logger.parent.name != 'root':
        logger.log(level, message)
    else:
        print(message, file=sys.stderr)
1183877
def write_log(self, message):
        
        if self._is_write_log and self.log_file and not self.log_file.closed:
            self.log_file.write(message + '\n')
570138
def log(self, msg, error=False):
        """"""
        output = self.stdout
        if error:
            output = self.stderr

        output.write(msg)
        output.write('\n')
116222
def write_log(self, fs=None):
        
        log = StringIO.StringIO()
        log.write(self.setup_src)

        # If the function is not bound, write the test score to the log
        if not self.is_class_method:
            time_avg = convert_time_units(self.time_average_seconds)
            log.write("\nAverage time: {0} \n".format(time_avg))

        if fs:
            with open(fs, 'w') as _f:
                _f.write(log.getvalue())
1301862
def write_message(msg, indent=False, mtype='standard', caption=False):
    """"""
    if (mtype == 'debug' and config.DEBUG) or (mtype != 'debug' and config.VERBOSE) or mtype == 'error':
        message(msg, indent=indent, mtype=mtype, caption=caption)
1189439
def logv(msg, *args, **kwargs):
    
    if settings.VERBOSE:
        log(msg, *args, **kwargs)