|
| 1 | +import 'package:meta/meta.dart'; |
| 2 | + |
| 3 | +@Deprecated('Use SentryAttribute instead') |
| 4 | +class SentryLogAttribute extends SentryAttribute { |
| 5 | + SentryLogAttribute._(super.value, super.type); |
| 6 | + |
| 7 | + factory SentryLogAttribute.string(String value) { |
| 8 | + return SentryLogAttribute._(value, 'string'); |
| 9 | + } |
| 10 | + |
| 11 | + factory SentryLogAttribute.bool(bool value) { |
| 12 | + return SentryLogAttribute._(value, 'boolean'); |
| 13 | + } |
| 14 | + |
| 15 | + factory SentryLogAttribute.int(int value) { |
| 16 | + return SentryLogAttribute._(value, 'integer'); |
| 17 | + } |
| 18 | + |
| 19 | + factory SentryLogAttribute.double(double value) { |
| 20 | + return SentryLogAttribute._(value, 'double'); |
| 21 | + } |
| 22 | +} |
| 23 | + |
| 24 | +class SentryAttribute { |
| 25 | + @internal |
| 26 | + final String type; |
| 27 | + final dynamic value; |
| 28 | + |
| 29 | + @internal |
| 30 | + SentryAttribute(this.value, this.type); |
| 31 | + |
| 32 | + factory SentryAttribute.string(String value) { |
| 33 | + return SentryAttribute(value, 'string'); |
| 34 | + } |
| 35 | + |
| 36 | + factory SentryAttribute.bool(bool value) { |
| 37 | + return SentryAttribute(value, 'boolean'); |
| 38 | + } |
| 39 | + |
| 40 | + factory SentryAttribute.int(int value) { |
| 41 | + return SentryAttribute(value, 'integer'); |
| 42 | + } |
| 43 | + |
| 44 | + factory SentryAttribute.double(double value) { |
| 45 | + return SentryAttribute(value, 'double'); |
| 46 | + } |
| 47 | + |
| 48 | + Map<String, dynamic> toJson() { |
| 49 | + return { |
| 50 | + 'value': value, |
| 51 | + 'type': type, |
| 52 | + }; |
| 53 | + } |
| 54 | +} |
0 commit comments