ba-js-logger
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -58,3 +58,7 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
key: 'postRequest', | ||
value: function postRequest(message, level, logger) { | ||
value: function postRequest(message) { | ||
var headers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var level = arguments[2]; | ||
var logger = arguments[3]; | ||
var endpoint = this.url + '/' + level; | ||
@@ -69,9 +73,14 @@ if (logger) { | ||
params.append('message', '' + message + stamp); | ||
return axios.post(endpoint, params); | ||
return axios({ | ||
url: endpoint, | ||
method: 'post', | ||
headers: headers, | ||
data: params | ||
}); | ||
} | ||
}, { | ||
key: 'send', | ||
value: function send(message, level, logger) { | ||
value: function send(message, headers, level, logger) { | ||
if (Logger.LEVEL(level) >= this.lvl) { | ||
return this.postRequest(message, level, logger); | ||
return this.postRequest(message, headers, level, logger); | ||
} | ||
@@ -82,24 +91,24 @@ return Promise.resolve(); | ||
key: 'debug', | ||
value: function debug(message, logger) { | ||
return this.send(message, Logger.LEVEL_DEBUG, logger); | ||
value: function debug(message, headers, logger) { | ||
return this.send(message, headers, Logger.LEVEL_DEBUG, logger); | ||
} | ||
}, { | ||
key: 'info', | ||
value: function info(message, logger) { | ||
return this.send(message, Logger.LEVEL_INFO, logger); | ||
value: function info(message, headers, logger) { | ||
return this.send(message, headers, Logger.LEVEL_INFO, logger); | ||
} | ||
}, { | ||
key: 'warn', | ||
value: function warn(message, logger) { | ||
return this.send(message, Logger.LEVEL_WARN, logger); | ||
value: function warn(message, headers, logger) { | ||
return this.send(message, headers, Logger.LEVEL_WARN, logger); | ||
} | ||
}, { | ||
key: 'error', | ||
value: function error(message, logger) { | ||
return this.send(message, Logger.LEVEL_ERROR, logger); | ||
value: function error(message, headers, logger) { | ||
return this.send(message, headers, Logger.LEVEL_ERROR, logger); | ||
} | ||
}, { | ||
key: 'fatal', | ||
value: function fatal(message, logger) { | ||
return this.send(message, Logger.LEVEL_FATAL, logger); | ||
value: function fatal(message, headers, logger) { | ||
return this.send(message, headers, Logger.LEVEL_FATAL, logger); | ||
} | ||
@@ -106,0 +115,0 @@ }]); |
@@ -17,3 +17,3 @@ { | ||
"name": "ba-js-logger", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"files": [ | ||
@@ -20,0 +20,0 @@ "lib/" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4834
108