format log messages
17326
function format( type, args ) {
  var now = new Date().toISOString(),
    tmpl = '[%s] %s: %s\n',
    msg;

  msg = args[ 0 ] instanceof Error ? args[ 0 ].stack :
    util.format.apply( util, args );

  return util.format( tmpl, now, type, msg );
}
479291
@Override
    public String formatMessage(LogRecord logRecord) {
        if (System.getSecurityManager() == null) {
            return formatMessage(logRecord, logRecord.getParameters(), true);
        } else {
            final LogRecord f_logRecord = logRecord;
            return AccessController.doPrivileged(new PrivilegedAction<String>() {
                @Override
                public String run() {
                    return formatMessage(f_logRecord, f_logRecord.getParameters(), true);
                }
            });
        }

    }
1301207
def format_log(request, message_type, message):
    
    from django_socketio.settings import MESSAGE_LOG_FORMAT
    if MESSAGE_LOG_FORMAT is None:
        return None
    now = datetime.now().replace(microsecond=0)
    args = dict(request.META, TYPE=message_type, MESSAGE=message, TIME=now)
    return (MESSAGE_LOG_FORMAT % args) + "\n"
367395
@Override
  public String format(LogRecord log)
  {
    StringBuilder sb = new StringBuilder();
    
    int mark = 0;

    for (FormatItem item : _formatList) {
      item.format(sb, log, mark);
      
      if (item instanceof PrettyPrintMarkItem) {
        mark = sb.length();
      }
    }
    
    return sb.toString();
  }
942333
function logMessage(time, path, message, mode) {
  if (config.logToConsole) {
    console.log(mode ? '['+mode+']' : '', path, message)
  }
  if (dataFile) {
    dataFile.log(time, path, message, mode)
  }
}
241789
def format(
            self,
            record,
            datefmt='%Y:%m:%d %H:%M:%S.%f'):
        

        now = datetime.datetime.now()
        utc_now = datetime.datetime.utcnow()
        asctime = None
        if self.datefmt:
            asctime = now.strftime(
                self.datefmt)
        else:
            asctime = now.strftime(
                datefmt)

        message = {
            'time': record.created,
            'timestamp': utc_now.strftime(
                '%Y-%m-%dT%H:%M:%S.%fZ'),
            'asctime': asctime,
            'path': record.pathname,
            'message': record.getMessage(),
            'exc': None,
            'logger_name': record.name
        }

        if record.exc_info and not message.get('exc'):
            message['exc'] = self.formatException(
                record.exc_info)
        if not message.get(
                'exc') and record.exc_text:
            message['exc'] = record.exc_text

        log_record = {}
        try:
            log_record = OrderedDict()
        except NameError:
            log_record = {}
        # end of try/ex

        message.update(
            self.fields_to_add)
        self.add_fields(
            log_record,
            record,
            message)
        use_log_record = self.process_log_record(
            log_record)
        return '{}{}'.format(
            self.prefix,
            self.jsonify_log_record(
                use_log_record))
947341
protected function _format($log)
    {
        $replaced = [];

        $replaced[':date'] = date('Y-m-d\TH:i:s', $log->timestamp) . sprintf('.%03d', ($log->timestamp - (int)$log->timestamp) * 1000);
        $replaced[':client_ip'] = $log->client_ip ?: '-';
        $replaced[':request_id'] = $log->request_id ?: '-';
        $replaced[':request_id16'] = $log->request_id ? substr($log->request_id, 0, 16) : '-';
        $replaced[':category'] = $log->category;
        $replaced[':location'] = "$log->file:$log->line";
        $replaced[':level'] = strtoupper($log->level);
        if ($log->category === 'exception') {
            $replaced[':message'] = '';
            /** @noinspection SuspiciousAssignmentsInspection */
            $replaced[':message'] = preg_replace('#[\\r\\n]+#', '\0' . strtr($this->_format, $replaced), $log->message) . PHP_EOL;
        } else {
            $replaced[':message'] = $log->message . PHP_EOL;
        }

        return strtr($this->_format, $replaced);
    }
1097493
function printLogMessage(unit, message) {
  const prompt = chalk.gray.dim('>');
  const logMessage = getUnitStyle(unit)(`${unit.name} ${message}`);
  printLine(`${prompt} ${logMessage}`);
}
901965
def log_to_file(self, message):
        """"""

        with self.build_fs.open(self.log_file, 'a+') as f:
            f.write(unicode(message + '\n'))
262226
def log (self, msg, prefix=None):
    """"""
    if prefix:
      if not prefix.strip().endswith(':'):
        prefix += ': '
      msg = prefix + msg
    self.messages.append(msg)
540304
def _set_log_format(color, include_caller):
    
    level_name = '* %(levelname)1s'
    time = '%(asctime)s,%(msecs)03d'
    message = '%(message)s'
    color_start = '%(color)s'
    color_end = '%(end_color)s'
    caller = '[%(module)s:%(lineno)d]'

    if color:
        if include_caller:
            return '{}{}{}  {}  {} {}'.format(color_start, level_name, color_end, time, message, caller)
        else:
            return '{}{}{}  {}  {}'.format(color_start, level_name, color_end, time, message)
    else:
        if include_caller:
            return '{}  {}  {} {}'.format(level_name, time, message, caller)
        else:
            return '{}  {}  {}'.format(level_name, time, message)
706885
def _format_msg(text, width, indent=0, prefix=""):
    
    """
    text = repr(text).replace("`", "\\`").replace("\\n", " ``\\n`` ")
    sindent = " " * indent if not prefix else prefix
    wrapped_text = textwrap.wrap(text, width, subsequent_indent=sindent)
    # [1:-1] eliminates quotes generated by repr in first line
    return ("\n".join(wrapped_text))[1:-1].rstrip()
637475
function customLog(message) {
  const trimmed = message.trim()
  const limit = trimmed.indexOf('\n')
  if (limit === -1) {
    fancyLog(trimmed)
  } else {
    const title = trimmed.slice(0, limit).trim()
    const details = trimmed.slice(limit).trim()
    fancyLog(`${title}${('\n' + details).replace(/\n/g, '\n  ')}`)
  }
}
1041192
def log_message(self, msg, *args):
        """"""
        if args:
            msg = msg % args
        self.logger.info(msg)
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))
1069669
private String formatLogString(Diagnostics diagnostics) {

    StringBuilder sb = new StringBuilder();
    sb.append(LOG_STRING_PREFIX).append(SEPARATOR);
    if (null != diagnostics.getId()) {
      sb.append("id=").append(diagnostics.getId()).append(SEPARATOR);
    }
    if (null != diagnostics.getTimestamp()) {
      sb.append("date=").append(formatter.format(new DateTime(diagnostics.getTimestamp()).toDate())).append(SEPARATOR);
    }
    if (null != diagnostics.getTag()) {
      sb.append("tag=").append(diagnostics.getTag()).append(SEPARATOR);
    }
    if (null != diagnostics.getInfo()) {
      sb.append("info=").append(diagnostics.getInfo()).append(SEPARATOR);
    }

    return sb.toString();
  }
1223865
public function formatMessage($level, string $message, array $context = array()):string
    {

        $dateTime = new \DateTime();
        $dateTime->setTimezone(static::timezone());
        return $dateTime->format('[c]')
            ." ".$this->getLogLevelName($level)
            ." @".$this->channel
            ." uid:".$this->uid
            ." - "
            .$message
            ." - "
            .json_encode($context);
    }