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

@lskjs/log

Package Overview
Dependencies
Maintainers
11
Versions
260
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lskjs/log - npm Package Compare versions

Comparing version 3.11.0 to 3.11.1

2

lib/pretty/prettyRawLog.js

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

"use strict";var pt=Object.create;var g=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var yt=Object.getPrototypeOf,xt=Object.prototype.hasOwnProperty;var o=(t,r)=>g(t,"name",{value:r,configurable:!0});var I=(t,r)=>{for(var e in r)g(t,e,{get:r[e],enumerable:!0})},y=(t,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of dt(r))!xt.call(t,s)&&s!==e&&g(t,s,{get:()=>r[s],enumerable:!(n=ht(r,s))||n.enumerable});return t},x=(t,r,e)=>(y(t,r,"default"),e&&y(e,r,"default")),L=(t,r,e)=>(e=t!=null?pt(yt(t)):{},y(r||!t||!t.__esModule?g(e,"default",{value:t,enumerable:!0}):e,t)),Lt=t=>y(g({},"__esModule",{value:!0}),t);var Gt={};I(Gt,{default:()=>Dt,prettyRawLog:()=>ot});module.exports=Lt(Gt);var et=require("@lskjs/env");var O=require("@lskjs/algos");var bt=require("logfmt"),N=o((t,r=t)=>{try{if(typeof t!="string")return t;if(!t.trim())return r;let e=bt.parse(t);return Object.keys(e).includes("")||Object.keys(e).length<2||(0,O.count)(e,n=>n===!0)>=Object.keys(e).length/2?r:e}catch{return r}},"tryLogfmtParse");var i;(function(t){t.bunyan="bunyan",t.lsklog="lsklog",t.lsklogweb="lsklogweb",t.logrus="logrus",t.raw="raw"})(i||(i={}));var k=require("@lskjs/err");var m={};I(m,{default:()=>$.default,stringify:()=>b.default});x(m,require("fast-safe-stringify"));var b=L(require("fast-safe-stringify")),$=L(require("fast-safe-stringify"));var Ot=require("@lskjs/algos");var T={fatal:["bgRed"],error:["bold","bgRed"],warn:["bgYellow"],debug:["bold","cyan"],info:["bold","green"],trace:["gray"],log:["bgWhite"]},w=[["red"],["green"],["yellow"],["blue"],["magenta"],["cyan"],["bold","red"],["bold","green"],["bold","yellow"],["bold","blue"],["bold","magenta"],["bold","cyan"]],S=[["bold","white"],["bold","cyan"],["bold","green"],["white"]];var vt=require("@lskjs/algos"),_=require("@lskjs/env");var z=require("@lskjs/env");var c=o((t,r)=>{let e=[];return t!==null&&e.push((0,z.tryJSONparse)(t)),Object.keys(r).length&&e.push(r),e},"parseArgs");var D=["trace","debug","info","warn","error","fatal"];var G=o(t=>!!(D.includes(t.level)&&t.ns),"isLsklog"),B=o(t=>!!D.includes(t.level),"isLskLikelog"),u=o(t=>!!(t&&(t.name==="req"||t.method&&t.host&&t.url)),"isLsklogWeb"),E=o(t=>!!(u(t)&&(t.status||t.duration||t.length)),"isLsklogWebFinal"),C=o(t=>{let{level:r,time:e,msg:n,ns:s,name:l,...a}=t,f={level:r,time:e,msg:n,ns:s,name:l};if(!u(t))return{format:i.lsklogweb,meta:f,args:c(n,a)};let{reqId:nt,method:st,host:it,ua:lt,ip:at,url:ft,status:ct,length:ut,duration:mt,...gt}=a;return{format:i.lsklog,meta:{...f,method:st,host:it,reqId:nt,ua:lt,ip:at,url:ft,status:ct,duration:mt,length:ut},args:c(n,gt)}},"parseLsklog");var V=require("@lskjs/colors"),J=require("@lskjs/env"),Y=L(require("pretty-bytes")),H=L(require("pretty-time"));var R=require("@lskjs/colors");var F=o(t=>typeof t=="number"?t:Math.abs(String(t).split("").reduce((r,e)=>{let n=(r<<5)-r+e.charCodeAt(0);return n&n},0)-48),"hashCode"),U=F;function W(t,r){let e=w[U(r||"")%w.length]||[];return(0,R.colorize)(t,e)}o(W,"themeizeRandom");function p(t,r){let e=r?T[r]:[];return(0,R.colorize)(t,e)}o(p,"themeize");var kt=(0,J.getEnvVar)("LOG_VIEW","short"),h=o((t,r)=>String(t).padStart(r),"leftPad"),wt=o((t,r)=>String(t).padEnd(r),"rightPad"),M=20,St=o((t,r=0)=>(M=Math.max(t&&t.length||0,M,r),wt(t,M)),"prettyPath"),Q=o(t=>t>=500?"error":t>=400?"warn":t>=300?"debug":null,"getStatusLevel"),_t=o(t=>{let r=Q(t);return r||(r=t!==200?"log":null),p(h(String(t),3),r)},"prettyStatus"),Bt=o(t=>h(`#${t}`,3),"prettyReqId"),Et=o(t=>{let r=t==="REMOVE"?"error":t==="WS"?"debug":null;return p(h(t,4),r)},"prettyMethod"),Ct=o((t,r="")=>{if(!Number.isFinite(t))return null;let e=t>=10*1e3?"error":t>=3*1e3?"warn":null,s=["m","s","ms"].includes(r)?r:"",l=Math.floor(Math.abs(t)*10**6),a=(0,H.default)(l,s);return p(h(a,5),e)},"prettyTime"),Ft=o((t,r="")=>{if(!Number.isFinite(t))return null;let e=(0,Y.default)(t,{maximumFractionDigits:1}).split(" "),n=e[1];return`${+e[0]>=100?Math.round(+e[0]):+e[0]}${r}${n}`},"prettySize"),X=o((t,r)=>[...t,r].filter(Boolean).map(String).map(n=>W(n,n)).join(":"),"prettyNs");function Rt(t){let r=["\u25CB","\u2022","\u2660","\u2660","\u2666","\u2665","\u263C","\u2642","\u2640","\u266A","\xA7"],e=r[F(t)%r.length];return W(e,String(t))}o(Rt,"prettyMarker");var P=o(t=>{let r=kt==="short"?(t[0]||"").toLowerCase():h(t,5);return r=`[${r}]`,p(r,t)},"prettyLevel"),Wt=/\[[^"\]]+]/gm,Z=o((...t)=>{let r=[];return t.forEach(e=>{if(typeof e=="string"){let n=0;r.push(e.replace(Wt,s=>(0,V.colorize)(s,S[n++%S.length])))}else r.push(e)}),r},"prettyContent"),Mt=o(t=>Q(t.status)||E(t)?"debug":"trace","getUrlLevel"),K=o(t=>{let r=E(t),e=Mt(t);return[P(e),[Rt(t.reqId),Et(t.method)].join(""),St(t.url),Bt(t.reqId),r&&t.method!=="WS"?_t(t.status):null,!r&&"\u29D7\u29D6\u29D7",r&&Ct(t.duration),r&&t.method!=="WS"?Ft(t.length):null].filter(Boolean).join(" ")},"prettyUrl");function Pt(t,r){let e=0;return t.forEach((n,s)=>{s===e&&r(n)&&(e+=1)}),e}o(Pt,"countInRow");function At(...t){let r=Pt(t,e=>typeof e=="string");return[t.slice(0,r).join(" "),...t.slice(r)]}o(At,"concatFirstStrings");function d(t,...r){let e=t?.ns,n=t?.name,s=t?.level||"log",l=r;if(u(t))return[K(t)];let a=(e||"").split(":").filter(Boolean).map(String),f=[P(s)];return(a.length||n)&&f.push(X(a,n)),At(...f,...Z(...l))}o(d,"prettyFormat");var Nt={10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"};var j=o(t=>!!(t.name&&t.hostname&&t.pid&&t.msg&&t.time),"isBunyan"),q=o(t=>{let{level:r,time:e,msg:n,hostname:s,pid:l,v:a,...f}=t;return{format:i.bunyan,meta:{level:Nt[r],time:new Date(e)},args:c(n,f)}},"parseBunyan");var $t=["trace","debug","info","warning","error","fatal","panic"],Tt={trace:"trace",debug:"debug",info:"info",warning:"warn",error:"error",fatal:"fatal",panic:"fatal"};var A=o(t=>!!(t.msg&&$t.includes(t.level)),"isLogrus"),tt=o(t=>{let{level:r,time:e,msg:n,...s}=t;return{format:i.logrus,meta:{level:Tt[r],time:new Date(e)},args:c(n,s)}},"parseLogrus");function zt(t){return j(t)?i.bunyan:G(t)?i.lsklog:u(t)?i.lsklogweb:A(t)&&B(t)&&t?.name?i.lsklog:A(t)?i.logrus:B(t)?i.lsklog:null}o(zt,"detectFormat");function rt(t){let r=zt(t);return r==="bunyan"?q(t):r==="lsklogweb"?C(t):r==="lsklog"?C(t):r==="logrus"?tt(t):{format:r,meta:{},args:[t]}}o(rt,"parse");var ot=o((t,r)=>{let e,n;if(typeof r=="string"&&(!e&&r.trim()&&(e=(0,et.tryJSONparse)(r,null),e!==null&&(n="json")),!e&&r.trim()&&(e=N(r,null),e!==null&&(n="logfmt"))),e===null&&(e=null,n="raw"),!e){t.log(...d({},r));return}if(typeof e!="object"){t.log(...d({},e));return}let{meta:s,args:l=[]}=rt(e);t.log(...d(s,...l))},"prettyRawLog"),Dt=ot;0&&(module.exports={prettyRawLog});
"use strict";var gt=Object.create;var p=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var yt=Object.getPrototypeOf,xt=Object.prototype.hasOwnProperty;var o=(t,r)=>p(t,"name",{value:r,configurable:!0});var I=(t,r)=>{for(var e in r)p(t,e,{get:r[e],enumerable:!0})},y=(t,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of dt(r))!xt.call(t,s)&&s!==e&&p(t,s,{get:()=>r[s],enumerable:!(n=ht(r,s))||n.enumerable});return t},x=(t,r,e)=>(y(t,r,"default"),e&&y(e,r,"default")),L=(t,r,e)=>(e=t!=null?gt(yt(t)):{},y(r||!t||!t.__esModule?p(e,"default",{value:t,enumerable:!0}):e,t)),Lt=t=>y(p({},"__esModule",{value:!0}),t);var Gt={};I(Gt,{default:()=>Dt,prettyRawLog:()=>ot});module.exports=Lt(Gt);var et=require("@lskjs/env");var O=require("@lskjs/algos");var bt=require("logfmt"),N=o((t,r=t)=>{try{if(typeof t!="string")return t;if(!t.trim())return r;let e=bt.parse(t);return Object.keys(e).includes("")||Object.keys(e).length<2||(0,O.count)(e,n=>n===!0)>=Object.keys(e).length/2?r:e}catch{return r}},"tryLogfmtParse");var i;(function(t){t.bunyan="bunyan",t.lsklog="lsklog",t.lsklogweb="lsklogweb",t.logrus="logrus",t.raw="raw"})(i||(i={}));var k=require("@lskjs/err");var m={};I(m,{default:()=>$.default,stringify:()=>b.default});x(m,require("fast-safe-stringify"));var b=L(require("fast-safe-stringify")),$=L(require("fast-safe-stringify"));var Ot=require("@lskjs/algos");var T={fatal:["bgRed"],error:["bold","bgRed"],warn:["bgYellow"],debug:["bold","cyan"],info:["bold","green"],trace:["gray"],log:["bgWhite"]},w=[["red"],["green"],["yellow"],["blue"],["magenta"],["cyan"],["bold","red"],["bold","green"],["bold","yellow"],["bold","blue"],["bold","magenta"],["bold","cyan"]],S=[["bold","white"],["bold","cyan"],["bold","green"],["white"]];var vt=require("@lskjs/algos"),_=require("@lskjs/env");var z=require("@lskjs/env");var c=o((t,r)=>{let e=[];return t!==null&&e.push((0,z.tryJSONparse)(t)),Object.keys(r).length&&e.push(r),e},"parseArgs");var D=["trace","debug","info","warn","error","fatal"];var G=o(t=>!!(D.includes(t.level)&&t.ns),"isLsklog"),B=o(t=>!!D.includes(t.level),"isLskLikelog"),u=o(t=>!!(t&&(t.name==="req"||t.method&&t.host&&t.url)),"isLsklogWeb"),E=o(t=>!!(u(t)&&(t.status||t.duration||t.length)),"isLsklogWebFinal"),C=o(t=>{let{level:r,time:e,msg:n,ns:s,name:l,...a}=t,f={level:r,time:e,msg:n,ns:s,name:l};if(!u(t))return{format:i.lsklogweb,meta:f,args:c(n,a)};let{reqId:nt,method:st,host:it,ua:lt,ip:at,url:ft,status:ct,length:ut,duration:mt,...pt}=a;return{format:i.lsklog,meta:{...f,method:st,host:it,reqId:nt,ua:lt,ip:at,url:ft,status:ct,duration:mt,length:ut},args:c(n,pt)}},"parseLsklog");var V=require("@lskjs/colors"),J=require("@lskjs/env"),Y=L(require("pretty-bytes")),H=L(require("pretty-time"));var R=require("@lskjs/colors");var F=o(t=>typeof t=="number"?t:Math.abs(String(t).split("").reduce((r,e)=>{let n=(r<<5)-r+e.charCodeAt(0);return n&n},0)-48),"hashCode"),U=F;function W(t,r){let e=w[U(r||"")%w.length]||[];return(0,R.colorize)(t,e)}o(W,"themeizeRandom");function g(t,r){let e=r?T[r]:[];return(0,R.colorize)(t,e)}o(g,"themeize");var kt=(0,J.getEnvVar)("LOG_VIEW","short"),h=o((t,r)=>String(t).padStart(r),"leftPad"),wt=o((t,r)=>String(t).padEnd(r),"rightPad"),M=20,St=o((t,r=0)=>(M=Math.max(t&&t.length||0,M,r),wt(t,M)),"prettyPath"),Q=o(t=>t>=500?"error":t>=400?"warn":t>=300?"debug":null,"getStatusLevel"),_t=o(t=>{let r=Q(t);return r||(r=t!==200?"log":null),g(h(String(t),3),r)},"prettyStatus"),Bt=o(t=>h(`#${t}`,3),"prettyReqId"),Et=o(t=>{let r=t==="REMOVE"?"error":t==="WS"?"debug":null;return g(h(t,4),r)},"prettyMethod"),Ct=o((t,r="")=>{if(!Number.isFinite(t))return null;let e=t>=10*1e3?"error":t>=3*1e3?"warn":null,s=["m","s","ms"].includes(r)?r:"",l=Math.floor(Math.abs(t)*10**6),a=(0,H.default)(l,s);return g(h(a,5),e)},"prettyTime"),Ft=o((t,r="")=>{if(!Number.isFinite(t))return null;let e=(0,Y.default)(t,{maximumFractionDigits:1}).split(" "),n=e[1];return`${+e[0]>=100?Math.round(+e[0]):+e[0]}${r}${n}`},"prettySize"),X=o((t,r)=>[...t,r].filter(Boolean).map(String).map(n=>W(n,n)).join(":"),"prettyNs");function Rt(t){let r=["\u25CB","\u2022","\u2660","\u2660","\u2666","\u2665","\u263C","\u2642","\u2640","\u266A","\xA7"],e=r[F(t)%r.length];return W(e,String(t))}o(Rt,"prettyMarker");var P=o(t=>{let r=kt==="short"?(t[0]||"").toLowerCase():h(t,5);return r=`[${r}]`,g(r,t)},"prettyLevel"),Wt=/\[[^"\]]+]/gm,Z=o((...t)=>{let r=[];return t.forEach(e=>{if(typeof e=="string"){let n=0;r.push(e.replace(Wt,s=>(0,V.colorize)(s,S[n++%S.length])))}else r.push(e)}),r},"prettyContent"),Mt=o(t=>Q(t.status)||E(t)?"debug":"trace","getUrlLevel"),K=o(t=>{let r=E(t),e=Mt(t);return[P(e),[Rt(t.reqId),Et(t.method)].join(""),St(t.url),Bt(t.reqId),r&&t.method!=="WS"?_t(t.status):null,!r&&"\u29D7\u29D6\u29D7",r&&Ct(t.duration),r&&t.method!=="WS"?Ft(t.length):null].filter(Boolean).join(" ")},"prettyUrl");function Pt(t,r){let e=0;return t.forEach((n,s)=>{s===e&&r(n)&&(e+=1)}),e}o(Pt,"countInRow");function At(...t){let r=Pt(t,e=>typeof e=="string");return[t.slice(0,r).join(" "),...t.slice(r)]}o(At,"concatFirstStrings");function d(t,...r){let e=t?.ns,n=t?.name,s=t?.level||"log",l=r;if(u(t))return[K(t)];let a=(e||"").split(":").filter(Boolean).map(String),f=[P(s)];return(a.length||n)&&f.push(X(a,n)),At(...f,...Z(...l))}o(d,"prettyFormat");var Nt={10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"};var j=o(t=>!!(t.name&&t.hostname&&t.pid&&t.msg&&t.time),"isBunyan"),q=o(t=>{let{level:r,time:e,msg:n,hostname:s,pid:l,v:a,...f}=t;return{format:i.bunyan,meta:{level:Nt[r],time:new Date(e)},args:c(n,f)}},"parseBunyan");var $t=["trace","debug","info","warning","error","fatal","panic"],Tt={trace:"trace",debug:"debug",info:"info",warning:"warn",error:"error",fatal:"fatal",panic:"fatal"};var A=o(t=>!!(t.msg&&$t.includes(t.level)),"isLogrus"),tt=o(t=>{let{level:r,time:e,msg:n,...s}=t;return{format:i.logrus,meta:{level:Tt[r],time:new Date(e)},args:c(n,s)}},"parseLogrus");function zt(t){return j(t)?i.bunyan:G(t)?i.lsklog:u(t)?i.lsklogweb:A(t)&&B(t)&&t?.name?i.lsklog:A(t)?i.logrus:B(t)?i.lsklog:null}o(zt,"detectFormat");function rt(t){let r=zt(t);return r==="bunyan"?q(t):r==="lsklogweb"?C(t):r==="lsklog"?C(t):r==="logrus"?tt(t):{format:r,meta:{},args:[t]}}o(rt,"parse");var ot=o((t,r)=>{let e,n;if(typeof r=="string"&&(!e&&r.trim()&&(e=(0,et.tryJSONparse)(r,null),e!==null&&(n="json")),!e&&r.trim()&&(e=N(r,null),e!==null&&(n="logfmt"))),e===null&&(e=null,n="raw"),!e){t.log(...d({},r));return}if(typeof e!="object"){t.log(...d({},e));return}let{meta:s,args:l=[]}=rt(e);t.log(...d(s,...l))},"prettyRawLog"),Dt=ot;0&&(module.exports={prettyRawLog});
//# sourceMappingURL=prettyRawLog.js.map
{
"name": "@lskjs/log",
"version": "3.11.0",
"version": "3.11.1",
"description": "Yet another logger whitch combines the best features of debug, bunyan, logfmt/logrus, morgan/winston",

@@ -65,3 +65,3 @@ "author": "Igor Suvorov <hi@isuvorov.com> (https://github.com/isuvorov)",

],
"gitHead": "150463ce96bcc80a2187339a44762e7807cbf41c"
"gitHead": "9f4f8c981988c48c5a33efbd43b1972f7ba5445a"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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