Skip to content

Commit

Permalink
Implement Diagnosticable for Log
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasWanke committed Feb 17, 2023
1 parent f783bb6 commit 21a96cb
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/src/helpers/logs/data.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/foundation.dart';

@immutable
class Log {
class Log with Diagnosticable {
Log({
this.level = DiagnosticLevel.info,
DateTime? timestamp,
Expand All @@ -24,7 +24,6 @@ class Log {

@override
int get hashCode => Object.hash(level, timestamp, message, error, stackTrace);

@override
bool operator ==(Object other) {
return other is Log &&
Expand All @@ -34,6 +33,16 @@ class Log {
error == other.error &&
stackTrace == other.stackTrace;
}

@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(EnumProperty('level', level));
properties.add(DiagnosticsProperty('timestamp', timestamp));
properties.add(StringProperty('message', message));
properties.add(DiagnosticsProperty('error', error));
properties.add(DiagnosticsProperty('stackTrace', stackTrace));
}
}

class LogCollection {
Expand Down

0 comments on commit 21a96cb

Please sign in to comment.