Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ba-js-logger

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ba-js-logger - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

22

lib/logger.js

@@ -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"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc