Emit a record.

        If a formatter is specified, it is used to format the record.
        The record is then written to the stream with a trailing newline
        [N.B. this may be removed depending on feedback].
431323
def emit (self, record):
        
        color = self.get_color(record)
        msg = self.format(record)
        if not hasattr(types, "UnicodeType"):
            # no unicode support
            self.stream.write("%s" % msg, color=color)
        else:
            try:
                self.stream.write("%s" % msg, color=color)
            except UnicodeError:
                self.stream.write("%s" % msg.encode("UTF-8"),
                                  color=color)
        self.stream.write(os.linesep)
        self.flush()
457639
def dump(record)
      data =
        if record.size == 1
          [record[0].bytesize, DELETE].pack('NN') << record[0]
        else
          [record[0].bytesize, record[1].bytesize].pack('NN') << record[0] << record[1]
        end
      data << crc32(data)
    end
490391
public void processRecordInternally(Record record) {
        if (record instanceof FormatRecord) {
            FormatRecord fr = (FormatRecord) record;
            _customFormatRecords.put(Integer.valueOf(fr.getIndexCode()), fr);
        }
        if (record instanceof ExtendedFormatRecord) {
            ExtendedFormatRecord xr = (ExtendedFormatRecord) record;
            _xfRecords.add(xr);
        }
    }
966108
def format(self, record):
        
        self._format_record(record)

        record_dict = {}
        for k, v in record.__dict__.items():
            if isinstance(k, str):
                k = decode_(k, 'utf8')
            if isinstance(v, str):
                v = decode_(v, 'utf8', 'replace')
            record_dict[k] = v

        if 'color' in self.fmt or 'end_color' in self.fmt:
            record_dict['color'], record_dict['end_color'] = _color(record.levelno)

        log = self.ufmt % record_dict

        if record.exc_text:
            if log[-1:] != '\n':
                log += '\n'
            log += decode_(record.exc_text, 'utf8', 'replace')

        log = log.replace('\n', '\n' + self.tab)

        return log
491755
def format(self, record):
        
        formatted = super(ColorFormatter, self).format(record)
        if self.verbose or not record.name.startswith(self.SPECIAL_SCOPE):
            return formatted

        # Arrow.
        formatted = '=> ' + formatted

        # Colors.
        if not self.colors:
            return formatted
        if record.levelno >= logging.ERROR:
            formatted = str(colorclass.Color.red(formatted))
        elif record.levelno >= logging.WARNING:
            formatted = str(colorclass.Color.yellow(formatted))
        else:
            formatted = str(colorclass.Color.cyan(formatted))
        return formatted
1308264
def format(self, record):
        
        if not hasattr(record, "type"):
            record.type = "   "
        return self._formatter.format(record)
531938
async def emit(self, record: LogRecord):  # type: ignore
        
        if self.writer is None:
            self.writer = await self._init_writer()

        try:
            msg = self.format(record) + self.terminator

            self.writer.write(msg.encode())
            await self.writer.drain()
        except Exception:
            await self.handleError(record)
1032588
def emit(self, record):
        """"""
        try:
            msg = self.format(record)
            if isinstance(msg,unicode):
                if hasattr(self.stream, "encoding") and self.stream.encoding:
                    # Stream should take care of encoding, but do it explicitly to
                    # prevent bug in Python 2.6 - see
                    # https://stackoverflow.com/questions/8016236/python-unicode-handling-differences-between-print-and-sys-stdout-write
                    self.stream.write(msg.encode(self.stream.encoding))
                else:
                    self.stream.write(msg.encode(encoding))
            else:
                self.stream.write(msg)
            terminator = getattr(record, 'terminator', '\n')
            if terminator is not None:
                self.stream.write(terminator)
            self.flush()
        except (KeyboardInterrupt, SystemExit):
            raise
        except:
            self.handleError(record)
762091
protected void gotoEOR(ArchiveRecord record) throws IOException {
        if (record.available() != 0) {
            throw new IOException("Record should be exhausted before coming " +
                "in here");
        }

        // Records end in 2*CRLF.  Suck it up.
        readExpectedChar(getIn(), CRLF.charAt(0));
        readExpectedChar(getIn(), CRLF.charAt(1));
        readExpectedChar(getIn(), CRLF.charAt(0));
        readExpectedChar(getIn(), CRLF.charAt(1));
    }
1030775
public String format(LogRecord record) {
        StringBuffer sb = new StringBuffer();
        String message = formatMessage(record);
        sb.append(message);
        sb.append(lineSeparator);
        if (record.getThrown() != null) {
            try {
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw);
                record.getThrown().printStackTrace(pw);
                pw.close();
            sb.append(sw.toString());
            } catch (Exception ex) {
            	if (record.getThrown().getCause() != null){
					sb.append(record.getThrown().getCause().getLocalizedMessage());
            	}else{
					sb.append(record.getThrown().getLocalizedMessage());
            	}
            	
            }
        }
        return sb.toString();
    }
