toMap method

Map<String, dynamic> toMap()

Converts the InfospectLog object into a Map representation.

Returns a Map with the following key-value pairs:

  • 'level': The name of the log level as a String.
  • 'timestamp': The timestamp when the log was created in milliseconds since epoch.
  • 'message': The log message as a String.
  • 'error': The error associated with the log as a String representation (if available).
  • 'stackTrace': The stack trace associated with the log as a String representation (if available).

Implementation

Map<String, dynamic> toMap() {
  Map<String, dynamic> map = <String, dynamic>{};
  map['level'] = level.name;
  map['timestamp'] = timestamp.millisecondsSinceEpoch.toString();
  map['message'] = message;
  map['error'] = error.toString();
  map['stackTrace'] = stackTrace.toString();
  return map;
}