CompressibleLogEntry.fromJson constructor

CompressibleLogEntry.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory CompressibleLogEntry.fromJson(Map<String, dynamic> json) {
  return CompressibleLogEntry(
    id: json['id'] as String,
    timestamp: DateTime.parse(json['timestamp'] as String),
    level: LogLevel.values.firstWhere(
      (l) => l.name == json['level'],
      orElse: () => LogLevel.info,
    ),
    message: json['message'] as String,
    context: Map<String, dynamic>.from(json['context'] as Map),
    event: json['event'] != null
        ? LogEvent(
            eventName: json['event']['eventName'] as String? ?? '',
            eventMessage: json['event']['eventMessage'] as String? ?? '',
          )
        : null,
    source: json['source'] as String,
  );
}