LogEvent.fromJson constructor
LogEvent.fromJson(
- Map<String, dynamic> json
)
Implementation
factory LogEvent.fromJson(Map<String, dynamic> json) => LogEvent(
scope: json['scope'] as String? ?? '',
level: RpcLogLevel.values.firstWhere(
(e) => e.name == json['level'],
orElse: () => RpcLogLevel.info,
),
message: json['message'] as String? ?? '',
tag: json['tag'] as String?,
error: json['error'],
traceId: json['traceId'] as String?,
requestId: json['requestId'] as String?,
spanId: json['spanId'] as String?,
data: (json['data'] as Map<String, dynamic>?)?.cast<String, Object>(),
timestamp: json['timestamp'] != null
? DateTime.fromMillisecondsSinceEpoch(json['timestamp'] as int)
: null,
);