Skip to content

Commit cc9c309

Browse files
committed
added logHandlers to all modules
1 parent f67f1ff commit cc9c309

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

src/core/lib/request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function fetchRetry(url, headers, fetchOptions, resolve, reject, retryDelay = 30
9292
fetchOptions.logHandler('info', { url: url, option: option});
9393
fetch(url, option)
9494
.then(function(response) {
95-
fetchOptions.logHandler('info', data);
95+
fetchOptions.logHandler('info', response);
9696
let data = response.json();
9797
if (response.ok && response.status === 200) {
9898
resolve(data);

src/core/modules/assets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default class Assets {
7575
this._query[key] = value;
7676
return this;
7777
} else {
78-
console.error("Kindly provide a valid parameters.");
78+
this.fetchOptions.logHandler('error',"Kindly provide a valid parameters.");
7979
}
8080
}
8181

src/core/modules/entry.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export default class Entry {
8383
this.queryCachePolicy = policy;
8484
}
8585
} else {
86-
console.error("Kindly provide the valid policy");
86+
this.fetchOptions.logHandler('error', "Kindly provide the valid policy");
8787
}
8888
return this;
8989
}
@@ -135,7 +135,7 @@ export default class Entry {
135135
}
136136
return this;
137137
} else {
138-
console.error("Argument should be a String or an Array.");
138+
this.fetchOptions.logHandler('error', "Argument should be a String or an Array.");
139139
}
140140
}
141141

@@ -160,7 +160,7 @@ export default class Entry {
160160
this._query['locale'] = language_code;
161161
return this;
162162
} else {
163-
console.error("Argument should be a String.");
163+
this.fetchOptions.logHandler('error', "Argument should be a String.");
164164
}
165165
}
166166

@@ -179,7 +179,7 @@ export default class Entry {
179179
this._query[key] = value;
180180
return this;
181181
} else {
182-
console.error("First argument should be a String.");
182+
this.fetchOptions.logHandler('error', "First argument should be a String.");
183183
}
184184
}
185185

@@ -323,7 +323,7 @@ export default class Entry {
323323
this._query[key] = value;
324324
return this;
325325
} else {
326-
console.error("Kindly provide valid parameters.");
326+
this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
327327
}
328328
}
329329

@@ -360,7 +360,7 @@ export default class Entry {
360360
var options = Utils.mergeDeep(this.fetchOptions, fetchOptions);
361361
return Utils.sendRequest(this, options);
362362
} else {
363-
console.error("Kindly provide an entry uid. e.g. .Entry('asset_uid')");
363+
this.fetchOptions.logHandler('error', "Kindly provide an entry uid. e.g. .Entry('asset_uid')");
364364
}
365365
}
366366
}

src/core/modules/query.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const _extend = {
99
this._query['query'][key][type] = value;
1010
return this;
1111
} else {
12-
console.error("Kindly provide valid parameters.");
12+
this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
1313
}
1414
};
1515
},
@@ -22,7 +22,7 @@ const _extend = {
2222
this._query['query'][key][type] = this._query['query'][key][type].concat(value);
2323
return this;
2424
} else {
25-
console.error("Kindly provide valid parameters.");
25+
this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
2626
}
2727
};
2828
},
@@ -33,7 +33,7 @@ const _extend = {
3333
this._query['query'][key]['$exists'] = bool;
3434
return this;
3535
} else {
36-
console.error("Kindly provide valid parameters.");
36+
this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
3737
}
3838
};
3939
},
@@ -61,7 +61,7 @@ const _extend = {
6161
this._query[type] = key;
6262
return this;
6363
} else {
64-
console.error("Argument should be a string.");
64+
this.fetchOptions.logHandler('error', "Argument should be a string.");
6565
}
6666
};
6767
},
@@ -71,7 +71,7 @@ const _extend = {
7171
this._query[type] = value;
7272
return this;
7373
} else {
74-
console.error("Argument should be a number.");
74+
this.fetchOptions.logHandler('error', "Argument should be a number.");
7575
}
7676
}
7777
}
@@ -395,7 +395,7 @@ export default class Query extends Entry {
395395

396396
return this;
397397
} else {
398-
console.error("Kindly provide valid parameters.");
398+
this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
399399
}
400400
}
401401

@@ -420,7 +420,7 @@ export default class Query extends Entry {
420420
this._query['query'][key] = value;
421421
return this;
422422
} else {
423-
console.error("Kindly provide valid parameters.");
423+
this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
424424
}
425425
}
426426

@@ -476,7 +476,7 @@ export default class Query extends Entry {
476476
this._query['query'] = Utils.mergeDeep(this._query['query'], query);
477477
return this;
478478
} else {
479-
console.error("Kindly provide valid parameters");
479+
this.fetchOptions.logHandler('error', "Kindly provide valid parameters");
480480
}
481481
}
482482

@@ -587,7 +587,7 @@ export default class Query extends Entry {
587587
this._query['tags'] = values;
588588
return this;
589589
} else {
590-
console.error("Kindly provide valid parameters");
590+
this.fetchOptions.logHandler('error', "Kindly provide valid parameters");
591591
}
592592
}
593593

@@ -651,7 +651,7 @@ export default class Query extends Entry {
651651
this._query[key] = value;
652652
return this;
653653
} else {
654-
console.error("Kindly provide valid parameters.");
654+
this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
655655
}
656656
}
657657

@@ -691,7 +691,7 @@ export default class Query extends Entry {
691691
if (options) this._query['query'][key]['$options'] = options;
692692
return this;
693693
} else {
694-
console.error("Kindly provide valid parameters.");
694+
this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
695695
}
696696
}
697697

@@ -717,7 +717,7 @@ export default class Query extends Entry {
717717
this._query['typeahead'] = value;
718718
return this;
719719
} else {
720-
console.error("Kindly provide valid parameters.");
720+
this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
721721
}
722722
}
723723

0 commit comments

Comments
 (0)