Write a pre-formated record

@param 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() }));
            }
        }
    }
1222878
private void writePhysicalRecord(ByteBuffer data, Record record) {
    writeBuffer.putInt(generateCrc(data.array(), data.position(), record.getBytes(),
        record.getType()));
    writeBuffer.putShort((short) record.getBytes());
    writeBuffer.put(record.getType().value());
    int oldLimit = data.limit();
    data.limit(data.position() + record.getBytes());
    writeBuffer.put(data);
    data.limit(oldLimit);
  }
964481
public void markRecord(BufferedRecord<D> record, int bytesWritten) {
    synchronized (this) {
      thunks.add(new Thunk<>(record, bytesWritten));
      byteSize += bytesWritten;
    }
  }
135916
protected function write(array $record)
    {
        \assert('array_key_exists(\'formatted\', $record)');
        $this->notification
            ->setTitle(sprintf('[%s] %s', Logger::getLevelName($this->level), $this->name))
            ->setBody($record['formatted']);
        $this->notifier && $this->notifier->send($this->notification);
    }
427065
public synchronized void writeRecord(byte[] record, String header) {
        long length = record.length + nlen;
        PrintStream ps = getPrintStream(length, header);
        if (isWindows)
            ps.write(record, 0, (int) length - 2);
        else
            ps.write(record, 0, (int) length - 1);

        ps.println();
    }
927511
@Override
	public void writeRecord(Record record) throws IOException {
		int numRecFields = record.getNumFields();
		int readPos;

		for (int i = 0; i < this.numFields; i++) {
			readPos = this.recordPositions[i];
			if (readPos < numRecFields) {
				Value v = record.getField(this.recordPositions[i], this.classes[i]);
				if (v != null) {
					if (i != 0) {
						this.wrt.write(this.fieldDelimiter);
					}
					this.wrt.write(v.toString());
				} else {
					if (this.lenient) {
						if (i != 0) {
							this.wrt.write(this.fieldDelimiter);
						}
					} else {
						throw new RuntimeException("Cannot serialize record with <null> value at position: " + readPos);
					}
				}

			} else {
				if (this.lenient) {
					if (i != 0) {
						this.wrt.write(this.fieldDelimiter);
					}
				} else {
					throw new RuntimeException("Cannot serialize record with out field at position: " + readPos);
				}
			}

		}

		// add the record delimiter
		this.wrt.write(this.recordDelimiter);
	}
593230
@Override
  public void writeImpl(D record) throws IOException {
    if (!isRetry()) {
      //If currentRequest is still here, it means this is retry request.
      //In this case, don't invoke onNewRecord again as onNewRecord is not guaranteed to be idempotent.
      //(e.g: If you do batch processing duplicate record can go in, etc.)
      curRequest = onNewRecord(record);
    }

    if (curRequest.isPresent()) {
      ListenableFuture<CloseableHttpResponse> responseFuture = sendRequest(curRequest.get());
      try (CloseableHttpResponse response = waitForResponse(responseFuture)) {
        processResponse(response);
      }
      curRequest = Optional.absent(); //Clear request if successful
    }
    numRecordsWritten++;
  }
114797
@Override
	public void log(LogRecord record) {
		record.setMessage(maskPassword(record.getMessage()));
		super.log(record);
	}
1021604
public void write(WARCWritable record) throws IOException {
        if (record.getRecord() != null) write(record.getRecord());
    }
803498
protected function write(array $record)
    {
        if ($this->url && !file_exists($this->url)) {
            $this->stream = null;
        }
        parent::write($record);
    }
1037177
def __prepare_record(self, record, enabled_fields):
        """"""
        message = record.getMessage()
        if hasattr(record, 'prefix'):
            message = "{}{}".format((str(record.prefix) + ' ') if record.prefix else '', message)

        obj = {
            'name': record.name,
            'asctime': self.formatTime(record, self.datefmt),
            'created': record.created,
            'msecs': record.msecs,
            'relativeCreated': record.relativeCreated,
            'levelno': record.levelno,
            'levelname': self._level_names[record.levelname],
            'thread': record.thread,
            'threadName': record.threadName,
            'process': record.process,
            'pathname': record.pathname,
            'filename': record.filename,
            'module': record.module,
            'lineno': record.lineno,
            'funcName': record.funcName,
            'message': message,
            'exception': record.exc_info[0].__name__ if record.exc_info else None,
            'stacktrace': record.exc_text,
        }

        if not isinstance(enabled_fields, list):
            enabled_fields = [str(enabled_fields)]

        ef = {}
        for item in enabled_fields:
            if not isinstance(item, (str, tuple)):
                continue
            if not isinstance(item, tuple):
                ef[item] = item
            else:
                ef[item[0]] = item[1]

        result = {}
        for key, val in obj.items():
            if key in ef:
                result[ef[key]] = val

        return result
