Format the given record into the desired trace format

@param genData GenericData pass information needed
@return String
548425
public String traceFormatGenData(GenericData genData) {

        KeyValuePair[] pairs = genData.getPairs();
        KeyValuePair kvp = null;
        String txt = null;
        Integer id = null;
        String objId;
        Integer levelVal = null;
        String name;

        String className = null;
        String method = null;
        String loggerName = null;
        Long ibm_datetime = null;

        String corrId = null;
        String org = null;
        String prod = null;
        String component = null;

        String sym = null;
        String logLevel = null;

        String threadName = null;
        String stackTrace = null;
        for (KeyValuePair p : pairs) {

            if (p != null && !p.isList()) {

                kvp = p;
                if (kvp.getKey().equals(LogFieldConstants.MESSAGE)) {
                    txt = kvp.getStringValue();
                } else if (kvp.getKey().equals(LogFieldConstants.IBM_DATETIME)) {
                    ibm_datetime = kvp.getLongValue();
                } else if (kvp.getKey().equals(LogFieldConstants.SEVERITY)) {
                    sym = " " + kvp.getStringValue() + " ";
                } else if (kvp.getKey().equals(LogFieldConstants.IBM_CLASSNAME)) {
                    className = kvp.getStringValue();
                } else if (kvp.getKey().equals(LogFieldConstants.IBM_METHODNAME)) {
                    method = kvp.getStringValue();
                } else if (kvp.getKey().equals(LogFieldConstants.MODULE)) {
                    loggerName = kvp.getStringValue();
                } else if (kvp.getKey().equals(LogFieldConstants.OBJECT_ID)) {
                    id = kvp.getIntValue();
                } else if (kvp.getKey().equals(LogFieldConstants.CORRELATION_ID)) {
                    corrId = kvp.getStringValue();
                } else if (kvp.getKey().equals(LogFieldConstants.ORG)) {
                    org = kvp.getStringValue();
                } else if (kvp.getKey().equals(LogFieldConstants.PRODUCT)) {
                    prod = kvp.getStringValue();
                } else if (kvp.getKey().equals(LogFieldConstants.COMPONENT)) {
                    component = kvp.getStringValue();
                } else if (kvp.getKey().equals(LogFieldConstants.LOGLEVEL)) {
                    logLevel = kvp.getStringValue();
                } else if (kvp.getKey().equals(LogFieldConstants.THREADNAME)) {
                    threadName = kvp.getStringValue();
                } else if (kvp.getKey().equals(LogFieldConstants.LEVELVALUE)) {
                    levelVal = kvp.getIntValue();
                } else if (kvp.getKey().equals(LogFieldConstants.THROWABLE)) {
                    stackTrace = kvp.getStringValue();
                }

            }
        }

        StringBuilder sb = new StringBuilder(256);

        // Common header
        sb.append('[').append(DateFormatHelper.formatTime(ibm_datetime, useIsoDateFormat)).append("] ");
        sb.append(DataFormatHelper.getThreadId());

        switch (traceFormat) {
            default:
            case ENHANCED:
                objId = generateObjectId(id, true);
                name = nonNullString(className, loggerName);

                sb.append(" id=").append(objId).append(' ');
                formatFixedString(sb, name, enhancedNameLength);
                sb.append(sym); // sym has built-in padding
                if (method != null) {
                    sb.append(method).append(' ');
                }

                // append formatted message -- txt includes formatted args
                sb.append(txt);
                if (stackTrace != null)
                    sb.append(LoggingConstants.nl).append(stackTrace);
                break;
            case BASIC:
                name = nonNullString(loggerName, className);

                sb.append(' '); // pad after thread id
                fixedClassString(sb, name, basicNameLength);
                sb.append(sym);

                if (className != null)
                    sb.append(className);
                sb.append(' '); // yes, this space is always there.

                if (method != null)
                    sb.append(method);
                sb.append(' '); // yes, this space is always there.

                // append formatted message -- includes formatted args
                sb.append(txt);
                if (stackTrace != null)
                    sb.append(nlBasicPadding).append(stackTrace);
                break;
            case ADVANCED:
                objId = generateObjectId(id, false);
                name = nonNullString(loggerName, null);

                sb.append(' '); // pad after thread id
                sb.append(sym);

                // next append the correlation id.
                sb.append("UOW=");
                if (corrId != null)
                    sb.append(corrId);

                // next enter the logger name.
                sb.append(" source=").append(name);

                // append className if non-null
                if (className != null)
                    sb.append(" class=").append(className);

                // append methodName if non-null
                if (method != null)
                    sb.append(" method=").append(method);

                if (id != null)
                    sb.append(" id=").append(objId);

                //check the comparison to WsLogRecord
                if (org != null && prod != null && component != null) {
                    // next append org, prod, component, if set. Reference equality check is ok here.
                    sb.append(" org=");
                    sb.append(org);
                    sb.append(" prod=");
                    sb.append(prod);
                    sb.append(" component=");
                    sb.append(component);

                    //get thread name
                } else {
                    //ibm_threadId replace check if you can use this as the thread
                    sb.append(" thread=[").append(threadName).append("]");
                }

                // append formatted message -- txt includes formatted args
                sb.append(nlAdvancedPadding).append(txt);
                if (stackTrace != null)
                    sb.append(nlAdvancedPadding).append(stackTrace);
                break;
        }
        return sb.toString();
    }
