konsole-logger 3.0.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.
@@ -0,0 +1,110 @@
1
+ (function(o,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(o=typeof globalThis<"u"?globalThis:o||self,h(o.Konsole={}))})(this,function(o){"use strict";var Z=Object.defineProperty;var ee=(o,h,g)=>h in o?Z(o,h,{enumerable:!0,configurable:!0,writable:!0,value:g}):o[h]=g;var a=(o,h,g)=>ee(o,typeof h!="symbol"?h+"":h,g);class h{constructor(e){a(this,"buffer");a(this,"head",0);a(this,"tail",0);a(this,"_size",0);a(this,"capacity");this.capacity=e,this.buffer=new Array(e)}push(e){this.buffer[this.tail]=e,this.tail=(this.tail+1)%this.capacity,this._size<this.capacity?this._size++:this.head=(this.head+1)%this.capacity}toArray(){const e=[];for(let t=0;t<this._size;t++){const s=(this.head+t)%this.capacity,i=this.buffer[s];i!==void 0&&e.push(i)}return e}slice(e,t){return this.toArray().slice(e,t)}filter(e){return this.toArray().filter(e)}retain(e){const t=this.filter(e);this.clear();for(const s of t)this.push(s);return this._size}clear(){this.buffer=new Array(this.capacity),this.head=0,this.tail=0,this._size=0}get size(){return this._size}get isEmpty(){return this._size===0}get isFull(){return this._size===this.capacity}}const g=typeof window<"u"&&typeof document<"u",p=typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function E(){return p?process.stdout.isTTY===!0:!1}function C(){if(typeof globalThis.fetch=="function")return globalThis.fetch.bind(globalThis)}const d={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},w={trace:"TRC",debug:"DBG",info:"INF",warn:"WRN",error:"ERR",fatal:"FTL"};function G(r){return r in d}class T{constructor(e){a(this,"name");a(this,"config");a(this,"fetchFn");a(this,"batch",[]);a(this,"flushTimer");a(this,"retryQueue",[]);a(this,"isProcessing",!1);const t=e.fetchImpl??C();if(typeof t!="function")throw new Error(`[Konsole HttpTransport: ${e.name}] fetch is not available. Requires Node.js >= 18, or pass fetchImpl (e.g. from "node-fetch").`);this.fetchFn=t,this.name=e.name,this.config={name:e.name,url:e.url,method:e.method??"POST",headers:e.headers??{},batchSize:e.batchSize??50,flushInterval:e.flushInterval??1e4,retryAttempts:e.retryAttempts??3,filter:e.filter,transform:e.transform},this.flushTimer=setInterval(()=>this.flush(),this.config.flushInterval)}write(e){this.config.filter&&!this.config.filter(e)||(this.batch.push(e),this.batch.length>=this.config.batchSize&&this.flush())}async flush(){if(this.batch.length===0)return;const e=this.batch.splice(0);await this.sendBatch(e,this.config.retryAttempts)}async destroy(){this.flushTimer&&clearInterval(this.flushTimer),await this.flush()}async sendBatch(e,t){if(this.isProcessing){this.retryQueue.push(e);return}this.isProcessing=!0;try{const s=e.map(l=>this.config.transform?this.config.transform(l):{level:d[l.level],levelName:l.level,time:l.timestamp.toISOString(),namespace:l.namespace,msg:l.msg,...l.fields}),i=await this.fetchFn(this.config.url,{method:this.config.method,headers:{"Content-Type":"application/json",...this.config.headers},body:JSON.stringify({transport:this.config.name,logs:s,sentAt:new Date().toISOString()})});if(!i.ok)throw new Error(`HTTP ${i.status}`)}catch(s){if(console.warn(`[Konsole HttpTransport: ${this.config.name}]`,s),t>0){const i=2**(this.config.retryAttempts-t)*1e3;setTimeout(()=>void this.sendBatch(e,t-1),i)}}finally{if(this.isProcessing=!1,this.retryQueue.length>0){const s=this.retryQueue.shift();this.sendBatch(s,this.config.retryAttempts)}}}}const D="\x1B[0m",u={bold:"\x1B[1m",dim:"\x1B[2m",gray:"\x1B[90m",red:"\x1B[31m",brightRed:"\x1B[91m",green:"\x1B[32m",yellow:"\x1B[33m",cyan:"\x1B[36m"},M=!p||typeof process.env.NO_COLOR<"u"||process.env.FORCE_COLOR==="0"?!1:process.env.FORCE_COLOR==="1"?!0:E();function m(r,e){return M?`${r}${e}${D}`:e}const V={trace:r=>m(u.dim+u.gray,r),debug:r=>m(u.cyan,r),info:r=>m(u.bold+u.green,r),warn:r=>m(u.bold+u.yellow,r),error:r=>m(u.bold+u.red,r),fatal:r=>m(u.bold+u.brightRed,r)};function I(r){const e=String(r.getHours()).padStart(2,"0"),t=String(r.getMinutes()).padStart(2,"0"),s=String(r.getSeconds()).padStart(2,"0"),i=String(r.getMilliseconds()).padStart(3,"0");return`${e}:${t}:${s}.${i}`}function K(r){if(r instanceof Error)return`"${r.message}"`;if(typeof r=="string")return r.includes(" ")?`"${r}"`:r;if(typeof r=="object"&&r!==null)try{return JSON.stringify(r)}catch{return"[Circular]"}return String(r)}function O(r){const e=Object.entries(r);return e.length===0?"":e.map(([t,s])=>`${t}=${K(s)}`).join(" ")}function P(r){return r!=="error"&&r!=="fatal"}class B{write(e){const t=m(u.gray,I(e.timestamp)),s=V[e.level](w[e.level]),i=m(u.dim,`[${e.namespace}]`),l=O(e.fields),c=l?m(u.gray,l):"",f=[t,s,i,e.msg,c].filter(Boolean).join(" ");p?(P(e.level)?process.stdout:process.stderr).write(f+`
2
+ `):console.log(f)}}class v{write(e){const t=JSON.stringify({level:d[e.level],levelName:e.level,time:e.timestamp.toISOString(),namespace:e.namespace,msg:e.msg,...e.fields});p?(P(e.level)?process.stdout:process.stderr).write(t+`
3
+ `):console.log(t)}}class x{write(e){const t=O(e.fields),s=[I(e.timestamp),w[e.level],`[${e.namespace}]`,e.msg,t].filter(Boolean);console.log(s.join(" "))}}const J={trace:"background:#9E9E9E;color:#fff;border-radius:2px;padding:1px 5px;font-size:11px;font-weight:700",debug:"background:#00BCD4;color:#fff;border-radius:2px;padding:1px 5px;font-size:11px;font-weight:700",info:"background:#4CAF50;color:#fff;border-radius:2px;padding:1px 5px;font-size:11px;font-weight:700",warn:"background:#FF9800;color:#fff;border-radius:2px;padding:1px 5px;font-size:11px;font-weight:700",error:"background:#F44336;color:#fff;border-radius:2px;padding:1px 5px;font-size:11px;font-weight:700",fatal:"background:#880E4F;color:#fff;border-radius:2px;padding:1px 5px;font-size:11px;font-weight:700"},_={trace:console.debug.bind(console),debug:console.debug.bind(console),info:console.info.bind(console),warn:console.warn.bind(console),error:console.error.bind(console),fatal:console.error.bind(console)};class F{write(e){const t=O(e.fields),s=e.messages.filter(f=>typeof f=="object"&&f!==null);let i=`%c ${w[e.level]} %c [${e.namespace}] %c${e.msg}`;const l=[J[e.level],"color:#9E9E9E;font-weight:normal","color:inherit;font-weight:normal"];t&&(i+=` %c${t}`,l.push("color:#9E9E9E;font-style:italic"));const c=_[e.level];c(i,...l,...s)}}class N{write(e){}}function j(){return g?new F:E()?new B:new v}function A(r){switch(r){case"pretty":return new B;case"json":return new v;case"text":return new x;case"browser":return new F;case"silent":return new N;default:return j()}}function z(r){return typeof r.url=="string"}const n=class n{constructor(e={}){a(this,"logs");a(this,"namespace");a(this,"bindings",{});a(this,"criteria");a(this,"formatter");a(this,"minLevelValue");a(this,"defaultBatchSize");a(this,"currentBatchStart",0);a(this,"retentionPeriod");a(this,"maxLogs");a(this,"cleanupIntervalId");a(this,"useWorker");a(this,"transports",[]);const{namespace:t="Global",level:s="trace",format:i="auto",criteria:l=!0,defaultBatchSize:c=100,retentionPeriod:f=48*60*60*1e3,cleanupInterval:b=60*60*1e3,maxLogs:y=1e4,useWorker:k=!1,transports:S=[]}=e;this.namespace=t,this.criteria=l,this.minLevelValue=d[s],this.formatter=A(i),this.defaultBatchSize=c,this.retentionPeriod=f,this.maxLogs=y,this.useWorker=k&&typeof Worker<"u",k&&!this.useWorker&&console.warn("[Konsole] Web Worker is not available in this environment (useWorker ignored). In Node.js, offloaded worker processing is not yet supported."),this.logs=new h(y);for(const $ of S)this.transports.push(z($)?new T($):$);this.useWorker&&this.initWorker(S.filter(z)),this.useWorker||(this.cleanupIntervalId=setInterval(()=>this.flushOldLogs(),b)),n.instances.set(t,this),this.initGlobalFlag()}static getLogger(e="Global"){const t=n.instances.get(e);return t||(console.warn(`[Konsole] Logger with namespace "${e}" not found, creating a new one.`),new n({namespace:e}))}static getNamespaces(){return Array.from(n.instances.keys())}static exposeToWindow(){typeof window>"u"||(window.__Konsole={getLogger:(e="Global")=>{const t=n.getLogger(e);return{viewLogs:s=>t.viewLogs(s)}},listLoggers:()=>Array.from(n.instances.keys()),enableAll:()=>n.enableGlobalPrint(!0),disableAll:()=>n.enableGlobalPrint(!1)})}static enableGlobalPrint(e){globalThis[n.globalFlagName]=e}static addGlobalTransport(e){n.instances.forEach(t=>t.addTransport(e))}child(e,t){return n.createChild(this,e,t)}static createChild(e,t,s){const i=Object.create(n.prototype);return i.logs=e.logs,i.formatter=e.formatter,i.useWorker=e.useWorker,i.transports=[...e.transports],i.criteria=e.criteria,i.defaultBatchSize=e.defaultBatchSize,i.retentionPeriod=e.retentionPeriod,i.maxLogs=e.maxLogs,i.namespace=(s==null?void 0:s.namespace)??e.namespace,i.minLevelValue=s!=null&&s.level?d[s.level]:e.minLevelValue,i.bindings={...e.bindings,...t},i.currentBatchStart=0,i}trace(...e){this.addLog("trace",e)}debug(...e){this.addLog("debug",e)}info(...e){this.addLog("info",e)}log(...e){this.addLog("info",e)}warn(...e){this.addLog("warn",e)}error(...e){this.addLog("error",e)}fatal(...e){this.addLog("fatal",e)}setLevel(e){this.minLevelValue=d[e]}setCriteria(e){this.criteria=e}addTransport(e){this.transports.push(z(e)?new T(e):e)}async flushTransports(){await Promise.all(this.transports.map(e=>{var t;return(t=e.flush)==null?void 0:t.call(e)}))}viewLogs(e=this.defaultBatchSize){const t=this.logs.toArray();if(this.currentBatchStart>=t.length){console.log("[Konsole] No more logs."),this.currentBatchStart=0;return}const s=Math.min(this.currentBatchStart+e,t.length),l=t.slice(this.currentBatchStart,s).map(c=>({time:c.timestamp.toISOString(),level:c.level,namespace:c.namespace,msg:c.msg,fields:Object.keys(c.fields).length?JSON.stringify(c.fields):""}));console.table(l),this.currentBatchStart=s,this.currentBatchStart>=t.length&&console.log("[Konsole] End of logs. Call viewLogs() again to restart.")}getLogs(){return this.logs.toArray()}getLogsAsync(){return this.useWorker&&n.sharedWorker?new Promise(e=>{var s;const t=`${this.namespace}-${Date.now()}-${Math.random()}`;n.workerPendingCallbacks.set(t,e),(s=n.sharedWorker)==null||s.postMessage({type:"GET_LOGS",namespace:this.namespace,requestId:t})}):Promise.resolve(this.getLogs())}clearLogs(){this.logs.clear(),this.currentBatchStart=0,this.useWorker&&n.sharedWorker&&n.sharedWorker.postMessage({type:"CLEAR_LOGS",namespace:this.namespace})}resetBatch(){this.currentBatchStart=0}getStats(){const e=this.logs.size;return{logCount:e,maxLogs:this.maxLogs,memoryUsage:`${e}/${this.maxLogs} (${(e/this.maxLogs*100).toFixed(1)}%)`}}async destroy(){this.cleanupIntervalId&&clearInterval(this.cleanupIntervalId),await Promise.all(this.transports.map(e=>e.destroy())),n.instances.delete(this.namespace)}parseArgs(e){if(e.length===0)return{msg:"",fields:{}};const t=e[0];if(t instanceof Error)return{msg:t.message,fields:{err:t}};if(typeof t=="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof Error)&&"msg"in t){const{msg:s,...i}=t;return{msg:String(s),fields:i}}return typeof t=="string"?e.length===2&&typeof e[1]=="object"&&e[1]!==null&&!Array.isArray(e[1])&&!(e[1]instanceof Error)?{msg:t,fields:e[1]}:{msg:e.map(s=>typeof s=="object"&&s!==null?JSON.stringify(s):String(s)).join(" "),fields:{}}:{msg:e.map(s=>typeof s=="object"&&s!==null?JSON.stringify(s):String(s)).join(" "),fields:{}}}addLog(e,t){if(d[e]<this.minLevelValue)return;const{msg:s,fields:i}=this.parseArgs(t),l={msg:s,messages:t,fields:{...this.bindings,...i},timestamp:new Date,namespace:this.namespace,level:e,levelValue:d[e],logtype:e};if(this.logs.push(l),this.useWorker&&n.sharedWorker){const c={msg:s,messages:t.map(f=>typeof f=="object"?JSON.stringify(f):f),fields:i,timestamp:l.timestamp.toISOString(),namespace:this.namespace,level:e,levelValue:d[e],logtype:e};n.sharedWorker.postMessage({type:"ADD_LOG",namespace:this.namespace,payload:c})}if(!this.useWorker)for(const c of this.transports)c.write(l);this.outputLog(l)}outputLog(e){!(globalThis[n.globalFlagName]===!0)&&(typeof this.criteria=="boolean"&&!this.criteria||typeof this.criteria=="function"&&!this.criteria(e))||this.formatter.write(e)}initGlobalFlag(){n.globalFlagName in globalThis||(globalThis[n.globalFlagName]=!1)}flushOldLogs(){const e=new Date(Date.now()-this.retentionPeriod);this.logs.retain(t=>t.timestamp>e)}initWorker(e){var t;if(!n.sharedWorker)try{const s=new Blob([this.getWorkerCode()],{type:"application/javascript"}),i=URL.createObjectURL(s);n.sharedWorker=new Worker(i),n.sharedWorker.onmessage=l=>{const{type:c,payload:f,requestId:b}=l.data;if(c==="LOGS_RESPONSE"&&b){const y=n.workerPendingCallbacks.get(b);if(y){const k=f.map(S=>({...S,timestamp:new Date(S.timestamp)}));y(k),n.workerPendingCallbacks.delete(b)}}}}catch{console.warn("[Konsole] Failed to initialize worker, falling back to main thread."),this.useWorker=!1;return}(t=n.sharedWorker)==null||t.postMessage({type:"CONFIGURE",namespace:this.namespace,payload:{maxLogs:this.maxLogs,retentionPeriod:this.retentionPeriod,transports:e.map(s=>({name:s.name,url:s.url,method:s.method,headers:s.headers,batchSize:s.batchSize,flushInterval:s.flushInterval,retryAttempts:s.retryAttempts}))}})}getWorkerCode(){return`
4
+ const logBuffers = new Map();
5
+ const bufferConfigs = new Map();
6
+ const transports = new Map();
7
+
8
+ class CircularBuffer {
9
+ constructor(capacity) {
10
+ this.capacity = capacity;
11
+ this.buffer = new Array(capacity);
12
+ this.head = 0;
13
+ this.tail = 0;
14
+ this._size = 0;
15
+ }
16
+ push(item) {
17
+ this.buffer[this.tail] = item;
18
+ this.tail = (this.tail + 1) % this.capacity;
19
+ if (this._size < this.capacity) { this._size++; }
20
+ else { this.head = (this.head + 1) % this.capacity; }
21
+ }
22
+ toArray() {
23
+ const out = [];
24
+ for (let i = 0; i < this._size; i++) {
25
+ const item = this.buffer[(this.head + i) % this.capacity];
26
+ if (item !== undefined) out.push(item);
27
+ }
28
+ return out;
29
+ }
30
+ retain(fn) {
31
+ const kept = this.toArray().filter(fn);
32
+ this.clear();
33
+ kept.forEach(item => this.push(item));
34
+ return this._size;
35
+ }
36
+ clear() {
37
+ this.buffer = new Array(this.capacity);
38
+ this.head = this.tail = this._size = 0;
39
+ }
40
+ get size() { return this._size; }
41
+ }
42
+
43
+ function getBuffer(ns) {
44
+ let buf = logBuffers.get(ns);
45
+ if (!buf) {
46
+ const cfg = bufferConfigs.get(ns) || { maxLogs: 10000 };
47
+ buf = new CircularBuffer(cfg.maxLogs);
48
+ logBuffers.set(ns, buf);
49
+ }
50
+ return buf;
51
+ }
52
+
53
+ async function flush(t) {
54
+ if (!t.batch.length) return;
55
+ const batch = t.batch.splice(0);
56
+ try {
57
+ await fetch(t.cfg.url, {
58
+ method: t.cfg.method || 'POST',
59
+ headers: { 'Content-Type': 'application/json', ...(t.cfg.headers || {}) },
60
+ body: JSON.stringify({ transport: t.cfg.name, logs: batch, sentAt: new Date().toISOString() }),
61
+ });
62
+ } catch (e) { console.warn('[Konsole Worker]', e); }
63
+ }
64
+
65
+ self.onmessage = ({ data: { type, payload, namespace: ns, requestId } }) => {
66
+ switch (type) {
67
+ case 'ADD_LOG':
68
+ if (ns && payload) {
69
+ getBuffer(ns).push(payload);
70
+ transports.forEach(t => {
71
+ t.batch.push(payload);
72
+ if (t.batch.length >= (t.cfg.batchSize || 50)) flush(t);
73
+ });
74
+ }
75
+ break;
76
+ case 'GET_LOGS':
77
+ if (ns) self.postMessage({ type: 'LOGS_RESPONSE', payload: (logBuffers.get(ns) || { toArray: () => [] }).toArray(), ns, requestId });
78
+ break;
79
+ case 'CLEAR_LOGS':
80
+ if (ns) { const b = logBuffers.get(ns); if (b) b.clear(); }
81
+ break;
82
+ case 'FLUSH_OLD':
83
+ if (ns) {
84
+ const b = logBuffers.get(ns), cfg = bufferConfigs.get(ns);
85
+ if (b && cfg) { const cut = new Date(Date.now() - cfg.retentionPeriod).toISOString(); b.retain(e => e.timestamp > cut); }
86
+ }
87
+ break;
88
+ case 'CONFIGURE':
89
+ if (ns && payload) {
90
+ bufferConfigs.set(ns, payload);
91
+ (payload.transports || []).forEach(tc => {
92
+ const t = { cfg: tc, batch: [] };
93
+ t.timer = setInterval(() => flush(t), tc.flushInterval || 10000);
94
+ transports.set(tc.name, t);
95
+ });
96
+ }
97
+ break;
98
+ }
99
+ };
100
+
101
+ setInterval(() => {
102
+ logBuffers.forEach((buf, ns) => {
103
+ const cfg = bufferConfigs.get(ns);
104
+ if (cfg) { const cut = new Date(Date.now() - cfg.retentionPeriod).toISOString(); buf.retain(e => e.timestamp > cut); }
105
+ });
106
+ }, 3600000);
107
+ `}};a(n,"instances",new Map),a(n,"globalFlagName","__KonsolePrintEnabled__"),a(n,"sharedWorker",null),a(n,"workerPendingCallbacks",new Map);let L=n;class H{constructor(e={}){a(this,"name");a(this,"formatter");a(this,"filter");this.name=e.name??"console",this.formatter=A(e.format??"auto"),this.filter=e.filter}write(e){this.filter&&!this.filter(e)||this.formatter.write(e)}async destroy(){}}function U(r){if(r instanceof Error)return r.message;if(typeof r=="string")return r;if(typeof r=="object"&&r!==null)try{return JSON.stringify(r)}catch{return"[Circular]"}return String(r)}function q(r){return JSON.stringify({level:d[r.level],levelName:r.level,time:r.timestamp.toISOString(),namespace:r.namespace,msg:r.msg,...r.fields})}function Q(r){const e=String(r.timestamp.getHours()).padStart(2,"0"),t=String(r.timestamp.getMinutes()).padStart(2,"0"),s=String(r.timestamp.getSeconds()).padStart(2,"0"),i=String(r.timestamp.getMilliseconds()).padStart(3,"0"),l=Object.entries(r.fields).map(([c,f])=>`${c}=${U(f)}`).join(" ");return[`${e}:${t}:${s}.${i}`,w[r.level],`[${r.namespace}]`,r.msg,l].filter(Boolean).join(" ")}function W(r,e){return e==="json"?q(r):Q(r)}class R{constructor(e){a(this,"name");a(this,"stream");a(this,"format");a(this,"filter");if(!p)throw new Error("[Konsole StreamTransport] StreamTransport is only available in Node.js.");this.name=e.name??"stream",this.stream=e.stream,this.format=e.format??"json",this.filter=e.filter,this.stream.on("error",t=>{console.error(`[Konsole StreamTransport: ${this.name}] Stream error: ${t.message}`)})}write(e){if(!(this.filter&&!this.filter(e)))try{this.stream.write(W(e,this.format)+`
108
+ `)}catch(t){console.error(`[Konsole StreamTransport: ${this.name}] Write error:`,t)}}async destroy(){return new Promise(e=>{this.stream.end(()=>e())})}}class Y extends R{constructor(t){if(!p)throw new Error("[Konsole FileTransport] FileTransport is only available in Node.js.");super({stream:X(),name:t.name??`file:${t.path}`,format:t.format??"json",filter:t.filter});a(this,"isReady",!1);a(this,"pendingEntries",[]);a(this,"filePath");a(this,"initialized");this.filePath=t.path,this.initialized=this.openFile(t.flags??"a")}write(t){if(!(this.filter&&!this.filter(t))){if(!this.isReady){this.pendingEntries.push(t);return}try{this.stream.write(W(t,this.format)+`
109
+ `)}catch(s){console.error(`[Konsole FileTransport: ${this.name}] Write error:`,s)}}}ready(){return this.initialized}async openFile(t){var c;const s=await import("node:fs"),i=s.createWriteStream??((c=s.default)==null?void 0:c.createWriteStream);if(typeof i!="function")throw new Error("[Konsole FileTransport] Failed to load node:fs.createWriteStream");const l=i(this.filePath,{flags:t});l.on("error",f=>{console.error(`[Konsole FileTransport: ${this.name}] File error: ${f.message}`)}),this.stream=l,this.isReady=!0;for(const f of this.pendingEntries)this.stream.write(W(f,this.format)+`
110
+ `);this.pendingEntries=[]}}function X(){return{write:()=>!0,end:r=>{r==null||r()},on:function(){return this}}}o.BrowserFormatter=F,o.CircularBuffer=h,o.ConsoleTransport=H,o.FileTransport=Y,o.HttpTransport=T,o.JsonFormatter=v,o.Konsole=L,o.LEVELS=d,o.LEVEL_LABELS=w,o.PrettyFormatter=B,o.SilentFormatter=N,o.StreamTransport=R,o.TextFormatter=x,o.createAutoFormatter=j,o.createFormatter=A,o.default=L,o.getGlobalFetch=C,o.isBrowser=g,o.isNode=p,o.isTTY=E,o.isValidLevel=G,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "konsole-logger",
3
+ "version": "3.0.0",
4
+ "type": "module",
5
+ "description": "Structured, namespaced logging for browser and Node.js — numeric log levels, child loggers, beautiful terminal output, flexible transports",
6
+ "main": "./dist/konsole.umd.cjs",
7
+ "module": "./dist/konsole.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/konsole.js",
12
+ "require": "./dist/konsole.umd.cjs",
13
+ "types": "./dist/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "dev": "vite",
21
+ "build": "tsc && vite build",
22
+ "preview": "vite preview",
23
+ "docs:dev": "vitepress dev docs",
24
+ "docs:build": "vitepress build docs",
25
+ "docs:preview": "vitepress preview docs",
26
+ "test": "vitest",
27
+ "test:run": "vitest run",
28
+ "test:coverage": "vitest run --coverage",
29
+ "prepublishOnly": "npm run build",
30
+ "site:install": "npm install --prefix site",
31
+ "site:dev": "npm run --prefix site dev",
32
+ "site:build": "npm run --prefix site build"
33
+ },
34
+ "keywords": [
35
+ "logger",
36
+ "logging",
37
+ "console",
38
+ "debug",
39
+ "typescript",
40
+ "namespaced-logging",
41
+ "structured-logging",
42
+ "browser",
43
+ "node",
44
+ "pino",
45
+ "pino-compatible",
46
+ "pino-alternative",
47
+ "ndjson",
48
+ "child-logger"
49
+ ],
50
+ "author": "Sakti Kumar Chourasia",
51
+ "license": "MIT",
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "git+https://github.com/shakcho/Konsole.git"
55
+ },
56
+ "bugs": {
57
+ "url": "https://github.com/shakcho/Konsole/issues"
58
+ },
59
+ "homepage": "https://github.com/shakcho/Konsole",
60
+ "engines": {
61
+ "node": ">=18.0.0"
62
+ },
63
+ "devDependencies": {
64
+ "@types/node": "^20.19.37",
65
+ "@vitest/coverage-v8": "^4.1.0",
66
+ "typescript": "^5.2.2",
67
+ "vite": "^5.0.8",
68
+ "vite-plugin-dts": "^4.3.0",
69
+ "vitepress": "^1.5.0",
70
+ "vitest": "^3.2.4"
71
+ }
72
+ }