formats a log message
@param $processId
@param $msg
@param $time
@return string
975761
public static function format($msg, $processId = false, $time = false, $flags = self::FLAG_NONE) {
        return "\n" . ($processId ? "$processId@" : "")
                    . date("Y-m-d H:i:s")
                    . ($time ? " (" . number_format(microtime(true) - $time, 2) . "s)" : "")
                    . ($flags | self::FLAG_MEMORY ? " (M: " . number_format(memory_get_usage()) . ")" : ""). " > $msg\n";
    }
512030
String formatMessage(int msgLogLevel, String tag, String msg, Throwable exception) {
        if (exception != null) {
            return DateHelper.getUTC(System.currentTimeMillis()) + "/" + getLevelTag(msgLogLevel) + tag + ": " + msg + "\n" + getStackTrace(exception) + "\n";
        } else {
            return DateHelper.getUTC(System.currentTimeMillis()) + "/" + getLevelTag(msgLogLevel) + tag + ": " + msg + "\n";
        }
    }
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))
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"
479304
public static function formatMS($time): string
    {
        $time = round($time * 1000, 3);
        $dec = 3;

        if (!$time || $time >= 10 || $time >= 100) {
            $dec = 0;
        } elseif ($time < 10 && $time >= 0.1) {
            $dec = 1;
        } elseif ($time <= 0.01) {
            $dec = 3;
        }

        return number_format($time, $dec, '.', ' ') . ' ms';
    }
1059548
public function formatLine($text, $level, $category, $timestamp)
	{
		return sprintf(
			"%-19s [%-7s] [%s]\n                    %s",
			Yii::$app->formatter->asDatetime($timestamp, 'php:d.m.Y H:i:s'),
			strtoupper(Logger::getLevelName($level)),
			$category,
			$text
		);
	}
7338
private function log($msg, $level = 'info') {
        static $logFile = null;
        if (is_null($logFile)) {
            $logDir = $this->appContext->getRuntimeDir() . '/log';
            if (!is_dir($logDir)) {
                mkdir($logDir, 0755, true);
            }
            $logFilePath = "$logDir/event-listend.log";
            $logFile = fopen($logFilePath, 'a');
        }

        $time = date('Y-m-d H:i:s');
        $logData = "[{$level}] [{$time}] {$msg}\n";
        fwrite($logFile, $logData);
    }
852265
function(msg, levelMsg) {
    if (console.isTimestamped()) {
        return "[" + levelMsg + " - " + new Date().toJSON() + "] " + msg;
    } else {
        return "[" + levelMsg + "] " + msg;
    }
}
1322470
public function messages($startTime, $endTime, int $msgId = 1, int $number = 10000)
    {
        $params = [
            'starttime' => is_numeric($startTime) ? $startTime : strtotime($startTime),
            'endtime' => is_numeric($endTime) ? $endTime : strtotime($endTime),
            'msgid' => $msgId,
            'number' => $number,
        ];

        return $this->httpPostJson('customservice/msgrecord/getmsglist', $params);
    }