1319951
static Span toSpanProto(SpanData spanData) {
    SpanContext spanContext = spanData.getContext();
    TraceId traceId = spanContext.getTraceId();
    SpanId spanId = spanContext.getSpanId();
    Span.Builder spanBuilder =
        Span.newBuilder()
            .setTraceId(toByteString(traceId.getBytes()))
            .setSpanId(toByteString(spanId.getBytes()))
            .setTracestate(toTracestateProto(spanContext.getTracestate()))
            .setName(toTruncatableStringProto(spanData.getName()))
            .setStartTime(toTimestampProto(spanData.getStartTimestamp()))
            .setAttributes(toAttributesProto(spanData.getAttributes()))
            .setTimeEvents(
                toTimeEventsProto(spanData.getAnnotations(), spanData.getMessageEvents()))
            .setLinks(toLinksProto(spanData.getLinks()));

    Kind kind = spanData.getKind();
    if (kind != null) {
      spanBuilder.setKind(toSpanKindProto(kind));
    }

    io.opencensus.trace.Status status = spanData.getStatus();
    if (status != null) {
      spanBuilder.setStatus(toStatusProto(status));
    }

    Timestamp end = spanData.getEndTimestamp();
    if (end != null) {
      spanBuilder.setEndTime(toTimestampProto(end));
    }

    Integer childSpanCount = spanData.getChildSpanCount();
    if (childSpanCount != null) {
      spanBuilder.setChildSpanCount(UInt32Value.newBuilder().setValue(childSpanCount).build());
    }

    Boolean hasRemoteParent = spanData.getHasRemoteParent();
    if (hasRemoteParent != null) {
      spanBuilder.setSameProcessAsParentSpan(BoolValue.of(!hasRemoteParent));
    }

    SpanId parentSpanId = spanData.getParentSpanId();
    if (parentSpanId != null && parentSpanId.isValid()) {
      spanBuilder.setParentSpanId(toByteString(parentSpanId.getBytes()));
    }

    return spanBuilder.build();
  }
217428
@Override
  public String format(LogRecord record) {
    String msg = record.getMessage();
    if(msg.length() > 0) {
      if (record instanceof ProgressLogRecord) {
        return msg;
      }
      if(msg.endsWith(OutputStreamLogger.NEWLINE)) {
        return msg;
      }
    }
    return msg + OutputStreamLogger.NEWLINE;
  }