458621
def emitCurrentRecordChanged(self, item):
        
        if self.signalsBlocked():
            return
        
        # emit that the record has been clicked
        if isinstance(item, XOrbRecordItem):
            self.currentRecordChanged.emit(item.record())
        else:
            self.currentRecordChanged.emit(None)
727567
def emit(self, record):
        
        try:
            if self.shouldRollover(record):
                self.doRollover()
            FileHandler.emit(self, record)
        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception:
            self.handleError(record)
416889
def emit(self, record):
		
		msg = self.format(record) + '\000'
		"""
		We need to convert record level to lowercase, maybe this will
		change in the future.
		"""
		prio = '<%d>' % self.encodePriority(self.facility,
					self.mapPriority(record.levelname))
		prio = prio.encode('utf-8')
		# Message is a string. Convert to bytes as required by RFC 5424.
		msg = msg.encode('utf-8')
		if codecs:
			msg = codecs.BOM_UTF8 + msg
		msg = prio + msg
		try:
			if self.unixsocket:
				try:
					self.socket.send(msg)
				except socket.error:
					self._connect_unixsocket(self.address)
					self.socket.send(msg)
			elif self.socktype == socket.SOCK_DGRAM:
				self.socket.sendto(msg, self.address)
			else:
				self.socket.sendall(msg)
		except (KeyboardInterrupt, SystemExit):
			raise
		except:
			self.handleError(record)
777217
@Override
    public synchronized void writeRecord(String record) {
        long length = record.length() + LoggingConstants.nlen;
        PrintStream ps = getPrintStream(length);
        ps.println(record);
        if (ps.checkError()) {
            setStreamStatus(StreamStatus.CLOSED, null, null, DummyOutputStream.psInstance);
            // to avoid junit test to print an error message
            if (System.getProperty("test.classesDir") == null && System.getProperty("test.buildDir") == null) {
                System.err.println(Tr.formatMessage(getTc(), "FAILED_TO_WRITE_LOG", new Object[] { getPrimaryFile().getAbsolutePath() }));
            }
        }
    }
1319783
def emit(self, record):
        
        try:
            syslog_msg = self.build_msg(record)
            self.transport.transmit(syslog_msg)
        except Exception:
            self.handleError(record)
971728
def format(self, record):
        '''
        
        '''
        formatted_record = super(ExcInfoOnLogLevelFormatMixIn, self).format(record)
        exc_info_on_loglevel = getattr(record, 'exc_info_on_loglevel', None)
        exc_info_on_loglevel_formatted = getattr(record, 'exc_info_on_loglevel_formatted', None)
        if exc_info_on_loglevel is None and exc_info_on_loglevel_formatted is None:
            return formatted_record

        # If we reached this far it means the log record was created with exc_info_on_loglevel
        # If this specific handler is enabled for that record, then we should format it to
        # include the exc_info details
        if self.level > exc_info_on_loglevel:
            # This handler is not enabled for the desired exc_info_on_loglevel, don't include exc_info
            return formatted_record

        # If we reached this far it means we should include exc_info
        if not record.exc_info_on_loglevel_instance and not exc_info_on_loglevel_formatted:
            # This should actually never occur
            return formatted_record

        if record.exc_info_on_loglevel_formatted is None:
            # Let's cache the formatted exception to avoid recurring conversions and formatting calls
            if self.formatter is None:  # pylint: disable=access-member-before-definition
                self.formatter = logging._defaultFormatter
            record.exc_info_on_loglevel_formatted = self.formatter.formatException(
                record.exc_info_on_loglevel_instance
            )

        # Let's format the record to include exc_info just like python's logging formatted does
        if formatted_record[-1:] != '\n':
            formatted_record += '\n'

        try:
            formatted_record += record.exc_info_on_loglevel_formatted
        except UnicodeError:
            # According to the standard library logging formatter comments:
            #
            #     Sometimes filenames have non-ASCII chars, which can lead
            #     to errors when s is Unicode and record.exc_text is str
            #     See issue 8924.
            #     We also use replace for when there are multiple
            #     encodings, e.g. UTF-8 for the filesystem and latin-1
            #     for a script. See issue 13232.
            formatted_record += record.exc_info_on_loglevel_formatted.decode(sys.getfilesystemencoding(),
                                                                             'replace')
        # Reset the record.exc_info_on_loglevel_instance because it might need
        # to "travel" through a multiprocessing process and it might contain
        # data which is not pickle'able
        record.exc_info_on_loglevel_instance = None
        return formatted_record
883355
public void write(Object[] record) throws IOException, DbaseFileException {

		if (record.length != header.getNumFields()) {
			throw new DbaseFileException("Wrong number of fields "
					+ record.length + " expected " + header.getNumFields());
		}

		buffer.position(0);

		// put the 'not-deleted' marker
		buffer.put((byte) ' ');

		for (int i = 0; i < header.getNumFields(); i++) {
			String fieldString = fieldString(record[i], i);
			if (header.getFieldLength(i) != fieldString
					.getBytes(charset.name()).length) {
				buffer.put(new byte[header.getFieldLength(i)]);
			} else {
				buffer.put(fieldString.getBytes(charset.name()));
			}

		}

		write();
	}