@visulima/pail 4.0.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE.md +346 -0
  3. package/MIGRATION-GUIDE.md +459 -0
  4. package/README.md +17 -0
  5. package/dist/error.d.ts +69 -69
  6. package/dist/index.browser.d.ts +446 -445
  7. package/dist/index.browser.js +17 -17
  8. package/dist/index.server.d.ts +582 -582
  9. package/dist/index.server.js +27 -27
  10. package/dist/middleware/elysia.d.ts +44 -42
  11. package/dist/middleware/elysia.js +1 -1
  12. package/dist/middleware/express.d.ts +58 -59
  13. package/dist/middleware/express.js +1 -1
  14. package/dist/middleware/fastify.d.ts +55 -56
  15. package/dist/middleware/fastify.js +1 -1
  16. package/dist/middleware/hono.d.ts +56 -57
  17. package/dist/middleware/hono.js +1 -1
  18. package/dist/middleware/next/handler.d.ts +67 -68
  19. package/dist/middleware/next/handler.js +1 -1
  20. package/dist/middleware/sveltekit.d.ts +72 -73
  21. package/dist/middleware/sveltekit.js +1 -1
  22. package/dist/object-tree.d.ts +44 -44
  23. package/dist/packem_shared/AbstractJsonReporter-BpWRnN0L.js +1 -0
  24. package/dist/packem_shared/AbstractJsonReporter-DxZwImm5.js +1 -0
  25. package/dist/packem_shared/JsonReporter-9IcELa1m.js +2 -0
  26. package/dist/packem_shared/JsonReporter-Dd3kuj8X.js +1 -0
  27. package/dist/packem_shared/{PrettyReporter-DsHfKOU7.js → PrettyReporter-BUWNEg3_.js} +1 -1
  28. package/dist/packem_shared/{PrettyReporter-CcDdPQSt.js → PrettyReporter-DbgD89ck.js} +56 -30
  29. package/dist/packem_shared/abstract-json-reporter.d-B6NoO-hG.d.ts +61 -0
  30. package/dist/packem_shared/{abstract-pretty-reporter-DrLBJ6ds.js → abstract-pretty-reporter-CyfTvmKf.js} +41 -39
  31. package/dist/packem_shared/create-middleware-logger.d-BRkkBMlk.d.ts +47 -0
  32. package/dist/packem_shared/headers-DI58djdG.js +1 -0
  33. package/dist/packem_shared/index-CbkPnylC.js +1 -0
  34. package/dist/packem_shared/serializeError-52C4oiKx-CrnRcq9R.js +1 -0
  35. package/dist/packem_shared/storage-DVcJumyk.js +1 -0
  36. package/dist/packem_shared/types.d-4ge_rME4.d.ts +246 -0
  37. package/dist/packem_shared/{types.d-Cz9S7jZh.d.ts → types.d-BW8kAXUv.d.ts} +95 -95
  38. package/dist/packem_shared/types.d-DGHeA2iJ.d.ts +194 -0
  39. package/dist/packem_shared/useLogger-7p55yvvc.js +1 -0
  40. package/dist/packem_shared/wide-event.d-BMLastMR.d.ts +716 -0
  41. package/dist/packem_shared/write-stream-ytl_vhg_.js +1 -0
  42. package/dist/processor/caller/caller-processor.d.ts +32 -33
  43. package/dist/processor/environment-processor.d.ts +83 -84
  44. package/dist/processor/message-formatter-processor.d.ts +40 -45
  45. package/dist/processor/message-formatter-processor.js +1 -1
  46. package/dist/processor/opentelemetry-processor.d.ts +51 -52
  47. package/dist/processor/redact-processor.d.ts +57 -65
  48. package/dist/processor/sampling-processor.d.ts +90 -91
  49. package/dist/reporter/file/json-file-reporter.d.ts +77 -78
  50. package/dist/reporter/file/json-file-reporter.js +1 -1
  51. package/dist/reporter/http/abstract-http-reporter.d.ts +125 -121
  52. package/dist/reporter/http/abstract-http-reporter.js +2 -2
  53. package/dist/reporter/http/http-reporter.d.ts +33 -34
  54. package/dist/reporter/http/http-reporter.edge-light.d.ts +235 -230
  55. package/dist/reporter/http/http-reporter.edge-light.js +2 -2
  56. package/dist/reporter/json/index.browser.d.ts +62 -61
  57. package/dist/reporter/json/index.browser.js +1 -1
  58. package/dist/reporter/json/index.d.ts +36 -37
  59. package/dist/reporter/json/index.js +1 -1
  60. package/dist/reporter/pretty/index.browser.d.ts +57 -56
  61. package/dist/reporter/pretty/index.browser.js +1 -1
  62. package/dist/reporter/pretty/index.d.ts +133 -133
  63. package/dist/reporter/pretty/index.js +1 -1
  64. package/dist/reporter/simple/simple-reporter.server.d.ts +91 -90
  65. package/dist/reporter/simple/simple-reporter.server.js +7 -7
  66. package/dist/wide-event.d.ts +2 -3
  67. package/dist/wide-event.js +1 -1
  68. package/package.json +58 -36
  69. package/dist/packem_shared/AbstractJsonReporter-Bp_JCrMQ.js +0 -1
  70. package/dist/packem_shared/AbstractJsonReporter-w_bGGiD-.js +0 -1
  71. package/dist/packem_shared/JsonReporter-Sd_lJGS-.js +0 -2
  72. package/dist/packem_shared/JsonReporter-bmem9lcg.js +0 -1
  73. package/dist/packem_shared/abstract-json-reporter.d-wfESoEa-.d.ts +0 -62
  74. package/dist/packem_shared/addKnownErrorConstructor-C1OJTj2D-0FlJMfXz.js +0 -25
  75. package/dist/packem_shared/create-middleware-logger.d-B-JmQ1Sl.d.ts +0 -47
  76. package/dist/packem_shared/headers-DH0H2s8W.js +0 -1
  77. package/dist/packem_shared/index-Q1764hvO.js +0 -1
  78. package/dist/packem_shared/serializeError-C-NFvZ8_-D0CA_Qlx.js +0 -1
  79. package/dist/packem_shared/storage-DaXAlpiO.js +0 -1
  80. package/dist/packem_shared/types.d-bWnqHJKL.d.ts +0 -211
  81. package/dist/packem_shared/types.d-xxE3FOD3.d.ts +0 -229
  82. package/dist/packem_shared/useLogger-DB34CuU5.js +0 -1
  83. package/dist/packem_shared/wide-event.d-D3ATYpoK.d.ts +0 -717
  84. package/dist/packem_shared/write-stream-C7jxLxIT.js +0 -1
