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

logchop

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

logchop - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

index.js

@@ -1,1 +0,1 @@

(function(){function a(){var e=t.hrtime();return e[0]*1e9+e[1]}function f(){return l.now()*1e6}function h(e,t,n){arguments.length===2&&(n=t,t=o),c+=1,this.id=c,this.name=e,this.metadata=t,this._callback=n||function(){},this.started=(new Date).valueOf(),this._start=u(),this._callback(this)}function m(e,t,r){try{arguments.length===2&&(r=t,t=o);var i=n(t),s=p.parse(e),u={method:"POST",hostname:s.hostname,port:s.port,path:s.path},a=s.protocol.indexOf("https")===0?v:d,f=[],l=a.request(u,function(e){e.setEncoding("utf8"),e.on("data",function(e){f.push(e)}),e.on("end",function(){r(null,e,f.join(""))})});l.on("error",function(e){r(e)}),i&&(l.setHeader("Content-Type","application/json"),l.setHeader("Content-Length",i.length),l.write(i)),l.end()}catch(c){r(c)}}function g(e){function n(e){t.log("LogChop - "+e)}function E(){if(a.length<=f)return;g||(g={event:new h,count:0});var e=a.length-f;a=a.slice(e),g.count+=e,n("dropped "+e+" events")}function S(e,t,r){var i=t&&t.statusCode;e||i!==200?(n("communication error - "+(e||i)),a=l.concat(a)):g=null,p=!1,v()}var t=this,i;t.connect=function(){if(!e)return n("connection url missing");if(i)return;m(e,function(e,t,s){var o=e&&e.code===r,a=t&&t.statusCode;if(o)return u("refused");if(e)return u(e);if(!t)return u("no response");if(a!==200)return u(a+" error");try{eventUri=JSON.parse(s).uri}catch(f){return u("invalid connection response")}if(!eventUri)return u("invalid event uri");n("connected"),i=!0,v()})},t.upload=function(t){a.push(y(t)),b(t),v()},t.log=function(){};var s=0,o,u=function(e){o=o?o*1.7:5e3,s+=1;var r="connection failed ("+e+") ";return s>10?n(r+"exceeded max attempts"):(n(r+"reconnecting in "+Math.round(o/1e3)+" seconds"),setTimeout(t.connect,o))},a=[],f=1e4,l,c=100,p,d=1e3,v=w(function(){E();if(!i||p||!a.length)return;p=!0,l=a.slice(0,c),a=a.slice(c);var e=[];g&&(g.event.name="client dropped "+g.count+" events",g.event.stop(),e.push(y(g.event))),m(eventUri,e.concat(l),S)},d),g}function y(e){var t;try{e.metadata&&(t=n(e.metadata))}catch(r){t=n("Could not stringify metadata")}return{i:e.id,n:e.name,s:e.started,d:e.duration,p:e.parent,m:t}}function b(e){e.name=e.started=e.duration=e.parent=e.metadata=o}function w(e,t){function s(){i=null,e.apply(r,n)}var n,r,i;return function(){n=arguments,r=this,clearTimeout(i),i=setTimeout(s,t)}}var e=require,t=typeof process!="undefined"?process:{},n=JSON.stringify,r="ECONNREFUSED",i="production",s="undefined",o,u=t.hrtime?a:f,l={};typeof window!==s&&window.performance&&(l=window.performance),l.now=l.now||l.mozNow||l.msNow||l.oNow||l.webkitNow||function(){return(new Date).getTime()};var c=0;h.prototype.constructor=h,h.prototype.stop=function(){this.duration=u()-this._start,this._callback(this)},h.prototype.until=function(e,t){var n=this;return function(){n.stop(),e.apply(t,arguments)}};var p=e("url"),d=e("http"),v=e("https");g.prototype.constructor=g;var E=t.env||{},S=new g(E.LOGCHOP_URL);E.NODE_ENV!==i&&(S.log=console.log);var x=module.exports={};x.start=function(){S.connect()},x.event=function(e,t){return new h(e,t,S.upload)}})();
(function(){function f(){var e=t.hrtime();return e[0]*1e9+e[1]}function l(){return c.now()*1e6}function p(e,t,n){arguments.length===2&&(n=t,t=u),h+=1,this.id=h,this.name=e,this.metadata=t,this._callback=n||function(){},this.started=(new Date).valueOf(),this._start=a(),this._callback(this)}function g(e,t,r){try{arguments.length===2&&(r=t,t=u);var i=n(t),s=d.parse(e),o={method:"POST",hostname:s.hostname,port:s.port,path:s.path},a=s.protocol.indexOf("https")===0?m:v,f=[],l=a.request(o,function(e){e.setEncoding("utf8"),e.on("data",function(e){f.push(e)}),e.on("end",function(){r(null,e,f.join(""))})});l.on("error",function(e){r(e)}),i&&(l.setHeader("Content-Type","application/json"),l.setHeader("Content-Length",i.length),l.write(i)),l.end()}catch(c){r(c)}}function y(e){function n(e){t.log("LogChop - "+e)}function y(){if(a.length<=f)return;m||(m={event:new p,count:0});var e=a.length-f;a=a.slice(e),m.count+=e,n("dropped "+e+" events")}function S(e,t,r){var i=t&&t.statusCode;e||i!==200?(n("communication error - "+(e||i)),a=l.concat(a)):m=null,h=!1,v()}var t=this,i;t.connect=function(){if(!e)return n("connection url missing");if(i)return;g(e,function(e,t,s){var o=e&&e.code===r,a=t&&t.statusCode;if(o)return u("refused");if(e)return u(e);if(!t)return u("no response");if(a!==200)return u(a+" error");try{eventUri=JSON.parse(s).uri}catch(f){return u("invalid connection response")}if(!eventUri)return u("invalid event uri");n("connected"),i=!0,v()})},t.upload=function(t){a.push(b(t)),w(t),v()},t.log=function(){};var s=0,o,u=function(e){o=o?o*1.7:5e3,s+=1;var r="connection failed ("+e+") ";return s>10?n(r+"exceeded max attempts"):(n(r+"reconnecting in "+Math.round(o/1e3)+" seconds"),setTimeout(t.connect,o))},a=[],f=1e4,l,c=100,h,d=1e3,v=E(function(){y();if(!i||h||!a.length)return;h=!0,l=a.slice(0,c),a=a.slice(c);var e=[];m&&(m.event.name="client dropped "+m.count+" events",m.event.stop(),e.push(b(m.event))),g(eventUri,e.concat(l),S)},d),m}function b(e){var t;try{e.metadata&&(t=n(e.metadata))}catch(r){t=n("Could not stringify metadata")}return{i:e.id,n:e.name,s:e.started,d:e.duration,p:e.parent,m:t}}function w(e){e.name=e.started=e.duration=e.parent=e.metadata=u}function E(e,t){function s(){i=null,e.apply(r,n)}var n,r,i;return function(){n=arguments,r=this,clearTimeout(i),i=setTimeout(s,t)}}var e=require,t=typeof process!="undefined"?process:{},n=JSON.stringify,r="ECONNREFUSED",i="production",s="test",o="undefined",u,a=t.hrtime?f:l,c={};typeof window!==o&&window.performance&&(c=window.performance),c.now=c.now||c.mozNow||c.msNow||c.oNow||c.webkitNow||function(){return(new Date).getTime()};var h=0;p.prototype.constructor=p,p.prototype.stop=function(){this.duration=a()-this._start,this._callback(this)},p.prototype.until=function(e,t){var n=this;return function(){n.stop(),e.apply(t,arguments)}};var d=e("url"),v=e("http"),m=e("https");y.prototype.constructor=y;var S=t.env||{},x=new y(S.LOGCHOP_URL);S.NODE_ENV!==i&&S.NODE_ENV!==s&&(x.log=console.log);var T=module.exports={};T.start=function(){x.connect()},T.event=function(e,t){return new p(e,t,x.upload)}})();
{
"name": "logchop",
"version": "0.1.1",
"version": "0.1.2",
"description": "web app performance metrics logchop.com",

@@ -5,0 +5,0 @@ "main": "index.js",

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