Skip to content

Commit 5baadda

Browse files
committed
fixed logger in core
1 parent 9589bd7 commit 5baadda

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

core/lib_core.ssjs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*
2525
* @returns {string} The eventId for the error.
2626
*/
27-
function logError(o) {
27+
function logError(o) {
2828
var settings = new settings(),
2929
de = settings.de.logError.Name,
3030
name = [],
@@ -587,7 +587,8 @@ function isCustomerKey(str) { return RegExp('^[A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Z
587587
* @returns {object} Result of the request
588588
*/
589589
function httpRequest(method,url,contentType,payload,header) {
590-
var req = new Script.Util.HttpRequest(url);
590+
var log = log || new logger("httpRequest"),
591+
req = new Script.Util.HttpRequest(url);
591592
req.emptyContentHandling = 0;
592593
req.retries = 2;
593594
req.continueOnError = true;
@@ -599,7 +600,7 @@ function httpRequest(method,url,contentType,payload,header) {
599600
if(typeof payload !== 'undefined' && payload !== null) { req.postData = Platform.Function.Stringify(payload); }
600601

601602
try {
602-
log.debug('[httpRequest] - Request with method ['+method+'] on URL ['+url+']');
603+
log.trace('[httpRequest] - Request with method ['+method+'] on URL ['+url+']');
603604
var res = req.send();
604605

605606
return {
@@ -608,7 +609,7 @@ function httpRequest(method,url,contentType,payload,header) {
608609
};
609610

610611
} catch(e) {
611-
log.warn('[httpRequest] - Failed to do HTTP request on ['+url+']')
612+
log.trace('[httpRequest] - Failed to do HTTP request on ['+url+']')
612613
return {
613614
status: '500',
614615
content: e
@@ -767,7 +768,8 @@ function createAmpVariablesFromObject(ssjsObject,prefix,delimiter) {
767768
* %%=TreatAsContent(@githubContent)=%%
768769
*/
769770
function getGitHubRepoContent(obj) {
770-
var url = 'https://api.github.com/repos/'+ obj.username + '/' + obj.repoName + '/contents/' + obj.filePath,
771+
var log = log || new logger("getGitHubRepoContent"),
772+
url = 'https://api.github.com/repos/'+ obj.username + '/' + obj.repoName + '/contents/' + obj.filePath,
771773
header = {
772774
"Authorization": "Bearer " + obj.token,
773775
"User-Agent": obj.username + '/' + obj.repoName,

setup/setup.ssjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,12 @@
282282
// load library files from github
283283
var wrapper = '',
284284
files = {
285-
sfmcapi: libBaseUrl + 'core/lib_sfmcapi.ssjs',
286285
polyfill: libBaseUrl + 'core/lib_polyfill.ssjs',
287-
core: libBaseUrl + 'core/lib_core.ssjs',
286+
amp: libBaseUrl + 'core/lib_amp.ssjs',
288287
logger: libBaseUrl + 'core/lib_logger.ssjs',
288+
core: libBaseUrl + 'core/lib_core.ssjs',
289+
sfmcapi: libBaseUrl + 'core/lib_sfmcapi.ssjs',
289290
wsproxy: libBaseUrl + 'core/lib_wsproxy.ssjs',
290-
amp: libBaseUrl + 'core/lib_amp.ssjs',
291291
cloudpage: libBaseUrl + 'core/lib_cloudpage.ssjs',
292292
einstein: libBaseUrl + 'core/lib_einstein.ssjs',
293293
jwt: libBaseUrl + 'core/lib_jwt.ssjs'

0 commit comments

Comments
 (0)