/* Write logs synchronously or asynchronously based on writeSynchronicity setting.
972980
private void writeLogEntries(Iterable<LogEntry> logEntries, WriteOption... writeOptions) {
    switch (this.writeSynchronicity) {
      case SYNC:
        get(writeAsync(logEntries, writeOptions));
        break;

      case ASYNC:
      default:
        final ApiFuture<Void> writeFuture = writeAsync(logEntries, writeOptions);
        final Object pendingKey = new Object();
        pendingWrites.put(pendingKey, writeFuture);
        ApiFutures.addCallback(
            writeFuture,
            new ApiFutureCallback<Void>() {
              private void removeFromPending() {
                pendingWrites.remove(pendingKey);
              }

              @Override
              public void onSuccess(Void v) {
                removeFromPending();
              }

              @Override
              public void onFailure(Throwable t) {
                try {
                  Exception ex = t instanceof Exception ? (Exception) t : new Exception(t);
                  throw new RuntimeException(ex);
                } finally {
                  removeFromPending();
                }
              }
            });
        break;
    }
  }
1178231
protected synchronized void writeLogFile(String line, Hashtable<String, String> param){
        // write to default file
        try{
            
            if (getWriter() != null) {
                
                getWriter().write(line + CRLF);
            }
            
            if (param!=null){
                // ZAP: Added type argument.
                Enumeration<String> v = param.keys();
                while (v.hasMoreElements()) {
                    // ZAP: Removed unnecessary cast.
                    String name = v.nextElement();
                    // ZAP: Removed unnecessary cast.
                    String value = param.get(name);
                    getWriter().write(delim + name + delim + value + CRLF);		        		           
                }    		
            }

            lastWriteTime = System.currentTimeMillis();
            
        } catch(IOException e){
        	logger.error(e.getMessage(), e);
        }
        
    }
846024
protected void writeLogging(Definition def, Writer out, int indent, String level, String content, String... params)
         throws IOException
   {
      writeIndent(out, indent);
      if (def.isSupportJbossLogging())
      {
         out.write("log.trace");
         int size = params.length;
         if (size > 0)
            out.write("f");
         out.write("(\"" + content + "(");
         for (int i = 0; i < size; i++)
         {
            out.write("%s");
            if (i < size - 1)
               out.write(", ");
         }
         out.write(")\"");
         for (int i = 0; i < size; i++)
         {
            out.write(", ");
            out.write(params[i]);
         }
         out.write(");");
      }
      else
      {
         out.write("log.finest(\"" + content + "()\");");
      }
      writeEol(out);
   }
552996
function writeLog () {
  if (mocking) {
    cli.stdout += stripAnsi(concatArguments(arguments))
  } else {
    process.stdout.write.apply(process.stdout, arguments)
  }
}
1303347
private static void writeToLog(int level, long totalNanos, long count, ProfilingTimerNode parent, String taskName, Log log, String logAppendMessage) {
		if (log == null) {
			return;
		}

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < level; i++) {
			sb.append('\t');
		}
		String durationText = String.format("%s%s",
				formatElapsed(totalNanos),
				count == 1 ?
						"" :
						String.format(" across %d invocations, average: %s", count, formatElapsed(totalNanos / count)));
		String text = parent == null ?
				String.format("total time %s", durationText) :
				String.format("[%s] took %s", taskName, durationText);
		sb.append(text);
		sb.append(logAppendMessage);
		log.info(sb.toString());
	}
569194
function Log(writer, level, prefix) {
    if (!(this instanceof Log)) return new Log(writer, level, prefix);
    this.writer = writer || process.stdout;
    this.prefix = prefix || '';
    this.level = (typeof level === 'undefined') ? LEVEL.ALL : level;
}
173043
static void log(ArrayList<PrintWriter> writers, RecordTypes recordType, 
                  Keys[] keys, String[] values) {
    StringBuffer buf = new StringBuffer(recordType.name()); 
    buf.append(DELIMITER); 
    for(int i =0; i< keys.length; i++){
      buf.append(keys[i]);
      buf.append("=\"");
      values[i] = escapeString(values[i]);
      buf.append(values[i]);
      buf.append("\"");
      buf.append(DELIMITER); 
    }
    buf.append(LINE_DELIMITER_CHAR);
    
    for (PrintWriter out : writers) {
      LogTask task = new LogTask(out, buf.toString());
      fileManager.addWriteTask(task);
    }
  }
402861
function writeLog(type, category){
    return function(messages) {
        var funcs = [];

        _.each(messages, function(message){
            funcs.push(this.client.logAsync(message, [type, category]));
        }.bind(this));

        return BB.all(funcs);
    };

}
161263
def logWrite(self, string):
		""""""
		logFile = open(self.logFile, 'at')
		logFile.write(string + '\n')
		logFile.close()
394534
final void write(LogData data) {
    checkNotNull(data, "data");
    try {
      backend.log(data);
    } catch (RuntimeException error) {
      try {
        backend.handleError(error, data);
      } catch (LoggingException allowed) {
        // Bypass the catch-all if the exception is deliberately created during error handling.
        throw allowed;
      } catch (RuntimeException wtf) {
        System.err.println("logging error: " + wtf.getMessage());
        wtf.printStackTrace(System.err);
      }
    }
  }
1332526
@Override
  public void write(JsonWriter out, MarkTiming markTiming) throws IOException {
    out.beginArray();

    out.value(markTiming.getMark());
    out.value(markTiming.getTime());

    out.endArray();
    out.flush();
  }
984525
def _write_to_log(self, output):
        """"""
        with open(self.log_file, 'a') as log_file:
            log_file.write('\n')
            log_file.write(output)
            log_file.write('\n')
538766
public ISynchronizationPoint<IOException> write(char[] chars, int offset, int length) {
		ISynchronizationPoint<IOException> last = lastWrite;
		if (length == 0) return last;
		if (last.isUnblocked()) {
			lastWrite = stream.writeAsync(chars, offset, length);
			return lastWrite;
		}
		SynchronizationPoint<IOException> ours = new SynchronizationPoint<>();
		lastWrite = ours;
		last.listenInline(() -> { stream.writeAsync(chars, offset, length).listenInline(ours); }, ours);
		return ours;
	}
1065087
private static void writeFully(WritableByteChannel ch, ByteBuffer bb)
        throws IOException
    {
        if (ch instanceof SelectableChannel) {
            SelectableChannel sc = (SelectableChannel)ch;
            synchronized (sc.blockingLock()) {
                if (!sc.isBlocking())
                    throw new IllegalBlockingModeException();
                writeFullyImpl(ch, bb);
            }
        } else {
            writeFullyImpl(ch, bb);
        }
    }
431917
function writeFiles (files, callback) {
  async.map(files, writeFile.bind(this), function (err) {
    if (err) callback(err);
    callback(null);
  });
}
1021824
static void write(List<AccessLogComponent> format, RequestLog log) {
        final VirtualHost host = ((ServiceRequestContext) log.context()).virtualHost();
        final Logger logger = host.accessLogger();
        if (!format.isEmpty() && logger.isInfoEnabled()) {
            logger.info(format(format, log));
        }
    }
21151
private static void writeFullyImpl(WritableByteChannel ch, ByteBuffer bb)
        throws IOException
    {
        while (bb.remaining() > 0) {
            int n = ch.write(bb);
            if (n <= 0)
                throw new RuntimeException("no bytes written");
        }
    }