717768
public void fixRecord(Record record)
    {
        super.fixRecord(record);
        if (this.getProperty("field") != null)
        {
            BaseField field = this.getMainRecord().getField(this.getProperty("field").toString());
            if (field != null)
                this.fixCapitalization(field);
        }
    }
208633
protected function write(array $record) {
        $header = $this->getSyslogHeader($this->logLevels[$record['level']], $record['datetime']);
        $this->socket->write($record['formatted'], $header);
    }
1290906
@Override
  public void publish(final LogRecord record) {
    // determine destination
    final Writer destination;
    if(record.getLevel().intValue() >= Level.WARNING.intValue()) {
      destination = this.err;
    }
    else {
      destination = this.out;
    }

    // format
    final String m;

    // Progress records are handled specially.
    if(record instanceof ProgressLogRecord) {
      ProgressLogRecord prec = (ProgressLogRecord) record;
      ptrack.addProgress(prec.getProgress());

      Collection<Progress> completed = ptrack.removeCompleted();
      Collection<Progress> progresses = ptrack.getProgresses();

      StringBuilder buf = new StringBuilder();
      if(!completed.isEmpty()) {
        buf.append(OutputStreamLogger.CARRIAGE_RETURN);
        for(Progress prog : completed) {
          // TODO: use formatter, somehow?
          prog.appendToBuffer(buf);
          buf.append(OutputStreamLogger.NEWLINE);
        }
      }
      if(!progresses.isEmpty()) {
        boolean first = true;
        buf.append(OutputStreamLogger.CARRIAGE_RETURN);
        for(Progress prog : progresses) {
          if(first) {
            first = false;
          }
          else {
            buf.append(' ');
          }
          // TODO: use formatter, somehow?
          prog.appendToBuffer(buf);
        }
      }
      m = buf.toString();
    }
    else {
      // choose an appropriate formatter
      final Formatter fmt;
      // always format progress messages using the progress formatter.
      if(record.getLevel().intValue() >= Level.WARNING.intValue()) {
        // format errors using the error formatter
        fmt = errformat;
      }
      else if(record.getLevel().intValue() <= Level.FINE.intValue()) {
        // format debug statements using the debug formatter.
        fmt = debugformat;
      }
      else {
        // default to the message formatter.
        fmt = msgformat;
      }
      try {
        m = fmt.format(record);
      }
      catch(Exception ex) {
        reportError(null, ex, ErrorManager.FORMAT_FAILURE);
        return;
      }
    }
    // write
    try {
      destination.write(m);
      // always flush (although the streams should auto-flush already)
      destination.flush();
    }
    catch(Exception ex) {
      reportError(null, ex, ErrorManager.WRITE_FAILURE);
      return;
    }
  }
36770
def write_record(self, event_str):
        """"""
        header = struct.pack('Q', len(event_str))
        header += struct.pack('I', masked_crc32c(header))
        footer = struct.pack('I', masked_crc32c(event_str))
        self._writer.write(header + event_str + footer)
787871
public void publish(LogRecord record)
  {
    if (! isLoggable(record))
      return;

    if (_handler != null)
      _handler.publish(record);
  }
847804
@Override
	public void serializeRecord(T record) throws IOException {
		if (CHECKED) {
			if (dataBuffer.hasRemaining()) {
				throw new IllegalStateException("Pending serialization of previous record.");
			}
		}

		serializationBuffer.clear();
		lengthBuffer.clear();

		// write data and length
		record.write(serializationBuffer);

		int len = serializationBuffer.length();
		lengthBuffer.putInt(0, len);

		dataBuffer = serializationBuffer.wrapAsByteBuffer();
	}