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.6 to 0.1.7

.package.json.un~

2

index.js

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

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