863758
public static function traceToString($trace)
    {
        if (!is_array($trace)) {
            return '';
        }

        $result = array();
        foreach ($trace as $index => $line) {
            if (isset($line['args']) && is_array($line['args'])) {
                $params = static::paramsToString($line['args']);
            } else {
                $params = '';
            }

            if (isset($line['file'])) {
                $result[] = sprintf(
                    "#%d %s:%d - %s(%s)", $index, $line['file'], $line['line'], $line['function'], $params
                );
            } else {
                $result[] = sprintf("#%d - %s(%s)", $index, $line['function'], $params);
            }
        }

        return implode(PHP_EOL, $result);
    }
839937
def format(self, record):
        """"""
        if record.levelno == logging.DEBUG:
            string = Back.WHITE + Fore.BLACK + ' debug '
        elif record.levelno == logging.INFO:
            string = Back.BLUE + Fore.WHITE + ' info '
        elif record.levelno == logging.WARNING:
            string = Back.YELLOW + Fore.BLACK + ' warning '
        elif record.levelno == logging.ERROR:
            string = Back.RED + Fore.WHITE + ' error '
        elif record.levelno == logging.CRITICAL:
            string = Back.BLACK + Fore.WHITE + ' critical '
        else:
            string = ''
        return '{none}{string}{none} {super}'.format(
            none=Style.RESET_ALL, string=string, super=super().format(record))
328981
public String format(LogRecord record) {
		line.setLength(0);
		line.append('[');
		line.append(Instant.ofEpochMilli(record.getMillis()).toString());

		final Level l = record.getLevel();
		line.append("] ");
		if (l == Level.SEVERE) {
			line.append(SEVERE);
		} else if (l == Level.WARNING) {
			line.append(WARNING);
		} else if (l == Level.INFO) {
			line.append(INFO);
		} else if (l == Level.CONFIG) {
			line.append(CONFIG);
		} else if (l == Level.FINE) {
			line.append(FINE);
		} else if (l == Level.FINER) {
			line.append(FINER);
		} else {
			line.append(FINEST);
		}

		String className = record.getSourceClassName();
		int n;
		if (className == null) {
			className = "unknown";
		} else {
			n = className.lastIndexOf('$');
			if (n > -1) {
				className = className.substring(0, n);
			}
		}
		line.append(className);
		n = line.length();
		if (n > position || position - n > 30) {
			position = n;
		}
		n = 1 + position - n;
		if (n > 0) {
			for (int i = 0; i < n; i++) {
				line.append(' ');
			}
		}
		line.append(formatMessage(record));
		line.append(BREAK);

		// Dump error
		final Throwable cause = record.getThrown();
		if (cause != null) {
			StringBuilder errors = new StringBuilder(256);
			n = appendMessages(errors, cause);
			String trace = errors.toString().trim();
			if (!trace.isEmpty()) {
				for (int i = 0; i < n; i++) {
					line.append('-');
				}
				line.append(BREAK);
				line.append(trace);
				line.append(BREAK);
				for (int i = 0; i < n; i++) {
					line.append('-');
				}
				line.append(BREAK);
			}
			line.append("Trace: ");
			line.append(cause.toString());
			line.append(BREAK);
			StackTraceElement[] array = cause.getStackTrace();
			if (array != null && array.length > 0) {
				for (n = 0; n < array.length; n++) {
					line.append("-> [");
					line.append(n);
					line.append("] ");
					line.append(array[n]);
					line.append(BREAK);
				}
			}
		}
		return line.toString();
	}
31619
public function format($templateData)
    {
        $viewer = SSViewer::execute_template(['type' => 'Includes', 'WorkflowDefinitionExport'], $templateData);
        // Temporary until we find the source of the replacement in SSViewer
        $processed = str_replace('&amp;', '&', $viewer);
        // Clean-up newline "gaps" that SSViewer leaves behind from the placement of template control structures
        return preg_replace("#^\R+|^[\t\s]*\R+#m", '', $processed);
    }
848773
@Override
	public String format(LogRecord record) {
		/*String loggerName = record.getLoggerName();
		if (loggerName == null) {
			loggerName = "root";
		}*/
		// .append(loggerName)
		return "[" +
				StringUtils.repeat(" ", 8 - record.getLevel().toString().length()) +
				record.getLevel() + '|' +
				StringUtils.repeat(" ", 12 - Thread.currentThread().getName().length()) +
				Thread.currentThread().getName() + '|' +
				format.format(new Date(record.getMillis())) +
				"]: " +
				record.getMessage() + ' ' +
				lineSep;
	}
