@@ -13,91 +13,94 @@ class Log {
13
13
];
14
14
15
15
static void log (
16
- dynamic text , {
16
+ String message , {
17
17
Object ? data,
18
18
bool disableLocalLogging = false ,
19
19
bool disableCloudLogging = false ,
20
20
}) {
21
21
if (_config.enableLocalLogs && ! disableLocalLogging) {
22
- Console .log (text. toString (), data);
22
+ Console .log (message, data : data);
23
23
}
24
24
if (_config.enableCloudLogs && ! disableCloudLogging) {
25
- _logEvent (text. toString () , data: data, type: EventType .log);
25
+ _logEvent (message , data: data, type: EventType .log);
26
26
}
27
27
}
28
28
29
29
static void info (
30
- dynamic text , {
30
+ String message , {
31
31
Object ? data,
32
32
bool disableLocalLogging = false ,
33
33
bool disableCloudLogging = false ,
34
34
}) {
35
35
if (_config.enableLocalLogs && ! disableLocalLogging) {
36
- Console .info (text. toString (), data);
36
+ Console .info (message, data : data);
37
37
}
38
38
if (_config.enableCloudLogs && ! disableCloudLogging) {
39
- _logEvent (text. toString () , data: data, type: EventType .info);
39
+ _logEvent (message , data: data, type: EventType .info);
40
40
}
41
41
}
42
42
43
43
static void success (
44
- dynamic text , {
44
+ String message , {
45
45
Object ? data,
46
46
bool disableLocalLogging = false ,
47
47
bool disableCloudLogging = false ,
48
48
}) {
49
49
if (_config.enableLocalLogs && ! disableLocalLogging) {
50
- Console .success (text. toString (), data);
50
+ Console .success (message, data : data);
51
51
}
52
52
if (_config.enableCloudLogs && ! disableCloudLogging) {
53
- _logEvent (text. toString () , data: data, type: EventType .success);
53
+ _logEvent (message , data: data, type: EventType .success);
54
54
}
55
55
}
56
56
57
57
static void warning (
58
- dynamic text , {
58
+ String message , {
59
59
Object ? data,
60
60
bool disableLocalLogging = false ,
61
61
bool disableCloudLogging = false ,
62
62
}) {
63
63
if (_config.enableLocalLogs && ! disableLocalLogging) {
64
- Console .warning (text. toString (), data);
64
+ Console .warning (message, data : data);
65
65
}
66
66
if (_config.enableCloudLogs && ! disableCloudLogging) {
67
- _logEvent (text. toString () , data: data, type: EventType .warning);
67
+ _logEvent (message , data: data, type: EventType .warning);
68
68
}
69
69
}
70
70
71
71
static void exception (
72
- dynamic throwable , {
73
- Object ? data ,
74
- dynamic stackTrace,
72
+ String message , {
73
+ Object ? throwable ,
74
+ StackTrace ? stackTrace,
75
75
dynamic hint,
76
76
bool disableLocalLogging = false ,
77
77
bool disableCloudLogging = false ,
78
78
}) {
79
79
if (_config.enableLocalLogs && ! disableLocalLogging) {
80
- Console .danger ('$throwable \n $hint ' , data);
80
+ Console .danger (
81
+ message,
82
+ throwable: throwable,
83
+ stackTrace: stackTrace,
84
+ hint: hint,
85
+ );
81
86
}
82
87
if (_config.enableCloudLogs && ! disableCloudLogging) {
83
- final hintWithData = {
84
- 'hint' : hint,
85
- 'data' : data,
86
- };
87
88
for (final service in _services) {
88
89
switch (service) {
89
90
case const (SentryLoggingService ):
90
91
SentryLoggingService .logException (
91
- throwable,
92
+ message,
93
+ throwable: throwable,
92
94
stackTrace: stackTrace,
93
- hint: hintWithData ,
95
+ hint: hint ,
94
96
);
95
97
return ;
96
98
case const (FirebaseLoggingService ):
97
99
FirebaseLoggingService .logException (
98
- throwable,
100
+ message,
101
+ throwable: throwable,
99
102
stackTrace: stackTrace,
100
- hint: hintWithData ,
103
+ hint: hint ,
101
104
);
102
105
return ;
103
106
default :
@@ -139,24 +142,24 @@ class Log {
139
142
}
140
143
141
144
static void _logEvent (
142
- String text , {
145
+ String message , {
143
146
Object ? data,
144
147
EventType ? type,
145
148
}) {
146
149
for (final service in _services) {
147
150
switch (service) {
148
151
case const (SentryLoggingService ):
149
152
SentryLoggingService .logEvent (
150
- message: text,
151
- level: type? .toSentryLevel,
153
+ message,
152
154
data: data,
155
+ level: type? .toSentryLevel,
153
156
);
154
157
return ;
155
158
case const (FirebaseLoggingService ):
156
159
FirebaseLoggingService .logEvent (
157
- message: text,
158
- type: type,
160
+ message,
159
161
data: data,
162
+ type: type,
160
163
);
161
164
return ;
162
165
default :
0 commit comments