676210
@Override
	public String formatLogMsg(LogEvent logEvent) {
		LogMessageType      messageInfo  = logEvent.getLogEntry().getMessageInfo();
		LogMetadataInfoType metadataInfo = logEvent.getLogEntry().getMetadataInfo();
		LogRuntimeInfoType  runtimeInfo  = logEvent.getLogEntry().getRuntimeInfo();

		String integrationScenarioId   = metadataInfo.getIntegrationScenarioId();
		String contractId              = metadataInfo.getContractId();
		String logMessage              = messageInfo.getMessage();
		String serviceImplementation   = metadataInfo.getServiceImplementation();
		String componentId             = runtimeInfo.getComponentId();
		String endpoint                = metadataInfo.getEndpoint();
		String messageId               = runtimeInfo.getMessageId();
		String businessCorrelationId   = runtimeInfo.getBusinessCorrelationId();
		String payload                 = logEvent.getLogEntry().getPayload();
		String businessContextIdString = businessContextIdToString(runtimeInfo.getBusinessContextId());
		String extraInfoString         = extraInfoToString(logEvent.getLogEntry().getExtraInfo());
		String logEventName            = "logEvent-" + messageInfo.getLevel().toString().toLowerCase();

		StringBuffer stackTrace = new StringBuffer();
		LogMessageExceptionType lmeException = logEvent.getLogEntry().getMessageInfo().getException();
		if (lmeException != null) {
			String ex = lmeException.getExceptionClass();
			String msg = lmeException.getExceptionMessage();
			List<String> st = lmeException.getStackTrace();

			stackTrace.append('\n').append("Stacktrace=").append(ex).append(": ").append(msg);
			for (String stLine : st) {
				if (stLine.startsWith(CAUSE_EXCEPTION_HEADER)) {
					stackTrace.append("\n\n").append(stLine);
					
				} else {
					stackTrace.append("\n\t at ").append(stLine);
				}
			}
		}
		return MessageFormatter.arrayFormat(LOG_STRING, new String[] {logEventName, integrationScenarioId, contractId, logMessage, serviceImplementation, runtimeInfo.getHostName(), runtimeInfo.getHostIp(), componentId, endpoint, messageId, businessCorrelationId, businessContextIdString, extraInfoString, payload, stackTrace.toString(), logEventName}).getMessage();
	}
1134009
function writeLog(level, msg) {
  var line;
  if(showSourceInfo) {
    var si = getSourceInfo();
    if (includeDate) {
      line = util.format("[%s] <%s>\t[%s:%s] %s", moment().format(), level, si.file, si.lineNumber, msg);
    } else {
      line = util.format("<%s>\t[%s:%s] %s", level, si.file, si.lineNumber, msg);
    }
  } else {
    if (includeDate) {
      line = util.format("[%s] <%s>\t%s", moment().format(), level, msg);
    } else {
      line = util.format("<%s>\t%s", level, msg);
    }
  }

  line += '\n';
  appenders.forEach(function(appender) {
    appender(level, line);
  });
}
1076237
protected function formatLog($level, $message, $context = array())
    {
        // Format message and content
        $params = $this->formatParams($message, $context);
        $message = $params['message'];
        $context = $params['context'];

        // Format log content
        $content = str_replace(array(
            '%datetime%', '%namespace%', '%level%', '%message%',
        ), array(
            date($this->dateFormat, microtime(true)),
            $this->namespace,
            strtoupper($level),
            $message,
        ), $this->format);

        // Format extra context
        if ($this->context || $context) {
            $content .= print_r($this->context + $context, true) . "\n";
        }

        return $content;
    }
532917
public function msg($msg)
    {
        $this->log .= date('Y-m-d H:i:s') . ' ' . $msg . "\n";

        if (php_sapi_name() === 'cli') {
            $this->cli->line($msg);
        } else {
            echo $msg . "<br/>\n";
        }
    }
78224
def format_message(severity, datetime, progname, msg)
      if String === msg then
        msg.inject('') { |s, line| s << super(severity, datetime, progname, line.chomp) }
      else
        super
      end
    end
171433
public function log($producer, $msg, $object = false) {
        if(!($this->acceptedProducers & $producer)) { return; }

        $msgFmt = self::format($msg, $this->processId, $this->time, $this->flags);
        if($object) {
            $msgFmt .= " " . json_encode($object);
        }
        $this->logRaw($msgFmt);
    }
628941
private function formatMessage($level, $message, $context)
    {
        $level = strtoupper($level);
        if (!empty($context)) {
            $message .= PHP_EOL . $this->indent($this->contextToString($context));
        }
        return "[{$this->getTimestamp()}] [{$level}] {$message}" . PHP_EOL;
    }
1023936
protected function formatMessage($message)
    {
        $traces = array();
        foreach ($this->getBacktrace() as $trace) {
            $traces[] = "in {$trace['file']}:{$trace['line']}";
        }

        $str = "[" . date('Y-m-d H:i:s', time()) . "]#" .  $this->getUserIp() . "# - " . $message;
        $str .= (empty($traces) ? '' : "\n    " . implode("\n    ", $traces));
        return $str;
    }