240163
public static String getFormattedDate(final Long lastQueryDate, final String datePattern) {
        return formatDate(lastQueryDate, null, datePattern);
    }
55652
@Override
	public String formatRecord(RepositoryLogRecord record, Locale locale) {
		if (null == record) {
			throw new IllegalArgumentException("Record cannot be null");
		}

		return getFormattedRecord(record, locale);
	}
653754
def format(self, record):
        """"""
        format_orig = self._fmt
        self._fmt = self.get_level_fmt(record.levelno)
        record.prefix = self.prefix
        record.plugin_id = self.plugin_id
        result = logging.Formatter.format(self, record)
        self._fmt = format_orig
        return result
520949
protected function requireDefaultRecordFixture($defaultData)
    {
        $code = $defaultData['ErrorCode'];
        $page = ErrorPage::get()->filter('ErrorCode', $code)->first();
        $pageExists = !empty($page);
        if (!$pageExists) {
            $page = new ErrorPage($defaultData);
            $page->write();
            $page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
        }

        // Check if static files are enabled
        if (!self::config()->enable_static_file) {
            return;
        }

        // Ensure this page has cached error content
        $success = true;
        if (!$page->hasStaticPage()) {
            // Update static content
            $success = $page->writeStaticPage();
        } elseif ($pageExists) {
            // If page exists and already has content, no alteration_message is displayed
            return;
        }

        if ($success) {
            DB::alteration_message(
                sprintf('%s error page created', $code),
                'created'
            );
        } else {
            DB::alteration_message(
                sprintf('%s error page could not be created. Please check permissions', $code),
                'error'
            );
        }
    }
801956
@SuppressWarnings("unchecked")
    String getFormattedTabularData(TabularData td, String indent) {
        StringBuilder sb = new StringBuilder();
        indent += INDENT;

        sb.append("{");
        Collection<CompositeData> values = (Collection<CompositeData>) td.values();
        int valuesRemaining = values.size();
        for (CompositeData cd : values) {
            sb.append(getFormattedCompositeData(cd, indent));
            if (--valuesRemaining > 0) {
                sb.append("\n").append(indent).append("}, {");
            }
        }
        sb.append("}");

        return String.valueOf(sb);
    }
1350473
static String getSimpleFormat(boolean useProxy) {
        String format =
            AccessController.doPrivileged(
                new PrivilegedAction<String>() {
                    public String run() {
                        return System.getProperty(FORMAT_PROP_KEY);
                    }
                });

        if (useProxy && proxy != null && format == null) {
            format = proxy.getProperty(FORMAT_PROP_KEY);
        }

        if (format != null) {
            try {
                // validate the user-defined format string
                String.format(format, new Date(), "", "", "", "", "");
            } catch (IllegalArgumentException e) {
                // illegal syntax; fall back to the default format
                format = DEFAULT_FORMAT;
            }
        } else {
            format = DEFAULT_FORMAT;
        }
        return format;
    }
518417
private static StringBuilder formatMessage(LogData logData) {
    SimpleMessageFormatter formatter =
        new SimpleMessageFormatter(logData.getTemplateContext(), logData.getArguments());
    StringBuilder out = formatter.build();
    if (logData.getArguments().length > formatter.getExpectedArgumentCount()) {
      // TODO(dbeaumont): Do better and look at adding formatted values or maybe just a count?
      out.append(EXTRA_ARGUMENT_MESSAGE);
    }
    return out;
  }
786398
@Override
    public String format(AuditEvent event) {
        Map<String, Object> model = new HashMap<String, Object>();
        model.put("eventDate", event.getTimestamp());
        model.put("uuid", event.getUuid());
        model.put("action", event.getAction());
        model.put("origin", event.getOrigin());
        model.put("actor", event.getActor());
        model.put("fields", event.getFields());
        return engine.transform(template, model);
    }
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();
  }