ba-js-logger
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -5,2 +5,4 @@ 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; }; }(); | ||
import axios from 'axios'; | ||
var Logger = function () { | ||
@@ -42,5 +44,8 @@ _createClass(Logger, null, [{ | ||
_createClass(Logger, [{ | ||
key: 'createRequest', | ||
value: function createRequest(message, level, logger) { | ||
key: 'postRequest', | ||
value: function postRequest(message, level, logger) { | ||
var endpoint = this.url + '/' + level; | ||
if (process.env.NODE_ENV !== 'production') { | ||
endpoint = 'http://localhost:8080' + endpoint; | ||
} | ||
if (logger) { | ||
@@ -51,9 +56,6 @@ endpoint += '/l' + logger; | ||
var stamp = ' [ua: ' + navigator.userAgent + '] [platform: ' + navigator.platform + '] [cookie: ' + document.cookie + ']'; | ||
return new Request(endpoint, { | ||
method: 'POST', | ||
body: JSON.stringify({ | ||
context: this.context, | ||
message: '' + message + stamp | ||
}) | ||
}); | ||
var params = new URLSearchParams(); | ||
params.append('context', this.context); | ||
params.append('message', '' + message + stamp); | ||
return axios.post(endpoint, params); | ||
} | ||
@@ -63,3 +65,3 @@ }, { | ||
value: function send(message, level, logger) { | ||
return fetch(this.createRequest(message, level, logger)); | ||
return this.postRequest(message, level, logger); | ||
} | ||
@@ -66,0 +68,0 @@ }, { |
{ | ||
"scripts": { | ||
"build": "rimraf lib && babel src --out-dir lib", | ||
"build:dev": "babel src --out-dir lib", | ||
"prepublishOnly": "yarn build", | ||
@@ -16,3 +17,3 @@ "precommit": "lint-staged", | ||
"name": "ba-js-logger", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"files": [ | ||
@@ -43,5 +44,8 @@ "lib/" | ||
"node-fetch": "^1.7.2", | ||
"prettier": "^1.6.1", | ||
"prettier": "^1.10.2", | ||
"rimraf": "^2.6.1" | ||
}, | ||
"peerDependencies": { | ||
"axios": "^0.17.1" | ||
} | ||
} |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
4185
86
0
1
2