Hyperlinkv0.8.0-beta.28

LogEntry

LogEntry.fromLoggerOptionsconstsrc/LogEntry.ts:99
(options: {
  readonly message: unknown
  readonly logLevel: LogLevel
  readonly cause: Cause.Cause<unknown>
  readonly date: Date
  readonly annotations: Readonly<Record<string, unknown>>
  readonly spans: ReadonlyArray<
    readonly [label: string, startTime: number]
  >
}): LogEntry

Build a LogEntry from runtime logger options and fiber log context.

wire schemasLogEntry
Source src/LogEntry.ts:9922 lines
export const logEntryFromLoggerOptions = (options: {
  readonly message: unknown;
  readonly logLevel: LogLevel;
  readonly cause: Cause.Cause<unknown>;
  readonly date: Date;
  readonly annotations: Readonly<Record<string, unknown>>;
  readonly spans: ReadonlyArray<readonly [label: string, startTime: number]>;
}): LogEntry => ({
  date: options.date.toISOString(),
  level: options.logLevel,
  message: encodeMessage(options.message),
  ...(options.cause.reasons.length === 0
    ? {}
    : { cause: Cause.pretty(options.cause) }),
  annotations: Object.fromEntries(
    Object.entries(options.annotations).map(([key, value]) => [
      key,
      encodeAnnotationValue(value),
    ]),
  ),
  spans: options.spans.map(([label]) => label),
});