@@ -1,2 +1,2 @@
1
- import{createRequire as N}from"node:module";const z=N(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,S=t=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[e,r]=d.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return d.getBuiltinModule(t)}return z(t)},{Buffer:E}=S("node:buffer"),{createRequire:P}=S("node:module"),{gzipSync:B}=S("node:zlib"),R=P(import.meta.url),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=t=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[e,r]=p.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return p.getBuiltinModule(t)}return R(t)};_("node:util");const L=P(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=t=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[e,r]=m.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return m.getBuiltinModule(t)}return L(t)};T("node:fs");T("node:path");T("node:url");const M=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&M.set("AggregateError",AggregateError);const $=Object.create({},{cause:{enumerable:!1,value:void 0,writable:!0},code:{enumerable:!0,value:void 0,writable:!0},errors:{enumerable:!1,value:void 0,writable:!0},message:{enumerable:!1,value:void 0,writable:!0},name:{enumerable:!1,value:void 0,writable:!0},stack:{enumerable:!1,value:void 0,writable:!0}}),Q=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype||Object.getPrototypeOf(e)===null},y=new WeakSet,j=t=>{const e=Object.getOwnPropertyNames(t);for(const r of e){const s=Object.getOwnPropertyDescriptor(t,r);s&&(s.enumerable||Object.defineProperty(t,r,{...s,enumerable:!0}),s.value&&typeof s.value=="object"&&!Array.isArray(s.value)&&(Object.getPrototypeOf(s.value)===Object.prototype||Object.getPrototypeOf(s.value)===null)&&j(s.value))}},A=t=>{y.add(t);const e=t.toJSON();return y.delete(t),Object.isExtensible(e)&&j(e),e},b=(t,e,r,s,o=new Set)=>{if(t&&t instanceof Uint8Array&&t.constructor.name==="Buffer")return"[object Buffer]";if(t!==null&&typeof t=="object"&&"pipe"in t&&typeof t.pipe=="function")return"[object Stream]";if(t instanceof Error)return e.has(t)?"[Circular]":(r+=1,g(t,s,e,r));if(s.useToJSON&&t!==null&&typeof t=="object"&&"toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();if(t instanceof Date)return t.toISOString();if(t instanceof RegExp)return t.toString();if(typeof URL<"u"&&t instanceof URL)return t.href;if(t instanceof Map){const i=[];for(const[a,n]of t.entries())i.push([b(a,e,r,s,o),b(n,e,r,s,o)]);return{__dataType:"Map",value:i}}if(t instanceof Set){const i=[];for(const a of t.values())i.push(b(a,e,r,s,o));return{__dataType:"Set",value:i}}if(typeof t=="function")return`[Function: ${t.name||"anonymous"}]`;if(typeof t=="bigint")return`${String(t)}n`;if(Q(t)){if(o.has(t))return"[Circular]";if(s.maxDepth!==void 0&&s.maxDepth!==Number.POSITIVE_INFINITY&&r+1>=s.maxDepth)return{};r+=1,o.add(t);const i={};for(const a in t)i[a]=b(t[a],e,r,s,o);return o.delete(t),i}try{return t}catch{return"[Not Available]"}},g=(t,e,r,s)=>{if(r.add(t),e.maxDepth===0)return{};if(e.useToJSON&&typeof t.toJSON=="function"&&!y.has(t))return A(t);const o=Object.create($);if(Object.defineProperty(o,"name",{configurable:!0,enumerable:!0,value:Object.prototype.toString.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,writable:!0}),Object.defineProperty(o,"message",{configurable:!0,enumerable:!0,value:t.message,writable:!0}),Object.defineProperty(o,"stack",{configurable:!0,enumerable:!0,value:t.stack,writable:!0}),Array.isArray(t.errors)){const a=[];for(const n of t.errors){if(!(n instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(r.has(n))return Object.defineProperty(o,"errors",{configurable:!0,enumerable:!0,value:[],writable:!0}),o;a.push(g(n,e,r,s))}Object.defineProperty(o,"errors",{configurable:!0,enumerable:!0,value:a,writable:!0})}const i=t.cause;if(i!=null)if(i instanceof Error)r.has(i)?Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:"[Circular]",writable:!0}):Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:g(i,e,r,s),writable:!0});else{const a=b(i,r,s,e);Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:a,writable:!0})}for(const a in t){if(a==="name"||a==="message"||a==="stack"||a==="cause"||a==="errors")continue;const n=t[a],u=b(n,r,s,e);Object.defineProperty(o,a,{configurable:!0,enumerable:!0,value:u,writable:!0})}if(Array.isArray(e.exclude)&&e.exclude.length>0)for(const a of e.exclude)try{delete o[a]}catch{}return o},v=(t,e={})=>g(t,{exclude:e.exclude??[],maxDepth:e.maxDepth??Number.POSITIVE_INFINITY,useToJSON:e.useToJSON??!1},new Set,0),O=Symbol("EMPTY");class C{stringify;errorOptions;constructor(e={}){this.errorOptions=e.error??{}}setStringify(e){this.stringify=e}log(e){const{context:r,error:s,file:o,message:i,type:a,...n}=e;if(n.label&&(n.label=n.label.trim()),o&&(n.file=`${o.name??""}:${String(o.line)}${o.column?`:${String(o.column)}`:""}`),n.message=i===O?void 0:i,s&&(n.error=v(s,this.errorOptions)),r){const u=[];for(let c=0;c<r.length;c+=1){const h=r[c];h!==O&&(h instanceof Error?u.push(v(h,this.errorOptions)):u.push(h))}n.context=u}this._log(this.stringify(n),a.level)}}const J=async t=>{const e=globalThis.CompressionStream;if(e){const r=new e("gzip"),s=r.writable.getWriter(),o=r.readable.getReader(),i=new TextEncoder,a=[];await s.write(i.encode(t)),await s.close();let n=!1;for(;!n;){const l=await o.read();n=l.done,l.value&&a.push(l.value)}const u=a.reduce((l,f)=>l+f.length,0),c=new Uint8Array(u);let h=0;for(let l=0;l<a.length;l+=1){const f=a[l];c.set(f,h),h+=f.length}return c}return B(t)};class I extends Error{logData;actualSize;maxSize;constructor(e,r,s,o){super(e),this.name="LogSizeError",this.logData=r,this.actualSize=s,this.maxSize=o}}const w=(t,e)=>t*2**e,k=/^\d+$/,F=t=>{const e=t.trim();if(k.test(e)){const o=Number.parseInt(e,10);return Math.min(Math.max(o,0)*1e3,6e4)}const r=Date.parse(e);if(Number.isNaN(r))return;const s=r-Date.now();return Math.min(Math.max(s,0),6e4)},D=t=>new Promise(e=>{setTimeout(e,t)}),q=t=>typeof t=="string"?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),U=async(t,e,r,s,o,i,a)=>{const n={};t.headers.forEach((h,l)=>{n[l]=h});const u=await t.text(),c={req:{body:o,headers:s,method:r,url:e},res:{body:u,headers:n,status:t.status,statusText:t.statusText}};if(i&&i(c),t.ok)return!1;if(t.status<500&&t.status!==429){const h=new Error(`HTTP ${String(t.status)}: ${t.statusText}`);throw a&&a(h),h}return!0},Y=(t,e,r,s,o)=>{if(t.status===429&&e&&s<o){const i=t.headers.get("retry-after");return(i?F(i):void 0)??w(r,s)}},H=(t,e,r,s)=>{if(t.status>=500&&r<s)return w(e,r)},V=(t,e,r,s,o)=>{const i=Y(t,e,r,s,o);return i!==void 0?i:H(t,r,s,o)},W=async(t,e,r,s,o)=>{if(e<r){const i=w(s,e);return await D(i),!0}return o&&o(t),!1},G=async(t,e,r,s,o,i,a,n,u)=>{let c=0;for(;c<=o;)try{const h=q(s),l=await fetch(t,{body:h,headers:r,method:e});if(!await U(l,t,e,r,s,n,u))return;const f=V(l,a,i,c,o);if(f!==void 0){await D(f),c+=1;continue}if(!l.ok){const x=new Error(`HTTP ${String(l.status)}: ${l.statusText}`);throw u&&u(x),x}return}catch(h){if(await W(h,c,o,i,u)){c+=1;continue}throw h}};class K extends C{url;method;headers;contentType;batchContentType;onError;onDrop;maxQueueSize;onDebug;onDebugRequestResponse;payloadTemplate;compression;maxRetries;retryDelay;respectRateLimit;enableBatchSend;batchSize;batchSendTimeout;batchSendDelimiter;batchMode;batchFieldName;maxLogSize;maxPayloadSize;edgeCompat;batchQueue=[];batchTimeout;isProcessingBatch=!1;currentBatchSize=0;constructor(e){if(super(e),this.url=e.url,this.method=e.method??"POST",this.headers=e.headers??{},this.contentType=e.contentType??"application/json",this.batchContentType=e.batchContentType??"application/json",this.onError=e.onError,this.onDrop=e.onDrop,this.maxQueueSize=e.maxQueueSize??1e4,this.onDebug=e.onDebug,this.onDebugRequestResponse=e.onDebugRequestResponse,this.payloadTemplate=e.payloadTemplate??(r=>JSON.stringify(r)),this.compression=e.compression??!1,this.maxRetries=e.maxRetries??3,this.retryDelay=e.retryDelay??1e3,this.respectRateLimit=e.respectRateLimit??!0,this.enableBatchSend=e.enableBatchSend??!0,this.batchSize=e.batchSize??100,this.batchSendTimeout=e.batchSendTimeout??5e3,this.batchSendDelimiter=e.batchSendDelimiter??`
2
- `,this.batchMode=e.batchMode??"delimiter",this.batchFieldName=e.batchFieldName,this.batchMode==="field"&&!this.batchFieldName)throw new Error("batchFieldName is required when batchMode is 'field'");this.maxLogSize=e.maxLogSize??1048576,this.maxPayloadSize=e.maxPayloadSize??5242880,this.edgeCompat=e.edgeCompat??!1}async flush(){for(this.batchTimeout&&(clearTimeout(this.batchTimeout),this.batchTimeout=void 0);this.batchQueue.length>0||this.isProcessingBatch;){if(this.isProcessingBatch){await new Promise(e=>setTimeout(e,0));continue}await this.processBatch()}}async close(){await this.flush()}async dispose(){await this.close()}_log(e,r){try{const s=JSON.parse(e),o=r,i=s.message,a={logLevel:o,message:i??""};if(s.data)a.data=s.data;else if(s.context)a.data=s.context;else{const c={...s};delete c.message,Object.keys(c).length>0&&(a.data=c)}const n=this.payloadTemplate(a);this.onDebug&&this.onDebug({data:a.data,logLevel:o,message:i});const u=this.edgeCompat||typeof TextEncoder>"u"?E.byteLength(n,"utf8"):new TextEncoder().encode(n).length;if(u>this.maxLogSize){const c=new I(`Log entry exceeds maximum size of ${String(this.maxLogSize)} bytes. Size: ${String(u)} bytes`,{data:a.data,logLevel:o,message:i},u,this.maxLogSize);this.onError&&this.onError(c);return}this.enableBatchSend?this.addToBatch(n,u):this.sendPayload(n).catch(c=>{this.onError&&this.onError(c)})}catch(s){this.onError&&this.onError(s)}}addToBatch(e,r){const s=this.currentBatchSize+r+this.batchSendDelimiter.length,o=this.maxPayloadSize*.9;if(s>o&&this.batchQueue.length>0&&this.processBatch(),this.batchQueue.push(e),this.currentBatchSize+=r+this.batchSendDelimiter.length,this.batchQueue.length>this.maxQueueSize){const i=this.batchQueue.splice(0,this.batchQueue.length-this.maxQueueSize);this.currentBatchSize=this.#e(),this.onDrop&&this.onDrop(i.length)}this.batchTimeout??=setTimeout(()=>{this.processBatch()},this.batchSendTimeout),this.batchQueue.length>=this.batchSize&&this.processBatch()}#e(){let e=0;for(let r=0;r<this.batchQueue.length;r+=1){const s=this.batchQueue[r],o=this.edgeCompat||typeof TextEncoder>"u"?E.byteLength(s,"utf8"):new TextEncoder().encode(s).length;e+=o+(r<this.batchQueue.length-1?this.batchSendDelimiter.length:0)}return e}async processBatch(){if(this.isProcessingBatch||this.batchQueue.length===0)return;this.isProcessingBatch=!0,this.batchTimeout&&(clearTimeout(this.batchTimeout),this.batchTimeout=void 0);const e=this.batchQueue.splice(0,this.batchSize);this.currentBatchSize=this.#e();try{await this.sendBatch(e)}catch(r){this.onError&&this.onError(r)}finally{this.isProcessingBatch=!1,this.batchQueue.length>0&&this.processBatch()}}async sendBatch(e){let r;switch(this.batchMode){case"array":{const s=e.map(o=>JSON.parse(o));r=JSON.stringify(s);break}case"field":{const s=e.map(i=>JSON.parse(i)),o=this.batchFieldName?{[this.batchFieldName]:s}:{};r=JSON.stringify(o);break}default:{r=e.join(this.batchSendDelimiter);break}}await this.sendPayload(r,this.batchContentType)}async sendPayload(e,r){const s=typeof this.headers=="function"?this.headers():{...this.headers};s["content-type"]??=r??this.contentType;let o=e;if(this.compression&&!this.edgeCompat)try{o=await J(e),s["content-encoding"]="gzip"}catch(i){this.onError&&this.onError(new Error(`Compression failed: ${String(i)}`))}await G(this.url,this.method,s,o,this.maxRetries,this.retryDelay,this.respectRateLimit,this.onDebugRequestResponse,this.onError)}}class Z extends K{constructor(e){super({...e,edgeCompat:!0})}}export{Z as default};
1
+ const D=Object.create({},{cause:{enumerable:!1,value:void 0,writable:!0},code:{enumerable:!0,value:void 0,writable:!0},errors:{enumerable:!1,value:void 0,writable:!0},message:{enumerable:!1,value:void 0,writable:!0},name:{enumerable:!1,value:void 0,writable:!0},stack:{enumerable:!1,value:void 0,writable:!0}}),E=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null},p=new WeakSet,P=e=>{if(Object.hasOwn(e,"name")&&typeof e.name=="string"&&e.name!=="")return e.name;const t=e.constructor?.name;return typeof t=="string"&&t!==""?t:e.name},O=e=>{const t=Object.getOwnPropertyNames(e);for(const s of t){const r=Object.getOwnPropertyDescriptor(e,s);r&&(r.enumerable||Object.defineProperty(e,s,{...r,enumerable:!0}),r.value&&typeof r.value=="object"&&!Array.isArray(r.value)&&(Object.getPrototypeOf(r.value)===Object.prototype||Object.getPrototypeOf(r.value)===null)&&O(r.value))}},N=e=>{p.add(e);const t=e.toJSON();return p.delete(e),Object.isExtensible(t)&&O(t),t},d=(e,t,s,r,a=new Set)=>{if(e&&e instanceof Uint8Array&&e.constructor.name==="Buffer")return"[object Buffer]";if(e!==null&&typeof e=="object"&&"pipe"in e&&typeof e.pipe=="function")return"[object Stream]";if(e instanceof Error)return t.has(e)?"[Circular]":(s+=1,m(e,r,t,s));if(r.useToJSON&&e!==null&&typeof e=="object"&&"toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();if(e instanceof Date)return e.toISOString();if(e instanceof RegExp)return e.toString();if(typeof URL<"u"&&e instanceof URL)return e.href;if(e instanceof Map){const i=[];for(const[n,o]of e.entries())i.push([d(n,t,s,r,a),d(o,t,s,r,a)]);return{__dataType:"Map",value:i}}if(e instanceof Set){const i=[];for(const n of e.values())i.push(d(n,t,s,r,a));return{__dataType:"Set",value:i}}if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(typeof e=="bigint")return`${String(e)}n`;if(E(e)){if(a.has(e))return"[Circular]";if(r.maxDepth!==void 0&&r.maxDepth!==Number.POSITIVE_INFINITY&&s+1>=r.maxDepth)return{};s+=1,a.add(e);const i={};for(const n in e)i[n]=d(e[n],t,s,r,a);return a.delete(e),i}try{return e}catch{return"[Not Available]"}},m=(e,t,s,r)=>{if(s.add(e),t.maxDepth===0)return{};if(t.useToJSON&&typeof e.toJSON=="function"&&!p.has(e))return N(e);const a=Object.create(D);if(Object.defineProperty(a,"name",{configurable:!0,enumerable:!0,value:P(e),writable:!0}),Object.defineProperty(a,"message",{configurable:!0,enumerable:!0,value:e.message,writable:!0}),Object.defineProperty(a,"stack",{configurable:!0,enumerable:!0,value:e.stack,writable:!0}),Array.isArray(e.errors)){const n=[];for(const o of e.errors){if(!(o instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(s.has(o))return Object.defineProperty(a,"errors",{configurable:!0,enumerable:!0,value:[],writable:!0}),a;n.push(m(o,t,s,r))}Object.defineProperty(a,"errors",{configurable:!0,enumerable:!0,value:n,writable:!0})}const i=e.cause;if(i!=null)if(i instanceof Error)s.has(i)?Object.defineProperty(a,"cause",{configurable:!0,enumerable:!0,value:"[Circular]",writable:!0}):Object.defineProperty(a,"cause",{configurable:!0,enumerable:!0,value:m(i,t,s,r),writable:!0});else{const n=d(i,s,r,t);Object.defineProperty(a,"cause",{configurable:!0,enumerable:!0,value:n,writable:!0})}for(const n in e){if(n==="name"||n==="message"||n==="stack"||n==="cause"||n==="errors")continue;const o=e[n],u=d(o,s,r,t);Object.defineProperty(a,n,{configurable:!0,enumerable:!0,value:u,writable:!0})}if(Array.isArray(t.exclude)&&t.exclude.length>0)for(const n of t.exclude)try{delete a[n]}catch{}return a},S=(e,t={})=>m(e,{exclude:t.exclude??[],maxDepth:t.maxDepth??Number.POSITIVE_INFINITY,useToJSON:t.useToJSON??!1},new Set,0),w=Symbol("EMPTY");class j{stringify;errorOptions;constructor(t={}){this.errorOptions=t.error??{}}setStringify(t){this.stringify=t}log(t){const{context:s,error:r,file:a,message:i,type:n,...o}=t;if(o.label&&(o.label=o.label.trim()),a&&(o.file=`${a.name??""}:${String(a.line)}${a.column?`:${String(a.column)}`:""}`),o.message=i===w?void 0:i,r&&(o.error=S(r,this.errorOptions)),s){const u=[];for(let h=0;h<s.length;h+=1){const c=s[h];c!==w&&(c instanceof Error?u.push(S(c,this.errorOptions)):u.push(c))}o.context=u}this._log(this.stringify(o),n.level)}}const R=async()=>{try{const{gzipSync:e}=await import("node:zlib");return typeof e=="function"?e:void 0}catch{return}},B=async e=>{const t=globalThis.CompressionStream;if(t){const r=new t("gzip"),a=r.writable.getWriter(),i=r.readable.getReader(),n=new TextEncoder,o=[];await a.write(n.encode(e)),await a.close();let u=!1;for(;!u;){const l=await i.read();u=l.done,l.value&&o.push(l.value)}const h=o.reduce((l,f)=>l+f.length,0),c=new Uint8Array(h);let b=0;for(let l=0;l<o.length;l+=1){const f=o[l];c.set(f,b),b+=f.length}return c}const s=await R();if(s===void 0)throw new Error("gzip compression is unavailable: this runtime provides neither CompressionStream nor node:zlib.");return s(e)};class Q extends Error{logData;actualSize;maxSize;constructor(t,s,r,a){super(t),this.name="LogSizeError",this.logData=s,this.actualSize=r,this.maxSize=a}}let v=class extends Error{};const y=(e,t)=>e*2**t,x=6e4,$=/^\d+$/,L=e=>{const t=e.trim();if($.test(t)){const a=Number.parseInt(t,10);return Math.min(Math.max(a,0)*1e3,x)}const s=Date.parse(t);if(Number.isNaN(s))return;const r=s-Date.now();return Math.min(Math.max(r,0),x)},z=e=>new Promise(t=>{setTimeout(t,e)}),M=e=>typeof e=="string"?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),J=async(e,t,s,r,a,i,n)=>{const o={};e.headers.forEach((c,b)=>{o[b]=c});const u=await e.text(),h={req:{body:a,headers:r,method:s,url:t},res:{body:u,headers:o,status:e.status,statusText:e.statusText}};if(i&&i(h),e.ok)return!1;if(e.status<500&&e.status!==429){const c=new v(`HTTP ${String(e.status)}: ${e.statusText}`);throw n&&n(c),c}return!0},A=(e,t,s,r,a)=>{if(e.status===429&&t&&r<a){const i=e.headers.get("retry-after");return(i?L(i):void 0)??y(s,r)}},C=(e,t,s,r)=>{if(e.status>=500&&s<r)return y(t,s)},I=(e,t,s,r,a)=>{const i=A(e,t,s,r,a);return i!==void 0?i:C(e,s,r,a)},k=async(e,t,s,r,a)=>{if(t<s){const i=y(r,t);return await z(i),!0}return a&&a(e),!1},F=async(e,t)=>{const{body:s,headers:r,maxRetries:a,method:i,onDebugRequestResponse:n,onError:o,respectRateLimit:u,retryDelay:h,url:c}=e,b=M(s),l=await fetch(c,{body:b,headers:r,method:i});if(!await J(l,c,i,r,s,n,o))return{done:!0};const f=I(l,u,h,t,a);if(f!==void 0)return{retryInMs:f};if(!l.ok){const g=new Error(`HTTP ${String(l.status)}: ${l.statusText}`);throw o&&o(g),g}return{done:!0}},q=async(e,t,s,r,a,i,n,o,u)=>{const h={body:r,headers:s,maxRetries:a,method:t,onDebugRequestResponse:o,onError:u,respectRateLimit:n,retryDelay:i,url:e};let c=0;for(;c<=a;)try{const b=await F(h,c);if("retryInMs"in b)await z(b.retryInMs),c+=1;else return}catch(b){if(b instanceof v||!await k(b,c,a,i,u))throw b;c+=1}},_=e=>{let t=0;for(const s of e){const r=s.codePointAt(0);r<128?t+=1:r<2048?t+=2:r<65536?t+=3:t+=4}return t};let T;const U=e=>typeof TextEncoder=="function"?(T??=new TextEncoder,T.encode(e).length):_(e);class Y extends j{url;method;headers;contentType;batchContentType;onError;onDrop;maxQueueSize;onDebug;onDebugRequestResponse;payloadTemplate;compression;maxRetries;retryDelay;respectRateLimit;enableBatchSend;batchSize;batchSendTimeout;batchSendDelimiter;batchMode;batchFieldName;maxLogSize;maxPayloadSize;edgeCompat;batchQueue=[];batchSizeQueue=[];batchTimeout;isProcessingBatch=!1;currentBatchSize=0;constructor(t){if(super(t),this.url=t.url,this.method=t.method??"POST",this.headers=t.headers??{},this.contentType=t.contentType??"application/json",this.batchContentType=t.batchContentType??"application/json",this.onError=t.onError,this.onDrop=t.onDrop,this.maxQueueSize=t.maxQueueSize??1e4,this.onDebug=t.onDebug,this.onDebugRequestResponse=t.onDebugRequestResponse,this.payloadTemplate=t.payloadTemplate??(s=>JSON.stringify(s)),this.compression=t.compression??!1,this.maxRetries=t.maxRetries??3,this.retryDelay=t.retryDelay??1e3,this.respectRateLimit=t.respectRateLimit??!0,this.enableBatchSend=t.enableBatchSend??!0,this.batchSize=t.batchSize??100,this.batchSendTimeout=t.batchSendTimeout??5e3,this.batchSendDelimiter=t.batchSendDelimiter??`
2
+ `,this.batchMode=t.batchMode??"delimiter",this.batchFieldName=t.batchFieldName,this.batchMode==="field"&&!this.batchFieldName)throw new Error("batchFieldName is required when batchMode is 'field'");this.maxLogSize=t.maxLogSize??1048576,this.maxPayloadSize=t.maxPayloadSize??5242880,this.edgeCompat=t.edgeCompat??!1}async flush(){for(this.batchTimeout&&(clearTimeout(this.batchTimeout),this.batchTimeout=void 0);this.batchQueue.length>0||this.isProcessingBatch;){if(this.isProcessingBatch){await new Promise(t=>setTimeout(t,0));continue}await this.processBatch()}}async close(){await this.flush()}async dispose(){await this.close()}_log(t,s){try{const r=JSON.parse(t),a=s,i=r.message,n={logLevel:a,message:i??""};if(r.data)n.data=r.data;else if(r.context)n.data=r.context;else{const h={...r};delete h.message,Object.keys(h).length>0&&(n.data=h)}const o=this.payloadTemplate(n);this.onDebug&&this.onDebug({data:n.data,logLevel:a,message:i});const u=U(o);if(u>this.maxLogSize){const h=new Q(`Log entry exceeds maximum size of ${String(this.maxLogSize)} bytes. Size: ${String(u)} bytes`,{data:n.data,logLevel:a,message:i},u,this.maxLogSize);this.onError&&this.onError(h);return}this.enableBatchSend?this.addToBatch(o,u):this.sendPayload(o).catch(h=>{this.onError&&this.onError(h)})}catch(r){this.onError&&this.onError(r)}}addToBatch(t,s){const r=this.currentBatchSize+s+this.batchSendDelimiter.length,a=this.maxPayloadSize*.9;if(r>a&&this.batchQueue.length>0&&this.processBatch(),this.batchQueue.push(t),this.batchSizeQueue.push(s),this.currentBatchSize+=s+this.batchSendDelimiter.length,this.batchQueue.length>this.maxQueueSize){const i=this.batchQueue.length-this.maxQueueSize,n=this.batchQueue.splice(0,i);this.batchSizeQueue.splice(0,i),this.currentBatchSize=this.#e(),this.onDrop&&this.onDrop(n.length)}this.batchTimeout??=setTimeout(()=>{this.processBatch()},this.batchSendTimeout),this.batchQueue.length>=this.batchSize&&this.processBatch()}#e(){let t=0;for(let s=0;s<this.batchSizeQueue.length;s+=1)t+=this.batchSizeQueue[s]+(s<this.batchSizeQueue.length-1?this.batchSendDelimiter.length:0);return t}async processBatch(){if(this.isProcessingBatch||this.batchQueue.length===0)return;this.isProcessingBatch=!0,this.batchTimeout&&(clearTimeout(this.batchTimeout),this.batchTimeout=void 0);const t=this.batchQueue.splice(0,this.batchSize);this.batchSizeQueue.splice(0,this.batchSize),this.currentBatchSize=this.#e();try{await this.sendBatch(t)}catch(s){this.onError&&this.onError(s)}finally{this.isProcessingBatch=!1,this.batchQueue.length>0&&this.processBatch()}}async sendBatch(t){let s;switch(this.batchMode){case"array":{const r=t.map(a=>JSON.parse(a));s=JSON.stringify(r);break}case"field":{const r=t.map(i=>JSON.parse(i)),a=this.batchFieldName?{[this.batchFieldName]:r}:{};s=JSON.stringify(a);break}default:{s=t.join(this.batchSendDelimiter);break}}await this.sendPayload(s,this.batchContentType)}async sendPayload(t,s){const r=typeof this.headers=="function"?this.headers():{...this.headers};r["content-type"]??=s??this.contentType;let a=t;if(this.compression&&!this.edgeCompat)try{a=await B(t),r["content-encoding"]="gzip"}catch(i){this.onError&&this.onError(new Error(`Compression failed: ${String(i)}`))}await q(this.url,this.method,r,a,this.maxRetries,this.retryDelay,this.respectRateLimit,this.onDebugRequestResponse,this.onError)}}class V extends Y{constructor(t){super({...t,edgeCompat:!0})}}export{V as default};
@@ -1,10 +1,11 @@
1
1
  import { s as stringify } from "../../packem_shared/index.d-T71KjNAr.js";
2
- import { R as ReadonlyMeta, E as ExtendedRfc5424LogLevels, L as LiteralUnion, S as StringifyAwareReporter } from "../../packem_shared/types.d-xxE3FOD3.js";
2
+ import { LiteralUnion } from 'type-fest';
3
+ import { R as ReadonlyMeta, E as ExtendedRfc5424LogLevels, S as StringifyAwareReporter } from "../../packem_shared/types.d-DGHeA2iJ.js";
3
4
  import '@visulima/colorize';
4
5
  import '@visulima/interactive-manager';
5
6
  /**
6
- * Options for configuring JSON reporters.
7
- */
7
+ * Options for configuring JSON reporters.
8
+ */
8
9
  type AbstractJsonReporterOptions = {
9
10
  /** Error serialization options */
10
11
  error: Partial<{
@@ -17,82 +18,82 @@ type AbstractJsonReporterOptions = {
17
18
  }>;
18
19
  };
19
20
  /**
20
- * Abstract JSON Reporter.
21
- *
22
- * Base class for JSON-based reporters that provides common functionality
23
- * for serializing log metadata to JSON format. Handles error serialization,
24
- * context processing, and provides a template method for actual output.
25
- * @template L - The log level type
26
- * @example
27
- * ```typescript
28
- * class CustomJsonReporter extends AbstractJsonReporter {
29
- * protected _log(message: string): void {
30
- * console.log(message);
31
- * }
32
- * }
33
- * ```
34
- */
21
+ * Abstract JSON Reporter.
22
+ *
23
+ * Base class for JSON-based reporters that provides common functionality
24
+ * for serializing log metadata to JSON format. Handles error serialization,
25
+ * context processing, and provides a template method for actual output.
26
+ * @template L - The log level type
27
+ * @example
28
+ * ```typescript
29
+ * class CustomJsonReporter extends AbstractJsonReporter {
30
+ * protected _log(message: string): void {
31
+ * console.log(message);
32
+ * }
33
+ * }
34
+ * ```
35
+ */
35
36
  declare abstract class AbstractJsonReporter<L extends string = string> implements StringifyAwareReporter<L> {
36
37
  /** Custom stringify function for object serialization */
37
38
  protected stringify: typeof stringify | undefined;
38
39
  /** Error serialization options */
39
40
  protected errorOptions: AbstractJsonReporterOptions["error"];
40
41
  /**
41
- * Creates a new AbstractJsonReporter instance.
42
- * @param options Configuration options for JSON formatting and error handling
43
- */
42
+ * Creates a new AbstractJsonReporter instance.
43
+ * @param options Configuration options for JSON formatting and error handling
44
+ */
44
45
  constructor(options?: Partial<AbstractJsonReporterOptions>);
45
46
  /**
46
- * Sets a custom stringify function for object serialization.
47
- * @param function_ The stringify function to use for serialization
48
- */
47
+ * Sets a custom stringify function for object serialization.
48
+ * @param function_ The stringify function to use for serialization
49
+ */
49
50
  setStringify(function_: typeof stringify): void;
50
51
  log(meta: ReadonlyMeta<L>): void;
51
52
  /**
52
- * Template method for outputting the JSON log message.
53
- *
54
- * Subclasses must implement this method to define how the JSON message
55
- * is actually written (to console, file, network, etc.).
56
- * @param message The JSON-formatted log message
57
- * @param logLevel The log level of the message
58
- * @protected
59
- * @abstract
60
- */
53
+ * Template method for outputting the JSON log message.
54
+ *
55
+ * Subclasses must implement this method to define how the JSON message
56
+ * is actually written (to console, file, network, etc.).
57
+ * @param message The JSON-formatted log message
58
+ * @param logLevel The log level of the message
59
+ * @protected
60
+ * @abstract
61
+ */
61
62
  protected abstract _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
62
63
  }
63
64
  /**
64
- * Browser JSON Reporter.
65
- *
66
- * A JSON reporter for browser environments that outputs structured log data
67
- * to the browser console. Uses appropriate console methods based on log level.
68
- * @template L - The log level type
69
- * @example
70
- * ```typescript
71
- * import { createPail } from "@visulima/pail";
72
- *
73
- * const logger = createPail({
74
- * reporters: [new JsonReporter()]
75
- * });
76
- *
77
- * logger.info("Application started", { version: "1.0.0" });
78
- * // Outputs: {"level":"info","message":"Application started","context":[{"version":"1.0.0"}],...}
79
- * ```
80
- */
65
+ * Browser JSON Reporter.
66
+ *
67
+ * A JSON reporter for browser environments that outputs structured log data
68
+ * to the browser console. Uses appropriate console methods based on log level.
69
+ * @template L - The log level type
70
+ * @example
71
+ * ```typescript
72
+ * import { createPail } from "@visulima/pail";
73
+ *
74
+ * const logger = createPail({
75
+ * reporters: [new JsonReporter()]
76
+ * });
77
+ *
78
+ * logger.info("Application started", { version: "1.0.0" });
79
+ * // Outputs: {"level":"info","message":"Application started","context":[{"version":"1.0.0"}],...}
80
+ * ```
81
+ */
81
82
  declare class JsonReporter<L extends string = string> extends AbstractJsonReporter<L> {
82
83
  /**
83
- * Creates a new Browser JSON Reporter instance.
84
- * @param options Configuration options for JSON formatting
85
- */
84
+ * Creates a new Browser JSON Reporter instance.
85
+ * @param options Configuration options for JSON formatting
86
+ */
86
87
  constructor(options?: Partial<AbstractJsonReporterOptions>);
87
88
  /**
88
- * Outputs the JSON message to the browser console.
89
- *
90
- * Uses the appropriate console method based on the log level
91
- * (console.log, console.error, console.warn, etc.).
92
- * @param message The JSON-formatted log message
93
- * @param logLevel The log level determining which console method to use
94
- * @protected
95
- */
89
+ * Outputs the JSON message to the browser console.
90
+ *
91
+ * Uses the appropriate console method based on the log level
92
+ * (console.log, console.error, console.warn, etc.).
93
+ * @param message The JSON-formatted log message
94
+ * @param logLevel The log level determining which console method to use
95
+ * @protected
96
+ */
96
97
  protected override _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
97
98
  }
98
99
  export { AbstractJsonReporter, type AbstractJsonReporterOptions, JsonReporter };
@@ -1 +1 @@
1
- import{AbstractJsonReporter as e}from"../../packem_shared/AbstractJsonReporter-Bp_JCrMQ.js";import{default as p}from"../../packem_shared/JsonReporter-bmem9lcg.js";export{e as AbstractJsonReporter,p as JsonReporter};
1
+ import{AbstractJsonReporter as e}from"../../packem_shared/AbstractJsonReporter-BpWRnN0L.js";import{default as p}from"../../packem_shared/JsonReporter-Dd3kuj8X.js";export{e as AbstractJsonReporter,p as JsonReporter};
@@ -1,53 +1,52 @@
1
- import { A as AbstractJsonReporterOptions, a as AbstractJsonReporter } from "../../packem_shared/abstract-json-reporter.d-wfESoEa-.js";
2
- import { LiteralUnion } from 'type-fest';
3
- import { E as ExtendedRfc5424LogLevels, a as StreamAwareReporter } from "../../packem_shared/types.d-bWnqHJKL.js";
1
+ import { A as AbstractJsonReporterOptions, a as AbstractJsonReporter } from "../../packem_shared/abstract-json-reporter.d-B6NoO-hG.js";
2
+ import { E as ExtendedRfc5424LogLevels, L as LiteralUnion, a as StreamAwareReporter } from "../../packem_shared/types.d-4ge_rME4.js";
4
3
  import "../../packem_shared/index.d-T71KjNAr.js";
5
4
  import '@visulima/colorize';
6
5
  import '@visulima/interactive-manager';
7
6
  /**
8
- * Server JSON Reporter.
9
- *
10
- * A JSON reporter for Node.js server environments that outputs structured log data
11
- * to stdout/stderr streams. Routes error-level logs to stderr and others to stdout.
12
- * @template L - The log level type
13
- * @example
14
- * ```typescript
15
- * import { createPail } from "@visulima/pail";
16
- *
17
- * const logger = createPail({
18
- * reporters: [new JsonReporter()]
19
- * });
20
- *
21
- * logger.info("Server started", { port: 3000 });
22
- * logger.error("Database connection failed", error);
23
- * ```
24
- */
7
+ * Server JSON Reporter.
8
+ *
9
+ * A JSON reporter for Node.js server environments that outputs structured log data
10
+ * to stdout/stderr streams. Routes error-level logs to stderr and others to stdout.
11
+ * @template L - The log level type
12
+ * @example
13
+ * ```typescript
14
+ * import { createPail } from "@visulima/pail";
15
+ *
16
+ * const logger = createPail({
17
+ * reporters: [new JsonReporter()]
18
+ * });
19
+ *
20
+ * logger.info("Server started", { port: 3000 });
21
+ * logger.error("Database connection failed", error);
22
+ * ```
23
+ */
25
24
  declare class JsonReporter<L extends string = string> extends AbstractJsonReporter<L> implements StreamAwareReporter<L> {
26
25
  #private;
27
26
  /**
28
- * Creates a new Server JSON Reporter instance.
29
- * @param options Configuration options for JSON formatting
30
- */
27
+ * Creates a new Server JSON Reporter instance.
28
+ * @param options Configuration options for JSON formatting
29
+ */
31
30
  constructor(options?: Partial<AbstractJsonReporterOptions>);
32
31
  /**
33
- * Sets the stdout stream for the reporter.
34
- * @param stdout_ The writable stream to use for stdout output
35
- */
32
+ * Sets the stdout stream for the reporter.
33
+ * @param stdout_ The writable stream to use for stdout output
34
+ */
36
35
  setStdout(stdout_: NodeJS.WriteStream): void;
37
36
  /**
38
- * Sets the stderr stream for the reporter.
39
- * @param stderr_ The writable stream to use for stderr output
40
- */
37
+ * Sets the stderr stream for the reporter.
38
+ * @param stderr_ The writable stream to use for stderr output
39
+ */
41
40
  setStderr(stderr_: NodeJS.WriteStream): void;
42
41
  /**
43
- * Outputs the JSON message to the appropriate stream.
44
- *
45
- * Routes high-severity RFC 5424 levels (warning/error/critical/alert/emergency/trace)
46
- * to stderr, others to stdout.
47
- * @param message The JSON-formatted log message
48
- * @param logLevel The log level determining which stream to use
49
- * @protected
50
- */
42
+ * Outputs the JSON message to the appropriate stream.
43
+ *
44
+ * Routes high-severity RFC 5424 levels (warning/error/critical/alert/emergency/trace)
45
+ * to stderr, others to stdout.
46
+ * @param message The JSON-formatted log message
47
+ * @param logLevel The log level determining which stream to use
48
+ * @protected
49
+ */
51
50
  protected override _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
52
51
  }
53
52
  export { AbstractJsonReporter, type AbstractJsonReporterOptions, JsonReporter };
@@ -1 +1 @@
1
- import{AbstractJsonReporter as e}from"../../packem_shared/AbstractJsonReporter-w_bGGiD-.js";import{default as p}from"../../packem_shared/JsonReporter-Sd_lJGS-.js";export{e as AbstractJsonReporter,p as JsonReporter};
1
+ import{AbstractJsonReporter as e}from"../../packem_shared/AbstractJsonReporter-DxZwImm5.js";import{default as p}from"../../packem_shared/JsonReporter-9IcELa1m.js";export{e as AbstractJsonReporter,p as JsonReporter};
@@ -1,50 +1,51 @@
1
- import { D as DefaultLogTypes, L as LiteralUnion, a as LoggerTypesConfig, R as ReadonlyMeta, b as LoggerTypesAwareReporter } from "../../packem_shared/types.d-xxE3FOD3.js";
1
+ import { LiteralUnion } from 'type-fest';
2
+ import { D as DefaultLogTypes, L as LoggerTypesConfig, R as ReadonlyMeta, a as LoggerTypesAwareReporter } from "../../packem_shared/types.d-DGHeA2iJ.js";
2
3
  import '@visulima/colorize';
3
4
  import '@visulima/interactive-manager';
4
5
  /**
5
- * Abstract Pretty Reporter.
6
- *
7
- * Base class for pretty-printing reporters that format log messages with colors,
8
- * styles, and structured layout. Provides common functionality for styling options
9
- * and logger type configuration.
10
- * @template T - Custom logger type names
11
- * @template L - Log level types
12
- * @example
13
- * ```typescript
14
- * class CustomPrettyReporter extends AbstractPrettyReporter {
15
- * public log(meta: ReadonlyMeta) {
16
- * const formatted = this.formatMessage(meta);
17
- * console.log(formatted);
18
- * }
19
- * }
20
- * ```
21
- */
6
+ * Abstract Pretty Reporter.
7
+ *
8
+ * Base class for pretty-printing reporters that format log messages with colors,
9
+ * styles, and structured layout. Provides common functionality for styling options
10
+ * and logger type configuration.
11
+ * @template T - Custom logger type names
12
+ * @template L - Log level types
13
+ * @example
14
+ * ```typescript
15
+ * class CustomPrettyReporter extends AbstractPrettyReporter {
16
+ * public log(meta: ReadonlyMeta) {
17
+ * const formatted = this.formatMessage(meta);
18
+ * console.log(formatted);
19
+ * }
20
+ * }
21
+ * ```
22
+ */
22
23
  declare abstract class AbstractPrettyReporter<T extends string = string, L extends string = string> implements LoggerTypesAwareReporter<T, L> {
23
24
  /** Styling options for pretty formatting */
24
25
  protected readonly styles: PrettyStyleOptions;
25
26
  /** Logger type configurations for styling */
26
27
  protected loggerTypes: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
27
28
  /**
28
- * Creates a new AbstractPrettyReporter instance.
29
- * @param options Styling options for pretty formatting
30
- * @protected
31
- */
29
+ * Creates a new AbstractPrettyReporter instance.
30
+ * @param options Styling options for pretty formatting
31
+ * @protected
32
+ */
32
33
  protected constructor(options: Partial<PrettyStyleOptions>);
33
34
  /**
34
- * Sets the logger types configuration for styling.
35
- * @param types Logger type configurations with colors and labels
36
- */
35
+ * Sets the logger types configuration for styling.
36
+ * @param types Logger type configurations with colors and labels
37
+ */
37
38
  setLoggerTypes(types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>): void;
38
39
  /**
39
- * Logs a message with pretty formatting.
40
- * @param meta The log metadata to format and output
41
- * @abstract
42
- */
40
+ * Logs a message with pretty formatting.
41
+ * @param meta The log metadata to format and output
42
+ * @abstract
43
+ */
43
44
  abstract log(meta: ReadonlyMeta<L>): void;
44
45
  }
45
46
  /**
46
- * Options for configuring pretty reporter styling.
47
- */
47
+ * Options for configuring pretty reporter styling.
48
+ */
48
49
  type PrettyStyleOptions = {
49
50
  /** Bold styling options */
50
51
  bold: {
@@ -71,34 +72,34 @@ type PrettyStyleOptions = {
71
72
  };
72
73
  };
73
74
  /**
74
- * Browser Pretty Reporter.
75
- *
76
- * A pretty-printing reporter for browser environments that formats log messages
77
- * with colors and structured layout for console output. Uses browser-compatible
78
- * color formatting and console APIs.
79
- * @template T - Custom logger type names
80
- * @template L - Log level types
81
- * @example
82
- * ```typescript
83
- * import { createPail } from "@visulima/pail";
84
- *
85
- * const logger = createPail({
86
- * reporters: [new PrettyReporter({
87
- * bold: { label: true },
88
- * uppercase: { label: true }
89
- * })]
90
- * });
91
- *
92
- * logger.info("Application started");
93
- * logger.error("Something went wrong", error);
94
- * ```
95
- */
75
+ * Browser Pretty Reporter.
76
+ *
77
+ * A pretty-printing reporter for browser environments that formats log messages
78
+ * with colors and structured layout for console output. Uses browser-compatible
79
+ * color formatting and console APIs.
80
+ * @template T - Custom logger type names
81
+ * @template L - Log level types
82
+ * @example
83
+ * ```typescript
84
+ * import { createPail } from "@visulima/pail";
85
+ *
86
+ * const logger = createPail({
87
+ * reporters: [new PrettyReporter({
88
+ * bold: { label: true },
89
+ * uppercase: { label: true }
90
+ * })]
91
+ * });
92
+ *
93
+ * logger.info("Application started");
94
+ * logger.error("Something went wrong", error);
95
+ * ```
96
+ */
96
97
  declare class PrettyReporter<T extends string = string, L extends string = string> extends AbstractPrettyReporter<T, L> {
97
98
  #private;
98
99
  /**
99
- * Creates a new Browser Pretty Reporter instance.
100
- * @param options Styling options for pretty formatting
101
- */
100
+ * Creates a new Browser Pretty Reporter instance.
101
+ * @param options Styling options for pretty formatting
102
+ */
102
103
  constructor(options?: Partial<PrettyStyleOptions>);
103
104
  log(meta: ReadonlyMeta<L>): void;
104
105
  }
@@ -1 +1 @@
1
- import{default as t}from"../../packem_shared/PrettyReporter-DsHfKOU7.js";export{t as PrettyReporter};
1
+ import{default as t}from"../../packem_shared/PrettyReporter-BUWNEg3_.js";export{t as PrettyReporter};