LogEntry.fromJson constructor

LogEntry.fromJson(
  1. Object? j
)

Implementation

factory LogEntry.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return LogEntry(
    logName: switch (json['logName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    resource: switch (json['resource']) {
      null => null,
      Object $1 => MonitoredResource.fromJson($1),
    },
    protoPayload: switch (json['protoPayload']) {
      null => null,
      Object $1 => Any.fromJson($1),
    },
    textPayload: switch (json['textPayload']) {
      null => null,
      Object $1 => decodeString($1),
    },
    jsonPayload: switch (json['jsonPayload']) {
      null => null,
      Object $1 => Struct.fromJson($1),
    },
    timestamp: switch (json['timestamp']) {
      null => null,
      Object $1 => Timestamp.fromJson($1),
    },
    receiveTimestamp: switch (json['receiveTimestamp']) {
      null => null,
      Object $1 => Timestamp.fromJson($1),
    },
    severity: switch (json['severity']) {
      null => logging_type.LogSeverity.$default,
      Object $1 => logging_type.LogSeverity.fromJson($1),
    },
    insertId: switch (json['insertId']) {
      null => '',
      Object $1 => decodeString($1),
    },
    httpRequest: switch (json['httpRequest']) {
      null => null,
      Object $1 => logging_type.HttpRequest.fromJson($1),
    },
    labels: switch (json['labels']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"labels" is not an object'),
    },
    operation: switch (json['operation']) {
      null => null,
      Object $1 => LogEntryOperation.fromJson($1),
    },
    trace: switch (json['trace']) {
      null => '',
      Object $1 => decodeString($1),
    },
    spanId: switch (json['spanId']) {
      null => '',
      Object $1 => decodeString($1),
    },
    traceSampled: switch (json['traceSampled']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    sourceLocation: switch (json['sourceLocation']) {
      null => null,
      Object $1 => LogEntrySourceLocation.fromJson($1),
    },
    split: switch (json['split']) {
      null => null,
      Object $1 => LogSplit.fromJson($1),
    },
  );
}