@@ -76,8 +76,7 @@ exports.ProfileHelpers = (Base = Object) => class extends Base {
76
76
data = merge_modifiers ( data , modifiers ) ;
77
77
78
78
if ( this . config . debug ) {
79
- console . log ( `Sending the following data to Mixpanel (${ this . endpoint } ):` ) ;
80
- console . log ( data ) ;
79
+ this . mixpanel . config . logger . debug ( `Sending the following data to Mixpanel (${ this . endpoint } )` , { data } ) ;
81
80
}
82
81
83
82
this . mixpanel . send_request ( { method : "GET" , endpoint : this . endpoint , data } , callback ) ;
@@ -95,7 +94,7 @@ exports.ProfileHelpers = (Base = Object) => class extends Base {
95
94
data = merge_modifiers ( data , modifiers ) ;
96
95
97
96
if ( this . config . debug ) {
98
- console . log ( ` Deleting profile ${ JSON . stringify ( identifiers ) } ` ) ;
97
+ this . mixpanel . config . logger . debug ( ' Deleting profile' , { identifiers } ) ;
99
98
}
100
99
101
100
this . mixpanel . send_request ( { method : "GET" , endpoint : this . endpoint , data } , callback ) ;
@@ -106,7 +105,7 @@ exports.ProfileHelpers = (Base = Object) => class extends Base {
106
105
107
106
if ( typeof ( data ) !== 'object' || util . isArray ( data ) ) {
108
107
if ( this . config . debug ) {
109
- console . error ( "Invalid value passed to #remove - data must be an object with scalar values" ) ;
108
+ this . mixpanel . config . logger . error ( "Invalid value passed to #remove - data must be an object with scalar values" ) ;
110
109
}
111
110
return ;
112
111
}
@@ -116,8 +115,10 @@ exports.ProfileHelpers = (Base = Object) => class extends Base {
116
115
$remove [ key ] = val ;
117
116
} else {
118
117
if ( this . config . debug ) {
119
- console . error ( "Invalid argument passed to #remove - values must be scalar" ) ;
120
- console . error ( "Passed " + key + ':' , val ) ;
118
+ this . mixpanel . config . logger . error (
119
+ "Invalid argument passed to #remove - values must be scalar" ,
120
+ { key, value : val }
121
+ ) ;
121
122
}
122
123
return ;
123
124
}
@@ -140,8 +141,10 @@ exports.ProfileHelpers = (Base = Object) => class extends Base {
140
141
data = merge_modifiers ( data , modifiers ) ;
141
142
142
143
if ( this . config . debug ) {
143
- console . log ( `Sending the following data to Mixpanel (${ this . endpoint } ):` ) ;
144
- console . log ( data ) ;
144
+ this . mixpanel . config . logger . debug (
145
+ `Sending the following data to Mixpanel (${ this . endpoint } )` ,
146
+ { data }
147
+ ) ;
145
148
}
146
149
147
150
this . mixpanel . send_request ( { method : "GET" , endpoint : this . endpoint , data } , callback ) ;
@@ -152,7 +155,7 @@ exports.ProfileHelpers = (Base = Object) => class extends Base {
152
155
153
156
if ( typeof ( data ) !== 'object' || util . isArray ( data ) ) {
154
157
if ( this . config . debug ) {
155
- console . error ( "Invalid value passed to #union - data must be an object with scalar or array values" ) ;
158
+ this . mixpanel . config . logger . error ( "Invalid value passed to #union - data must be an object with scalar or array values" ) ;
156
159
}
157
160
return ;
158
161
}
@@ -169,8 +172,10 @@ exports.ProfileHelpers = (Base = Object) => class extends Base {
169
172
$union [ key ] = [ val ] ;
170
173
} else {
171
174
if ( this . config . debug ) {
172
- console . error ( "Invalid argument passed to #union - values must be a scalar value or array" ) ;
173
- console . error ( "Passed " + key + ':' , val ) ;
175
+ this . mixpanel . config . logger . error (
176
+ "Invalid argument passed to #union - values must be a scalar value or array" ,
177
+ { key, value : val }
178
+ ) ;
174
179
}
175
180
}
176
181
}
@@ -192,8 +197,10 @@ exports.ProfileHelpers = (Base = Object) => class extends Base {
192
197
data = merge_modifiers ( data , modifiers ) ;
193
198
194
199
if ( this . config . debug ) {
195
- console . log ( `Sending the following data to Mixpanel (${ this . endpoint } ):` ) ;
196
- console . log ( data ) ;
200
+ this . mixpanel . config . logger . debug (
201
+ `Sending the following data to Mixpanel (${ this . endpoint } )` ,
202
+ { data }
203
+ ) ;
197
204
}
198
205
199
206
this . mixpanel . send_request ( { method : "GET" , endpoint : this . endpoint , data } , callback ) ;
@@ -208,8 +215,10 @@ exports.ProfileHelpers = (Base = Object) => class extends Base {
208
215
$unset = [ prop ] ;
209
216
} else {
210
217
if ( this . config . debug ) {
211
- console . error ( "Invalid argument passed to #unset - must be a string or array" ) ;
212
- console . error ( "Passed: " + prop ) ;
218
+ this . mixpanel . config . logger . error (
219
+ "Invalid argument passed to #unset - must be a string or array" ,
220
+ { prop }
221
+ ) ;
213
222
}
214
223
return ;
215
224
}
@@ -227,8 +236,10 @@ exports.ProfileHelpers = (Base = Object) => class extends Base {
227
236
data = merge_modifiers ( data , modifiers ) ;
228
237
229
238
if ( this . config . debug ) {
230
- console . log ( `Sending the following data to Mixpanel (${ this . endpoint } ):` ) ;
231
- console . log ( data ) ;
239
+ this . mixpanel . config . logger . debug (
240
+ `Sending the following data to Mixpanel (${ this . endpoint } )` ,
241
+ { data }
242
+ ) ;
232
243
}
233
244
234
245
this . mixpanel . send_request ( { method : "GET" , endpoint : this . endpoint , data } , callback ) ;
0 commit comments