logan-logger 2.3.0 → 2.4.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.
- package/dist/browser.cjs +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/bun.cjs +1 -1
- package/dist/bun.mjs +3 -3
- package/dist/chunks/config-BIFVBkeG.cjs +1 -0
- package/dist/chunks/{config-BARemYd2.mjs → config-C0Vj3nIk.mjs} +102 -94
- package/dist/chunks/{config-file-Cyys9_yO.cjs → config-file-BNPm7ZNS.cjs} +1 -1
- package/dist/chunks/{config-file-BkYtEgDX.mjs → config-file-CmxNUX1Z.mjs} +1 -1
- package/dist/chunks/{file-transport-CCCBjSLN.mjs → file-transport-Y2ZoG0re.mjs} +2 -2
- package/dist/chunks/{file-transport-CZW_2423.cjs → file-transport-oFpf1vbE.cjs} +1 -1
- package/dist/core/internal.d.cts +47 -0
- package/dist/core/internal.d.mts +47 -0
- package/dist/core/internal.d.ts +47 -0
- package/dist/core/logger.d.cts +8 -0
- package/dist/core/logger.d.mts +8 -0
- package/dist/core/logger.d.ts +8 -0
- package/dist/deno.cjs +1 -1
- package/dist/deno.mjs +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/node.cjs +1 -1
- package/dist/node.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunks/config-IINkkZ84.cjs +0 -1
package/dist/browser.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/config-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/config-BIFVBkeG.cjs");function t(){return typeof process<`u`&&process.env?process.env.NODE_ENV||process.env.NEXT_PUBLIC_APP_ENV||process.env.ENVIRONMENT||`development`:typeof window<`u`&&globalThis.__ENV__||`development`}function n(t){switch(t){case`production`:return e._.ERROR;case`staging`:case`test`:return e._.WARN;case`development`:case`dev`:return e._.DEBUG;default:return e._.INFO}}function r(t={}){let n=t.ignoreEnvironment?{}:e.n();return new e.u(e.r(t,n))}function i(){let e=t();return r({level:n(e),colorize:e!==`production`,timestamp:!0,format:e===`production`?`json`:`text`})}var a=i(),o={debug:(e,t)=>a.debug(e,t),info:(e,t)=>a.info(e,t),warn:(e,t)=>a.warn(e,t),error:(e,t)=>a.error(e,t)};exports.BrowserLogger=e.u,exports.ConsoleGroupLogger=e.d,exports.LogLevel=e._,exports.PerformanceLogger=e.f,exports.createLogger=r,exports.createLoggerForEnvironment=i,exports.detectRuntime=e.v,exports.filterSensitiveData=e.p,exports.formatLevel=e.c,exports.formatLogEntry=e.l,exports.isBrowser=e.y,exports.isBun=e.b,exports.isDeno=e.x,exports.isNode=e.S,exports.log=o,exports.logger=a,exports.safeStringify=e.m,exports.serializeError=e.h;
|
package/dist/browser.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as e, _ as t, b as n, c as r, d as i, f as a, h as o, l as s, m as c, n as l, p as u, r as d, u as f, v as p, x as m, y as h } from "./chunks/config-
|
|
1
|
+
import { S as e, _ as t, b as n, c as r, d as i, f as a, h as o, l as s, m as c, n as l, p as u, r as d, u as f, v as p, x as m, y as h } from "./chunks/config-C0Vj3nIk.mjs";
|
|
2
2
|
//#region src/browser.ts
|
|
3
3
|
function g() {
|
|
4
4
|
return typeof process < "u" && process.env ? process.env.NODE_ENV || process.env.NEXT_PUBLIC_APP_ENV || process.env.ENVIRONMENT || "development" : typeof window < "u" && globalThis.__ENV__ || "development";
|
package/dist/bun.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/config-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/config-BIFVBkeG.cjs"),t=require("./chunks/config-file-BNPm7ZNS.cjs"),n=require("./chunks/file-transport-oFpf1vbE.cjs");exports.ConsoleTransport=t.l,exports.FileTransport=n.t,exports.NodeLogger=t.s,exports.createLogger=t.r,exports.createLoggerForEnvironment=t.i,exports.createTransports=t.u,exports.detectRuntime=e.v,exports.filterSensitiveData=e.p,exports.formatLevel=e.c,exports.formatLogEntry=e.l,exports.getDefaultConfig=e.t,exports.isBrowser=e.y,exports.isBun=e.b,exports.isDeno=e.x,exports.isNode=e.S,exports.loadConfigFromEnvironment=e.n,exports.loadConfigFromFile=t.t,exports.mergeConfigs=e.r,exports.registerTransport=t.f,exports.resetEnvironmentWarnings=e.i,exports.safeStringify=e.m,exports.serializeError=e.h,exports.shouldColorize=e.a,exports.tryParseLogLevel=e.o;
|
package/dist/bun.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as e, a as t, b as n, c as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, t as f, v as p, x as m, y as h } from "./chunks/config-
|
|
2
|
-
import { f as g, i as _, l as v, r as y, s as b, t as x, u as S } from "./chunks/config-file-
|
|
3
|
-
import { t as C } from "./chunks/file-transport-
|
|
1
|
+
import { S as e, a as t, b as n, c as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, t as f, v as p, x as m, y as h } from "./chunks/config-C0Vj3nIk.mjs";
|
|
2
|
+
import { f as g, i as _, l as v, r as y, s as b, t as x, u as S } from "./chunks/config-file-CmxNUX1Z.mjs";
|
|
3
|
+
import { t as C } from "./chunks/file-transport-Y2ZoG0re.mjs";
|
|
4
4
|
export { v as ConsoleTransport, C as FileTransport, b as NodeLogger, y as createLogger, _ as createLoggerForEnvironment, S as createTransports, p as detectRuntime, u as filterSensitiveData, r as formatLevel, o as formatLogEntry, f as getDefaultConfig, h as isBrowser, n as isBun, m as isDeno, e as isNode, c as loadConfigFromEnvironment, x as loadConfigFromFile, d as mergeConfigs, g as registerTransport, a as resetEnvironmentWarnings, s as safeStringify, i as serializeError, t as shouldColorize, l as tryParseLogLevel };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){let e=t();return{name:e,version:n(e),capabilities:r(e)}}function t(){return globalThis.Deno===void 0?globalThis.Bun===void 0?typeof window<`u`&&typeof document<`u`?`browser`:typeof globalThis.importScripts==`function`&&typeof window>`u`?`webworker`:typeof process<`u`&&process.versions&&process.versions.node?`node`:`unknown`:`bun`:`deno`}function n(e){switch(e){case`node`:return typeof process<`u`?process.version:void 0;case`deno`:return globalThis.Deno===void 0?void 0:globalThis.Deno.version?.deno;case`bun`:return globalThis.Bun===void 0?void 0:globalThis.Bun.version;case`browser`:return typeof navigator<`u`?navigator.userAgent:void 0;default:return}}function r(e){switch(e){case`node`:return{fileSystem:!0,colorSupport:!0,processInfo:!0,streams:!0};case`deno`:return{fileSystem:!0,colorSupport:!0,processInfo:!0,streams:!0};case`bun`:return{fileSystem:!0,colorSupport:!0,processInfo:!0,streams:!0};case`browser`:return{fileSystem:!1,colorSupport:!0,processInfo:!1,streams:!1};case`webworker`:return{fileSystem:!1,colorSupport:!1,processInfo:!1,streams:!1};default:return{fileSystem:!1,colorSupport:!1,processInfo:!1,streams:!1}}}function i(){return t()===`node`}function a(){return t()===`browser`}function o(){return t()===`deno`}function s(){return t()===`bun`}var c=Symbol.for(`logan-logger.internals`);function l(e){return e[c]??{}}var u=function(e){return e[e.DEBUG=0]=`DEBUG`,e[e.INFO=1]=`INFO`,e[e.WARN=2]=`WARN`,e[e.ERROR=3]=`ERROR`,e[e.SILENT=4]=`SILENT`,e}({}),d=()=>new Date,f=class{constructor(t={}){this.childMetadata={},this.config=t,this.level=t.level??u.INFO;let n=l(t);this.now=n.now??d,this.runtime=n.runtime??e().name,this.childMetadata={...t.metadata}}debug(e,t){this.log(u.DEBUG,e,t)}info(e,t){this.log(u.INFO,e,t)}warn(e,t){this.log(u.WARN,e,t)}error(e,t){this.log(u.ERROR,e,t)}log(e,t,n){if(!this.shouldLog(e))return;let r=typeof t==`function`?t():t,i={...this.childMetadata,...n},a={timestamp:this.now(),level:e,message:r,metadata:Object.keys(i).length>0?i:void 0,runtime:this.runtime};this.writeLog(a)}setLevel(e){this.level=e}getLevel(){return this.level}child(e){let t=this.createChild();return t.childMetadata={...this.childMetadata,...e},t}shouldLog(e){return e>=this.level}},p=100;function m(e,t,n,r){if(e===void 0)return`[undefined]`;if(typeof e==`bigint`)return`[BigInt: ${e.toString()}]`;if(typeof e==`symbol`)return`[Symbol: ${e.toString()}]`;if(typeof e==`function`)return`[Function: ${e.name||`anonymous`}]`;if(typeof e!=`object`||!e)return e;let i=e;if(t.has(i))return`[Circular]`;if(n>=r)return`[MaxDepth]`;t.add(i);try{if(i instanceof Error)return h(E(i),t,n,r);let e=i.toJSON;if(typeof e==`function`)return m(e.call(i),t,n,r);if(Array.isArray(i)){let e=[];for(let a=0;a<i.length;a++)e.push(m(i[a],t,n+1,r));return e}return h(i,t,n,r)}finally{t.delete(i)}}function h(e,t,n,r){let i={};for(let[a,o]of Object.entries(e))i[a]=m(o,t,n+1,r);return i}function g(e,t,n={}){let r=n.maxDepth??p;return JSON.stringify(m(e,new Set,0,r),null,t)}var _=[`password`,`token`,`secret`,`key`,`auth`,`authorization`,`apikey`,`authtoken`,`accesstoken`,`secretkey`],v=/[A-Z]+(?![a-z])|[A-Z]?[a-z]+|[0-9]+/g;function y(e){return(e.match(v)??[]).map(e=>e.toLowerCase())}function b(e){let t=[];for(let n of e){let e=y(n);if(e.length===0)continue;let r=e.join(``);t.push({tokens:e.map(e=>[e,`${e}s`]),joined:r,joinedPlural:`${r}s`})}return t}function x(e,t){let n=y(e);if(n.length===0)return!1;let r=n.join(``);return t.some(e=>e.tokens.every(([e,t])=>n.includes(e)||n.includes(t))||r===e.joined||r===e.joinedPlural)}function S(e,t){if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let[r,i]of Object.entries(e))n[r]=x(r,t)?`[REDACTED]`:typeof i==`object`&&i?S(i,t):i;return n}function C(e,t=_){return S(e,b(t))}var w=[`name`,`message`,`stack`];function T(e,t){let n=Object.getOwnPropertyDescriptor(e,t);if(n){if(n.get)try{return n.get.call(e)}catch{return`[Throws]`}return n.value}}function E(e){if(!(e instanceof Error))return e;let t={name:e.name,message:e.message};e.stack!==void 0&&(t.stack=e.stack);for(let n of Object.getOwnPropertyNames(e))w.includes(n)||(t[n]=T(e,n));return t}var D=class e extends f{constructor(e={}){super(e)}writeLog(e){let t=this.formatMessage(e),n=this.getConsoleStyle(e.level),r=`%c${t}${e.metadata?` ${g(e.metadata)}`:``}`;switch(e.level){case u.DEBUG:console.debug?console.debug(r,n):console.log(r,n);break;case u.INFO:console.info(r,n);break;case u.WARN:console.warn(r,n);break;case u.ERROR:console.error(r,n)}}createChild(){return new e(this.config)}formatMessage(e){return`[${e.timestamp.toISOString()}] ${u[e.level].toUpperCase()}: ${e.message}`}getConsoleStyle(e){if(!this.config.colorize)return``;switch(e){case u.DEBUG:return`color: #888; font-weight: normal;`;case u.INFO:return`color: #007acc; font-weight: normal;`;case u.WARN:return`color: #ff8c00; font-weight: bold;`;case u.ERROR:return`color: #dc3545; font-weight: bold;`;default:return``}}shouldLogInProduction(){return(globalThis.process?.env?.NODE_ENV||globalThis.process?.env?.NEXT_PUBLIC_APP_ENV||`development`)!==`production`||this.level<=u.ERROR}shouldLog(e){return!this.shouldLogInProduction()&&e<u.ERROR?!1:super.shouldLog(e)}},O=class extends D{constructor(...e){super(...e),this.groupStack=[]}group(e){console.group(e),this.groupStack.push(e)}groupCollapsed(e){console.groupCollapsed(e),this.groupStack.push(e)}groupEnd(){console.groupEnd(),this.groupStack.pop()}getCurrentGroupStack(){return[...this.groupStack]}getCurrentGroupPath(){return this.groupStack.join(` > `)}time(e){console.time(e)}timeEnd(e){console.timeEnd(e)}trace(e,t){console.trace(e,t)}count(e){console.count(e)}countReset(e){console.countReset(e)}table(e){console.table(e)}},k=class extends D{mark(e){typeof performance<`u`&&performance.mark&&performance.mark(e)}measure(e,t,n){if(typeof performance<`u`&&performance.measure)try{performance.measure(e,t,n);let r=performance.getEntriesByName(e,`measure`);if(r.length>0){let t=r[r.length-1];this.info(`Performance: ${e}`,{duration:t.duration,startTime:t.startTime})}}catch(t){this.warn(`Failed to measure performance`,{name:e,error:t})}}clearMarks(e){typeof performance<`u`&&performance.clearMarks&&performance.clearMarks(e)}clearMeasures(e){typeof performance<`u`&&performance.clearMeasures&&performance.clearMeasures(e)}};function A(e,t=`text`,n={}){if(t===`json`){let t={timestamp:e.timestamp.toISOString(),level:u[e.level].toLowerCase(),message:e.message,runtime:e.runtime};return e.metadata!==void 0&&(t.metadata=e.metadata),g(t)}let r=n.timestamp===!1?``:`[${e.timestamp.toISOString()}] `,i=j(e.level,n.colorize===!0),a=e.metadata?` ${g(e.metadata)}`:``;return`${r}${i}: ${e.message}${a}`}function j(e,t=!1){let n=u[e].toUpperCase();if(!t)return n;let r={[u.DEBUG]:`\x1B[36m`,[u.INFO]:`\x1B[32m`,[u.WARN]:`\x1B[33m`,[u.ERROR]:`\x1B[31m`,[u.SILENT]:`\x1B[37m`};return`${r[e]||r[u.INFO]}${n}[0m`}var M=new Set;function N(e){M.has(e)||(M.add(e),console.warn(e))}function P(){M.clear()}function F(){return e().capabilities.colorSupport?typeof process>`u`||!process.env?!0:process.env.NO_COLOR?!1:process.env.FORCE_COLOR?process.env.FORCE_COLOR!==`0`:process.stdout?.isTTY===!0:!1}function I(){return{level:u.INFO,format:`text`,timestamp:!0,colorize:F(),metadata:{},transports:[{type:`console`,options:{}}]}}var L=[`true`,`1`,`yes`,`on`],R=[`false`,`0`,`no`,`off`];function z(){P()}function B(e){switch(e.trim().toLowerCase()){case`debug`:return u.DEBUG;case`info`:return u.INFO;case`warn`:case`warning`:return u.WARN;case`error`:return u.ERROR;case`silent`:case`none`:return u.SILENT;default:return}}function V(e,t){let n=t.trim().toLowerCase();if(L.includes(n))return!0;if(R.includes(n))return!1;N(`[logan-logger] ${e}="${t}" is not a recognized boolean and was ignored. Accepted: ${L.join(`, `)} / ${R.join(`, `)}.`)}function H(){let e={};if(typeof process>`u`||!process.env)return e;let t=process.env;if(t.LOG_LEVEL){let n=B(t.LOG_LEVEL);n===void 0?N(`[logan-logger] LOG_LEVEL="${t.LOG_LEVEL}" is not a recognized level and was ignored. Accepted: debug, info, warn, error, silent.`):e.level=n}if(t.LOG_FORMAT){let n=t.LOG_FORMAT.trim().toLowerCase();n===`json`||n===`text`?e.format=n:N(`[logan-logger] LOG_FORMAT="${t.LOG_FORMAT}" is not a recognized format and was ignored. Accepted: json, text.`)}if(t.LOG_TIMESTAMP){let n=V(`LOG_TIMESTAMP`,t.LOG_TIMESTAMP);n!==void 0&&(e.timestamp=n)}if(t.LOG_COLOR){let n=V(`LOG_COLOR`,t.LOG_COLOR);n!==void 0&&(e.colorize=n)}return e}function U(...e){let t=I();return e.reduce((e,t)=>({...e,...t,metadata:{...e.metadata,...t.metadata},transports:t.transports||e.transports}),t)}Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return a}});
|
|
@@ -72,24 +72,32 @@ function s() {
|
|
|
72
72
|
return t() === "bun";
|
|
73
73
|
}
|
|
74
74
|
//#endregion
|
|
75
|
+
//#region src/core/internal.ts
|
|
76
|
+
var c = Symbol.for("logan-logger.internals");
|
|
77
|
+
function l(e) {
|
|
78
|
+
return e[c] ?? {};
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
75
81
|
//#region src/core/types.ts
|
|
76
|
-
var
|
|
82
|
+
var u = /* @__PURE__ */ function(e) {
|
|
77
83
|
return e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e[e.SILENT = 4] = "SILENT", e;
|
|
78
|
-
}({}),
|
|
84
|
+
}({}), d = () => /* @__PURE__ */ new Date(), f = class {
|
|
79
85
|
constructor(t = {}) {
|
|
80
|
-
this.childMetadata = {}, this.config = t, this.level = t.level ??
|
|
86
|
+
this.childMetadata = {}, this.config = t, this.level = t.level ?? u.INFO;
|
|
87
|
+
let n = l(t);
|
|
88
|
+
this.now = n.now ?? d, this.runtime = n.runtime ?? e().name, this.childMetadata = { ...t.metadata };
|
|
81
89
|
}
|
|
82
90
|
debug(e, t) {
|
|
83
|
-
this.log(
|
|
91
|
+
this.log(u.DEBUG, e, t);
|
|
84
92
|
}
|
|
85
93
|
info(e, t) {
|
|
86
|
-
this.log(
|
|
94
|
+
this.log(u.INFO, e, t);
|
|
87
95
|
}
|
|
88
96
|
warn(e, t) {
|
|
89
|
-
this.log(
|
|
97
|
+
this.log(u.WARN, e, t);
|
|
90
98
|
}
|
|
91
99
|
error(e, t) {
|
|
92
|
-
this.log(
|
|
100
|
+
this.log(u.ERROR, e, t);
|
|
93
101
|
}
|
|
94
102
|
log(e, t, n) {
|
|
95
103
|
if (!this.shouldLog(e)) return;
|
|
@@ -97,7 +105,7 @@ var c = /* @__PURE__ */ function(e) {
|
|
|
97
105
|
...this.childMetadata,
|
|
98
106
|
...n
|
|
99
107
|
}, a = {
|
|
100
|
-
timestamp:
|
|
108
|
+
timestamp: this.now(),
|
|
101
109
|
level: e,
|
|
102
110
|
message: r,
|
|
103
111
|
metadata: Object.keys(i).length > 0 ? i : void 0,
|
|
@@ -121,8 +129,8 @@ var c = /* @__PURE__ */ function(e) {
|
|
|
121
129
|
shouldLog(e) {
|
|
122
130
|
return e >= this.level;
|
|
123
131
|
}
|
|
124
|
-
},
|
|
125
|
-
function
|
|
132
|
+
}, p = 100;
|
|
133
|
+
function m(e, t, n, r) {
|
|
126
134
|
if (e === void 0) return "[undefined]";
|
|
127
135
|
if (typeof e == "bigint") return `[BigInt: ${e.toString()}]`;
|
|
128
136
|
if (typeof e == "symbol") return `[Symbol: ${e.toString()}]`;
|
|
@@ -133,29 +141,29 @@ function d(e, t, n, r) {
|
|
|
133
141
|
if (n >= r) return "[MaxDepth]";
|
|
134
142
|
t.add(i);
|
|
135
143
|
try {
|
|
136
|
-
if (i instanceof Error) return
|
|
144
|
+
if (i instanceof Error) return h(E(i), t, n, r);
|
|
137
145
|
let e = i.toJSON;
|
|
138
|
-
if (typeof e == "function") return
|
|
146
|
+
if (typeof e == "function") return m(e.call(i), t, n, r);
|
|
139
147
|
if (Array.isArray(i)) {
|
|
140
148
|
let e = [];
|
|
141
|
-
for (let a = 0; a < i.length; a++) e.push(
|
|
149
|
+
for (let a = 0; a < i.length; a++) e.push(m(i[a], t, n + 1, r));
|
|
142
150
|
return e;
|
|
143
151
|
}
|
|
144
|
-
return
|
|
152
|
+
return h(i, t, n, r);
|
|
145
153
|
} finally {
|
|
146
154
|
t.delete(i);
|
|
147
155
|
}
|
|
148
156
|
}
|
|
149
|
-
function
|
|
157
|
+
function h(e, t, n, r) {
|
|
150
158
|
let i = {};
|
|
151
|
-
for (let [a, o] of Object.entries(e)) i[a] =
|
|
159
|
+
for (let [a, o] of Object.entries(e)) i[a] = m(o, t, n + 1, r);
|
|
152
160
|
return i;
|
|
153
161
|
}
|
|
154
|
-
function
|
|
155
|
-
let r = n.maxDepth ??
|
|
156
|
-
return JSON.stringify(
|
|
162
|
+
function g(e, t, n = {}) {
|
|
163
|
+
let r = n.maxDepth ?? p;
|
|
164
|
+
return JSON.stringify(m(e, /* @__PURE__ */ new Set(), 0, r), null, t);
|
|
157
165
|
}
|
|
158
|
-
var
|
|
166
|
+
var _ = [
|
|
159
167
|
"password",
|
|
160
168
|
"token",
|
|
161
169
|
"secret",
|
|
@@ -166,14 +174,14 @@ var m = [
|
|
|
166
174
|
"authtoken",
|
|
167
175
|
"accesstoken",
|
|
168
176
|
"secretkey"
|
|
169
|
-
],
|
|
170
|
-
function
|
|
171
|
-
return (e.match(
|
|
177
|
+
], v = /[A-Z]+(?![a-z])|[A-Z]?[a-z]+|[0-9]+/g;
|
|
178
|
+
function y(e) {
|
|
179
|
+
return (e.match(v) ?? []).map((e) => e.toLowerCase());
|
|
172
180
|
}
|
|
173
|
-
function
|
|
181
|
+
function b(e) {
|
|
174
182
|
let t = [];
|
|
175
183
|
for (let n of e) {
|
|
176
|
-
let e =
|
|
184
|
+
let e = y(n);
|
|
177
185
|
if (e.length === 0) continue;
|
|
178
186
|
let r = e.join("");
|
|
179
187
|
t.push({
|
|
@@ -184,27 +192,27 @@ function _(e) {
|
|
|
184
192
|
}
|
|
185
193
|
return t;
|
|
186
194
|
}
|
|
187
|
-
function
|
|
188
|
-
let n =
|
|
195
|
+
function x(e, t) {
|
|
196
|
+
let n = y(e);
|
|
189
197
|
if (n.length === 0) return !1;
|
|
190
198
|
let r = n.join("");
|
|
191
199
|
return t.some((e) => e.tokens.every(([e, t]) => n.includes(e) || n.includes(t)) || r === e.joined || r === e.joinedPlural);
|
|
192
200
|
}
|
|
193
|
-
function
|
|
201
|
+
function S(e, t) {
|
|
194
202
|
if (typeof e != "object" || !e) return e;
|
|
195
203
|
let n = Array.isArray(e) ? [] : {};
|
|
196
|
-
for (let [r, i] of Object.entries(e)) n[r] =
|
|
204
|
+
for (let [r, i] of Object.entries(e)) n[r] = x(r, t) ? "[REDACTED]" : typeof i == "object" && i ? S(i, t) : i;
|
|
197
205
|
return n;
|
|
198
206
|
}
|
|
199
|
-
function
|
|
200
|
-
return
|
|
207
|
+
function C(e, t = _) {
|
|
208
|
+
return S(e, b(t));
|
|
201
209
|
}
|
|
202
|
-
var
|
|
210
|
+
var w = [
|
|
203
211
|
"name",
|
|
204
212
|
"message",
|
|
205
213
|
"stack"
|
|
206
214
|
];
|
|
207
|
-
function
|
|
215
|
+
function T(e, t) {
|
|
208
216
|
let n = Object.getOwnPropertyDescriptor(e, t);
|
|
209
217
|
if (n) {
|
|
210
218
|
if (n.get) try {
|
|
@@ -215,60 +223,60 @@ function S(e, t) {
|
|
|
215
223
|
return n.value;
|
|
216
224
|
}
|
|
217
225
|
}
|
|
218
|
-
function
|
|
226
|
+
function E(e) {
|
|
219
227
|
if (!(e instanceof Error)) return e;
|
|
220
228
|
let t = {
|
|
221
229
|
name: e.name,
|
|
222
230
|
message: e.message
|
|
223
231
|
};
|
|
224
232
|
e.stack !== void 0 && (t.stack = e.stack);
|
|
225
|
-
for (let n of Object.getOwnPropertyNames(e))
|
|
233
|
+
for (let n of Object.getOwnPropertyNames(e)) w.includes(n) || (t[n] = T(e, n));
|
|
226
234
|
return t;
|
|
227
235
|
}
|
|
228
236
|
//#endregion
|
|
229
237
|
//#region src/runtime/browser.ts
|
|
230
|
-
var
|
|
238
|
+
var D = class e extends f {
|
|
231
239
|
constructor(e = {}) {
|
|
232
240
|
super(e);
|
|
233
241
|
}
|
|
234
242
|
writeLog(e) {
|
|
235
|
-
let t = this.formatMessage(e), n = this.getConsoleStyle(e.level), r = `%c${t}${e.metadata ? ` ${
|
|
243
|
+
let t = this.formatMessage(e), n = this.getConsoleStyle(e.level), r = `%c${t}${e.metadata ? ` ${g(e.metadata)}` : ""}`;
|
|
236
244
|
switch (e.level) {
|
|
237
|
-
case
|
|
245
|
+
case u.DEBUG:
|
|
238
246
|
console.debug ? console.debug(r, n) : console.log(r, n);
|
|
239
247
|
break;
|
|
240
|
-
case
|
|
248
|
+
case u.INFO:
|
|
241
249
|
console.info(r, n);
|
|
242
250
|
break;
|
|
243
|
-
case
|
|
251
|
+
case u.WARN:
|
|
244
252
|
console.warn(r, n);
|
|
245
253
|
break;
|
|
246
|
-
case
|
|
254
|
+
case u.ERROR: console.error(r, n);
|
|
247
255
|
}
|
|
248
256
|
}
|
|
249
257
|
createChild() {
|
|
250
258
|
return new e(this.config);
|
|
251
259
|
}
|
|
252
260
|
formatMessage(e) {
|
|
253
|
-
return `[${e.timestamp.toISOString()}] ${
|
|
261
|
+
return `[${e.timestamp.toISOString()}] ${u[e.level].toUpperCase()}: ${e.message}`;
|
|
254
262
|
}
|
|
255
263
|
getConsoleStyle(e) {
|
|
256
264
|
if (!this.config.colorize) return "";
|
|
257
265
|
switch (e) {
|
|
258
|
-
case
|
|
259
|
-
case
|
|
260
|
-
case
|
|
261
|
-
case
|
|
266
|
+
case u.DEBUG: return "color: #888; font-weight: normal;";
|
|
267
|
+
case u.INFO: return "color: #007acc; font-weight: normal;";
|
|
268
|
+
case u.WARN: return "color: #ff8c00; font-weight: bold;";
|
|
269
|
+
case u.ERROR: return "color: #dc3545; font-weight: bold;";
|
|
262
270
|
default: return "";
|
|
263
271
|
}
|
|
264
272
|
}
|
|
265
273
|
shouldLogInProduction() {
|
|
266
|
-
return (globalThis.process?.env?.NODE_ENV || globalThis.process?.env?.NEXT_PUBLIC_APP_ENV || "development") !== "production" || this.level <=
|
|
274
|
+
return (globalThis.process?.env?.NODE_ENV || globalThis.process?.env?.NEXT_PUBLIC_APP_ENV || "development") !== "production" || this.level <= u.ERROR;
|
|
267
275
|
}
|
|
268
276
|
shouldLog(e) {
|
|
269
|
-
return !this.shouldLogInProduction() && e <
|
|
277
|
+
return !this.shouldLogInProduction() && e < u.ERROR ? !1 : super.shouldLog(e);
|
|
270
278
|
}
|
|
271
|
-
},
|
|
279
|
+
}, O = class extends D {
|
|
272
280
|
constructor(...e) {
|
|
273
281
|
super(...e), this.groupStack = [];
|
|
274
282
|
}
|
|
@@ -305,7 +313,7 @@ var w = class e extends l {
|
|
|
305
313
|
table(e) {
|
|
306
314
|
console.table(e);
|
|
307
315
|
}
|
|
308
|
-
},
|
|
316
|
+
}, k = class extends D {
|
|
309
317
|
mark(e) {
|
|
310
318
|
typeof performance < "u" && performance.mark && performance.mark(e);
|
|
311
319
|
}
|
|
@@ -336,51 +344,51 @@ var w = class e extends l {
|
|
|
336
344
|
};
|
|
337
345
|
//#endregion
|
|
338
346
|
//#region src/utils/formatting.ts
|
|
339
|
-
function
|
|
347
|
+
function A(e, t = "text", n = {}) {
|
|
340
348
|
if (t === "json") {
|
|
341
349
|
let t = {
|
|
342
350
|
timestamp: e.timestamp.toISOString(),
|
|
343
|
-
level:
|
|
351
|
+
level: u[e.level].toLowerCase(),
|
|
344
352
|
message: e.message,
|
|
345
353
|
runtime: e.runtime
|
|
346
354
|
};
|
|
347
|
-
return e.metadata !== void 0 && (t.metadata = e.metadata),
|
|
355
|
+
return e.metadata !== void 0 && (t.metadata = e.metadata), g(t);
|
|
348
356
|
}
|
|
349
|
-
let r = n.timestamp === !1 ? "" : `[${e.timestamp.toISOString()}] `, i =
|
|
357
|
+
let r = n.timestamp === !1 ? "" : `[${e.timestamp.toISOString()}] `, i = j(e.level, n.colorize === !0), a = e.metadata ? ` ${g(e.metadata)}` : "";
|
|
350
358
|
return `${r}${i}: ${e.message}${a}`;
|
|
351
359
|
}
|
|
352
|
-
function
|
|
353
|
-
let n =
|
|
360
|
+
function j(e, t = !1) {
|
|
361
|
+
let n = u[e].toUpperCase();
|
|
354
362
|
if (!t) return n;
|
|
355
363
|
let r = {
|
|
356
|
-
[
|
|
357
|
-
[
|
|
358
|
-
[
|
|
359
|
-
[
|
|
360
|
-
[
|
|
364
|
+
[u.DEBUG]: "\x1B[36m",
|
|
365
|
+
[u.INFO]: "\x1B[32m",
|
|
366
|
+
[u.WARN]: "\x1B[33m",
|
|
367
|
+
[u.ERROR]: "\x1B[31m",
|
|
368
|
+
[u.SILENT]: "\x1B[37m"
|
|
361
369
|
};
|
|
362
|
-
return `${r[e] || r[
|
|
370
|
+
return `${r[e] || r[u.INFO]}${n}[0m`;
|
|
363
371
|
}
|
|
364
372
|
//#endregion
|
|
365
373
|
//#region src/utils/warn-once.ts
|
|
366
|
-
var
|
|
367
|
-
function
|
|
368
|
-
|
|
374
|
+
var M = /* @__PURE__ */ new Set();
|
|
375
|
+
function N(e) {
|
|
376
|
+
M.has(e) || (M.add(e), console.warn(e));
|
|
369
377
|
}
|
|
370
|
-
function
|
|
371
|
-
|
|
378
|
+
function P() {
|
|
379
|
+
M.clear();
|
|
372
380
|
}
|
|
373
381
|
//#endregion
|
|
374
382
|
//#region src/utils/config.ts
|
|
375
|
-
function
|
|
383
|
+
function F() {
|
|
376
384
|
return e().capabilities.colorSupport ? typeof process > "u" || !process.env ? !0 : process.env.NO_COLOR ? !1 : process.env.FORCE_COLOR ? process.env.FORCE_COLOR !== "0" : process.stdout?.isTTY === !0 : !1;
|
|
377
385
|
}
|
|
378
|
-
function
|
|
386
|
+
function I() {
|
|
379
387
|
return {
|
|
380
|
-
level:
|
|
388
|
+
level: u.INFO,
|
|
381
389
|
format: "text",
|
|
382
390
|
timestamp: !0,
|
|
383
|
-
colorize:
|
|
391
|
+
colorize: F(),
|
|
384
392
|
metadata: {},
|
|
385
393
|
transports: [{
|
|
386
394
|
type: "console",
|
|
@@ -388,62 +396,62 @@ function N() {
|
|
|
388
396
|
}]
|
|
389
397
|
};
|
|
390
398
|
}
|
|
391
|
-
var
|
|
399
|
+
var L = [
|
|
392
400
|
"true",
|
|
393
401
|
"1",
|
|
394
402
|
"yes",
|
|
395
403
|
"on"
|
|
396
|
-
],
|
|
404
|
+
], R = [
|
|
397
405
|
"false",
|
|
398
406
|
"0",
|
|
399
407
|
"no",
|
|
400
408
|
"off"
|
|
401
409
|
];
|
|
402
|
-
function
|
|
403
|
-
|
|
410
|
+
function z() {
|
|
411
|
+
P();
|
|
404
412
|
}
|
|
405
|
-
function
|
|
413
|
+
function B(e) {
|
|
406
414
|
switch (e.trim().toLowerCase()) {
|
|
407
|
-
case "debug": return
|
|
408
|
-
case "info": return
|
|
415
|
+
case "debug": return u.DEBUG;
|
|
416
|
+
case "info": return u.INFO;
|
|
409
417
|
case "warn":
|
|
410
|
-
case "warning": return
|
|
411
|
-
case "error": return
|
|
418
|
+
case "warning": return u.WARN;
|
|
419
|
+
case "error": return u.ERROR;
|
|
412
420
|
case "silent":
|
|
413
|
-
case "none": return
|
|
421
|
+
case "none": return u.SILENT;
|
|
414
422
|
default: return;
|
|
415
423
|
}
|
|
416
424
|
}
|
|
417
|
-
function
|
|
425
|
+
function V(e, t) {
|
|
418
426
|
let n = t.trim().toLowerCase();
|
|
419
|
-
if (
|
|
420
|
-
if (
|
|
421
|
-
|
|
427
|
+
if (L.includes(n)) return !0;
|
|
428
|
+
if (R.includes(n)) return !1;
|
|
429
|
+
N(`[logan-logger] ${e}="${t}" is not a recognized boolean and was ignored. Accepted: ${L.join(", ")} / ${R.join(", ")}.`);
|
|
422
430
|
}
|
|
423
|
-
function
|
|
431
|
+
function H() {
|
|
424
432
|
let e = {};
|
|
425
433
|
if (typeof process > "u" || !process.env) return e;
|
|
426
434
|
let t = process.env;
|
|
427
435
|
if (t.LOG_LEVEL) {
|
|
428
|
-
let n =
|
|
429
|
-
n === void 0 ?
|
|
436
|
+
let n = B(t.LOG_LEVEL);
|
|
437
|
+
n === void 0 ? N(`[logan-logger] LOG_LEVEL="${t.LOG_LEVEL}" is not a recognized level and was ignored. Accepted: debug, info, warn, error, silent.`) : e.level = n;
|
|
430
438
|
}
|
|
431
439
|
if (t.LOG_FORMAT) {
|
|
432
440
|
let n = t.LOG_FORMAT.trim().toLowerCase();
|
|
433
|
-
n === "json" || n === "text" ? e.format = n :
|
|
441
|
+
n === "json" || n === "text" ? e.format = n : N(`[logan-logger] LOG_FORMAT="${t.LOG_FORMAT}" is not a recognized format and was ignored. Accepted: json, text.`);
|
|
434
442
|
}
|
|
435
443
|
if (t.LOG_TIMESTAMP) {
|
|
436
|
-
let n =
|
|
444
|
+
let n = V("LOG_TIMESTAMP", t.LOG_TIMESTAMP);
|
|
437
445
|
n !== void 0 && (e.timestamp = n);
|
|
438
446
|
}
|
|
439
447
|
if (t.LOG_COLOR) {
|
|
440
|
-
let n =
|
|
448
|
+
let n = V("LOG_COLOR", t.LOG_COLOR);
|
|
441
449
|
n !== void 0 && (e.colorize = n);
|
|
442
450
|
}
|
|
443
451
|
return e;
|
|
444
452
|
}
|
|
445
|
-
function
|
|
446
|
-
let t =
|
|
453
|
+
function U(...e) {
|
|
454
|
+
let t = I();
|
|
447
455
|
return e.reduce((e, t) => ({
|
|
448
456
|
...e,
|
|
449
457
|
...t,
|
|
@@ -455,4 +463,4 @@ function B(...e) {
|
|
|
455
463
|
}), t);
|
|
456
464
|
}
|
|
457
465
|
//#endregion
|
|
458
|
-
export { i as S,
|
|
466
|
+
export { i as S, u as _, F as a, s as b, j as c, O as d, k as f, f as g, E as h, z as i, A as l, g as m, H as n, B as o, C as p, U as r, N as s, I as t, D as u, e as v, o as x, a as y };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./config-
|
|
1
|
+
const e=require("./config-BIFVBkeG.cjs");var t=new Map;function n(e,n){t.set(e,n)}function r(e){return t.get(e)}var i=class{constructor(e={}){this.type=`console`,this.level=e.level,this.format=e.format===`json`?`json`:`text`,this.formatOptions={timestamp:e.timestamp!==!1,colorize:e.colorize===!0}}write(t){let n=e.l(t,this.format,this.formatOptions);switch(t.level){case e._.DEBUG:console.debug(n);break;case e._.WARN:console.warn(n);break;case e._.ERROR:console.error(n);break;default:console.info(n)}}};n(`console`,(e,t)=>{let n=e.options??{};return new i({format:n.format??t.format,timestamp:n.timestamp??t.timestamp,colorize:n.colorize??t.colorize,level:e.level})}),n(`custom`,e=>{let t=e.options?.transport;if(!t||typeof t.write!=`function`)throw Error(`custom transport requires options.transport to be an object with a write(entry) method`);return e.level===void 0?t:{type:t.type??`custom`,level:e.level,write:e=>t.write(e),close:t.close?()=>t.close?.():void 0}});function a(e){let t={format:e.format??`text`,timestamp:e.timestamp??!0,colorize:e.colorize??!1};if(e.transports===void 0)return[new i({format:t.format,timestamp:t.timestamp,colorize:t.colorize})];let n=[];for(let i of e.transports){let e=r(i.type);if(!e){console.warn(`[logan-logger] ${o(i.type)}`);continue}try{n.push(e(i,t))}catch(e){console.warn(`[logan-logger] transport '${i.type}' failed to initialize:`,e)}}return n}function o(e){return e===`file`?`the 'file' transport is not registered; import from 'logan-logger/node' (or 'logan-logger/bun') rather than the main entry point to use file logging`:e===`http`?`the 'http' transport is not built in; supply one with { type: 'custom', options: { transport } }`:`unknown transport type '${e}'; skipping`}var s=class t extends e.g{constructor(e={},t){super(e),this.transports=t??a(e)}getTransports(){return this.transports}close(){for(let e of this.transports)e.close?.()}writeLog(e){for(let t of this.transports)if(!(t.level!==void 0&&e.level<t.level))try{t.write(e)}catch(e){console.warn(`[logan-logger] transport '${t.type}' failed to write:`,e)}}createChild(){return new t(this.config,this.transports)}};function c(e){return{write:t=>{e.info(t.trim())}}}var l=class t{static create(n={}){let r=e.v(),i=t.mergeConfig(n);switch(r.name){case`node`:return new s(i);case`deno`:return new e.u(i);case`bun`:return new s(i);case`browser`:case`webworker`:return new e.u(i);default:return new e.u(i)}}static createChild(e,t){return e.child(t)}static mergeConfig(t){let n=t.ignoreEnvironment?{}:e.n();return e.r(t,n)}};function u(e){return l.create(e)}function d(){let t=f();return u({level:p(t),colorize:t!==`production`&&e.a(),timestamp:!0,format:t===`production`?`json`:`text`})}function f(){return typeof process<`u`&&process.env?process.env.NODE_ENV||process.env.NEXT_PUBLIC_APP_ENV||process.env.ENVIRONMENT||`development`:typeof window<`u`&&globalThis.__ENV__||`development`}function p(t){switch(t){case`production`:return e._.ERROR;case`staging`:case`test`:return e._.WARN;case`development`:case`dev`:return e._.DEBUG;default:return e._.INFO}}function m(t){return e.o(t)??e._.INFO}function h(t){switch(t){case e._.DEBUG:return`debug`;case e._.INFO:return`info`;case e._.WARN:return`warn`;case e._.ERROR:return`error`;case e._.SILENT:return`silent`;default:return`info`}}var g=[{path:`logan.config.json`},{path:`.loganrc`},{path:`package.json`,key:`logan`}],_=new Set([`level`,`format`,`timestamp`,`colorize`,`ignoreEnvironment`,`metadata`,`transports`,`$schema`]),v=new Set([`EACCES`,`EPERM`,`NotCapable`,`PermissionDenied`]);function y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function b(e){return e instanceof Error?e.message:String(e)}function x(e){let t=/at position \d+(?: \(line \d+ column \d+\))?/.exec(b(e));return t?`not valid JSON (${t[0]})`:`not valid JSON`}function S(e){return e.startsWith(`/`)||e.startsWith(`\\`)||/^[A-Za-z]:/.test(e)}function C(e,t){return t===void 0||t===``||S(e)?e:`${t.replace(/[\\/]+$/,``)}/${e}`}async function w(e,t){if(e===`deno`)return e=>C(e,t);let{resolve:n}=await import(`node:path`);return t===void 0?e=>n(e):e=>n(t,e)}function T(e){let t=e.split(/[\\/]/);return t[t.length-1]||e}function E(e){if(e===`deno`)try{return globalThis.Deno?.cwd?.()}catch{return}return typeof process<`u`&&typeof process.cwd==`function`?process.cwd():void 0}function D(e){let t=e?.code??``,n=e?.name??``;return t===`ENOENT`||n===`NotFound`?{kind:`absent`}:v.has(t)||v.has(n)?{kind:`denied`,reason:b(e)}:{kind:`unreadable`,reason:b(e)}}async function O(e,t){let n=t===`deno`?()=>globalThis.Deno.readTextFile(e):async()=>(await import(`node:fs/promises`)).readFile(e,`utf-8`);try{return{kind:`content`,content:await n()}}catch(e){return D(e)}}function k(t){if(typeof t==`string`)return e.o(t);if(typeof t==`number`&&e._[t]!==void 0)return t}function A(t,n,r){let i=t=>{e.s(`[logan-logger] ${r}: ignoring transports[${n}]: ${t}.`)};if(!y(t)){i(`expected an object, got ${JSON.stringify(t)??typeof t}`);return}if(typeof t.type!=`string`){i(`"type" is required and must be a string`);return}if(t.options!==void 0&&!y(t.options)){i(`"options" must be an object`);return}let a={type:t.type,options:t.options??{}};if(t.level!==void 0){let i=k(t.level);i===void 0?e.s(`[logan-logger] ${r}: ignoring transports[${n}].level=${JSON.stringify(t.level)}. Accepted: debug, info, warn, error, silent.`):a.level=i}return a}function j(t,n){let r={},i=(t,r,i)=>{e.s(`[logan-logger] ${n}: ignoring ${t}=${JSON.stringify(r)}. Accepted: ${i}.`)};for(let r of Object.keys(t))_.has(r)||e.s(`[logan-logger] ${n}: ignoring unknown field "${r}". Known fields: level, format, timestamp, colorize, ignoreEnvironment, metadata, transports.`);if(t.level!==void 0){let e=k(t.level);e===void 0?i(`level`,t.level,`debug, info, warn, error, silent`):r.level=e}t.format!==void 0&&(t.format===`json`||t.format===`text`||t.format===`custom`?r.format=t.format:i(`format`,t.format,`json, text, custom`));for(let e of[`timestamp`,`colorize`,`ignoreEnvironment`])t[e]!==void 0&&(typeof t[e]==`boolean`?r[e]=t[e]:i(e,t[e],`true, false`));if(t.metadata!==void 0&&(y(t.metadata)?r.metadata=t.metadata:i(`metadata`,t.metadata,`an object`)),Array.isArray(t.transports)){let e=t.transports.map((e,t)=>A(e,t,n)).filter(e=>e!==void 0);(e.length>0||t.transports.length===0)&&(r.transports=e)}else t.transports!==void 0&&i(`transports`,t.transports,`an array of transport configs`);return r}async function M(e,t){let n=await O(e.path,t);if(n.kind===`absent`)return n;if(n.kind!==`content`)return{kind:n.kind,path:e.path,reason:n.reason};let r;try{r=JSON.parse(n.content)}catch(t){return{kind:`invalid`,path:e.path,reason:x(t)}}let i=r;if(e.key){if(!y(r))return{kind:`invalid`,path:e.path,reason:`expected a JSON object`};if(!Object.hasOwn(r,e.key))return{kind:`keyless`,path:e.path,key:e.key};i=r[e.key]}if(!y(i)){let t=e.key?`the "${e.key}" key`:`the file`;return{kind:`invalid`,path:e.path,reason:`expected ${t} to be an object`}}return{kind:`found`,config:j(i,e.path)}}function N(e){let t=g.find(t=>t.path===T(e));return t?{...t,path:e}:{path:e}}function P(t,n){e.s(`[logan-logger] cannot read config at ${t} — no permission; using defaults instead: ${n}`)}async function F(t,n={}){let r=e.v();if(!r.capabilities.fileSystem)return{};let i=n.cwd||E(r.name),a=await w(r.name,i);if(t!==void 0){let e=a(t),n=await M(N(e),r.name);if(n.kind===`found`)return n.config;if(n.kind===`absent`)throw Error(`[logan-logger] config file not found: ${e}`);if(n.kind===`keyless`)throw Error(`[logan-logger] no "${n.key}" key in ${n.path}`);if(n.kind===`denied`)return P(n.path,n.reason),{};throw n.kind===`unreadable`?Error(`[logan-logger] config at ${n.path} is not a readable file: ${n.reason}`):Error(`[logan-logger] config at ${n.path} is invalid: ${n.reason}`)}for(let t of g){let n=await M({...t,path:a(t.path)},r.name);if(n.kind===`found`)return n.config;if(n.kind===`invalid`)return e.s(`[logan-logger] config at ${n.path} is invalid: ${n.reason}`),{};if(n.kind===`denied`)return P(n.path,n.reason),{};n.kind===`unreadable`&&e.s(`[logan-logger] skipping ${n.path}: not a readable file (${n.reason})`)}return{}}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return a}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as e, a as t, g as n, l as r, n as i, o as a, r as o, s, u as c, v as l } from "./config-
|
|
1
|
+
import { _ as e, a as t, g as n, l as r, n as i, o as a, r as o, s, u as c, v as l } from "./config-C0Vj3nIk.mjs";
|
|
2
2
|
//#region src/core/transport.ts
|
|
3
3
|
var u = /* @__PURE__ */ new Map();
|
|
4
4
|
function d(e, t) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as e } from "./config-
|
|
2
|
-
import { f as t } from "./config-file-
|
|
1
|
+
import { l as e } from "./config-C0Vj3nIk.mjs";
|
|
2
|
+
import { f as t } from "./config-file-CmxNUX1Z.mjs";
|
|
3
3
|
import { closeSync as n, existsSync as r, fstatSync as i, mkdirSync as a, openSync as o, renameSync as s, unlinkSync as c, writeSync as l } from "node:fs";
|
|
4
4
|
import { dirname as u, resolve as d } from "node:path";
|
|
5
5
|
//#region src/runtime/file-transport.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./config-
|
|
1
|
+
const e=require("./config-BIFVBkeG.cjs"),t=require("./config-file-BNPm7ZNS.cjs");let n=require("node:fs"),r=require("node:path");var i=5242880,a=5,o=class{constructor(e){if(this.type=`file`,this.size=0,this.warned=!1,!e?.filename)throw Error(`file transport requires options.filename`);this.path=(0,r.resolve)(e.filename),this.maxsize=e.maxsize??i,this.maxFiles=e.maxFiles??a,this.format=e.format===`text`?`text`:`json`,this.timestamp=e.timestamp!==!1,this.level=e.level}get filename(){return this.path}write(t){let r=`${e.l(t,this.format,{timestamp:this.timestamp,colorize:!1})}\n`;try{this.open(),this.maxsize>0&&this.size>=this.maxsize&&(this.rotate(),this.open()),this.size+=(0,n.writeSync)(this.fd,r)}catch(e){this.warnOnce(e)}}close(){if(this.fd!==void 0)try{(0,n.closeSync)(this.fd)}finally{this.fd=void 0}}open(){if(this.fd!==void 0)return;let e=(0,r.dirname)(this.path);try{(0,n.mkdirSync)(e,{recursive:!0})}catch(t){throw s(`create log directory`,e,t)}try{this.fd=(0,n.openSync)(this.path,`a`)}catch(e){throw s(`open log file`,this.path,e)}this.size=(0,n.fstatSync)(this.fd).size}rotate(){if(this.close(),this.maxFiles<=0){(0,n.existsSync)(this.path)&&(0,n.unlinkSync)(this.path),this.size=0;return}let e=`${this.path}.${this.maxFiles}`;(0,n.existsSync)(e)&&(0,n.unlinkSync)(e);for(let e=this.maxFiles-1;e>=1;e--){let t=`${this.path}.${e}`;(0,n.existsSync)(t)&&(0,n.renameSync)(t,`${this.path}.${e+1}`)}(0,n.existsSync)(this.path)&&(0,n.renameSync)(this.path,`${this.path}.1`),this.size=0}warnOnce(e){this.close(),!this.warned&&(this.warned=!0,console.warn(`[logan-logger] file transport for '${this.path}' failed and will keep retrying quietly:`,e instanceof Error?e.message:e))}};function s(e,t,n){let r=n,i=r?.code?` [${r.code}]`:``,a=r?.syscall?` during ${r.syscall}`:``,o=Error(`could not ${e} '${t}'${i}${a}: ${r?.message??n}`);return o.cause=n,o}t.f(`file`,(e,t)=>{let n=e.options??{};return new o({filename:n.filename,maxsize:n.maxsize,maxFiles:n.maxFiles,format:n.format,timestamp:n.timestamp??t.timestamp,level:e.level})}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { LoggerConfig, RuntimeName } from './types.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* Key under which a caller may freeze the two values a record takes from its
|
|
4
|
+
* surroundings rather than from its caller: the wall clock and the detected
|
|
5
|
+
* runtime.
|
|
6
|
+
*
|
|
7
|
+
* This is a **test seam**, not configuration. It rides on the config object
|
|
8
|
+
* under a symbol instead of becoming a named `LoggerConfig` field because a
|
|
9
|
+
* named field would be public API — permanently documented, permanently
|
|
10
|
+
* supported — for something whose only caller is a conformance harness. The
|
|
11
|
+
* treering fixtures supply a frozen `timestamp` and `runtime` on every case
|
|
12
|
+
* that emits a record, and `fixtures/README.md` requires the runner to inject
|
|
13
|
+
* them rather than let the implementation read a real clock.
|
|
14
|
+
*
|
|
15
|
+
* Carrying it on the config also makes inheritance free: `BaseLogger.child()`
|
|
16
|
+
* hands `this.config` to the child it builds, so every descendant sees the same
|
|
17
|
+
* frozen values. A constructor argument or a protected member would each need
|
|
18
|
+
* `child()` to be taught about them separately.
|
|
19
|
+
*
|
|
20
|
+
* `Symbol.for` rather than `Symbol()`: a test runner that isolates module
|
|
21
|
+
* graphs can end up holding two instances of this file, and a per-instance
|
|
22
|
+
* symbol would not match across them.
|
|
23
|
+
*/
|
|
24
|
+
export declare const LOGGER_INTERNALS: unique symbol;
|
|
25
|
+
/** Environment-derived values a caller may pin. */
|
|
26
|
+
export interface LoggerInternals {
|
|
27
|
+
/** Supplies the record timestamp. Defaults to the real clock. */
|
|
28
|
+
now?: () => Date;
|
|
29
|
+
/** Stands in for `detectRuntime().name` on the `runtime` field. */
|
|
30
|
+
runtime?: RuntimeName;
|
|
31
|
+
}
|
|
32
|
+
type ConfigWithInternals = Partial<LoggerConfig> & {
|
|
33
|
+
[LOGGER_INTERNALS]?: LoggerInternals;
|
|
34
|
+
};
|
|
35
|
+
/** Read whatever internals a config carries; an empty object when it carries none. */
|
|
36
|
+
export declare function readLoggerInternals(config: Partial<LoggerConfig>): LoggerInternals;
|
|
37
|
+
/**
|
|
38
|
+
* Attach internals to a copy of `config`.
|
|
39
|
+
*
|
|
40
|
+
* The property is enumerable, which is what lets `mergeConfigs` carry it
|
|
41
|
+
* through: object spread copies own enumerable symbol-keyed properties.
|
|
42
|
+
* @param config - Configuration to copy
|
|
43
|
+
* @param internals - Values to pin
|
|
44
|
+
* @returns A new config object carrying the internals
|
|
45
|
+
*/
|
|
46
|
+
export declare function withLoggerInternals<T extends Partial<LoggerConfig>>(config: T, internals: LoggerInternals): T & ConfigWithInternals;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { LoggerConfig, RuntimeName } from './types.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Key under which a caller may freeze the two values a record takes from its
|
|
4
|
+
* surroundings rather than from its caller: the wall clock and the detected
|
|
5
|
+
* runtime.
|
|
6
|
+
*
|
|
7
|
+
* This is a **test seam**, not configuration. It rides on the config object
|
|
8
|
+
* under a symbol instead of becoming a named `LoggerConfig` field because a
|
|
9
|
+
* named field would be public API — permanently documented, permanently
|
|
10
|
+
* supported — for something whose only caller is a conformance harness. The
|
|
11
|
+
* treering fixtures supply a frozen `timestamp` and `runtime` on every case
|
|
12
|
+
* that emits a record, and `fixtures/README.md` requires the runner to inject
|
|
13
|
+
* them rather than let the implementation read a real clock.
|
|
14
|
+
*
|
|
15
|
+
* Carrying it on the config also makes inheritance free: `BaseLogger.child()`
|
|
16
|
+
* hands `this.config` to the child it builds, so every descendant sees the same
|
|
17
|
+
* frozen values. A constructor argument or a protected member would each need
|
|
18
|
+
* `child()` to be taught about them separately.
|
|
19
|
+
*
|
|
20
|
+
* `Symbol.for` rather than `Symbol()`: a test runner that isolates module
|
|
21
|
+
* graphs can end up holding two instances of this file, and a per-instance
|
|
22
|
+
* symbol would not match across them.
|
|
23
|
+
*/
|
|
24
|
+
export declare const LOGGER_INTERNALS: unique symbol;
|
|
25
|
+
/** Environment-derived values a caller may pin. */
|
|
26
|
+
export interface LoggerInternals {
|
|
27
|
+
/** Supplies the record timestamp. Defaults to the real clock. */
|
|
28
|
+
now?: () => Date;
|
|
29
|
+
/** Stands in for `detectRuntime().name` on the `runtime` field. */
|
|
30
|
+
runtime?: RuntimeName;
|
|
31
|
+
}
|
|
32
|
+
type ConfigWithInternals = Partial<LoggerConfig> & {
|
|
33
|
+
[LOGGER_INTERNALS]?: LoggerInternals;
|
|
34
|
+
};
|
|
35
|
+
/** Read whatever internals a config carries; an empty object when it carries none. */
|
|
36
|
+
export declare function readLoggerInternals(config: Partial<LoggerConfig>): LoggerInternals;
|
|
37
|
+
/**
|
|
38
|
+
* Attach internals to a copy of `config`.
|
|
39
|
+
*
|
|
40
|
+
* The property is enumerable, which is what lets `mergeConfigs` carry it
|
|
41
|
+
* through: object spread copies own enumerable symbol-keyed properties.
|
|
42
|
+
* @param config - Configuration to copy
|
|
43
|
+
* @param internals - Values to pin
|
|
44
|
+
* @returns A new config object carrying the internals
|
|
45
|
+
*/
|
|
46
|
+
export declare function withLoggerInternals<T extends Partial<LoggerConfig>>(config: T, internals: LoggerInternals): T & ConfigWithInternals;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { LoggerConfig, RuntimeName } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Key under which a caller may freeze the two values a record takes from its
|
|
4
|
+
* surroundings rather than from its caller: the wall clock and the detected
|
|
5
|
+
* runtime.
|
|
6
|
+
*
|
|
7
|
+
* This is a **test seam**, not configuration. It rides on the config object
|
|
8
|
+
* under a symbol instead of becoming a named `LoggerConfig` field because a
|
|
9
|
+
* named field would be public API — permanently documented, permanently
|
|
10
|
+
* supported — for something whose only caller is a conformance harness. The
|
|
11
|
+
* treering fixtures supply a frozen `timestamp` and `runtime` on every case
|
|
12
|
+
* that emits a record, and `fixtures/README.md` requires the runner to inject
|
|
13
|
+
* them rather than let the implementation read a real clock.
|
|
14
|
+
*
|
|
15
|
+
* Carrying it on the config also makes inheritance free: `BaseLogger.child()`
|
|
16
|
+
* hands `this.config` to the child it builds, so every descendant sees the same
|
|
17
|
+
* frozen values. A constructor argument or a protected member would each need
|
|
18
|
+
* `child()` to be taught about them separately.
|
|
19
|
+
*
|
|
20
|
+
* `Symbol.for` rather than `Symbol()`: a test runner that isolates module
|
|
21
|
+
* graphs can end up holding two instances of this file, and a per-instance
|
|
22
|
+
* symbol would not match across them.
|
|
23
|
+
*/
|
|
24
|
+
export declare const LOGGER_INTERNALS: unique symbol;
|
|
25
|
+
/** Environment-derived values a caller may pin. */
|
|
26
|
+
export interface LoggerInternals {
|
|
27
|
+
/** Supplies the record timestamp. Defaults to the real clock. */
|
|
28
|
+
now?: () => Date;
|
|
29
|
+
/** Stands in for `detectRuntime().name` on the `runtime` field. */
|
|
30
|
+
runtime?: RuntimeName;
|
|
31
|
+
}
|
|
32
|
+
type ConfigWithInternals = Partial<LoggerConfig> & {
|
|
33
|
+
[LOGGER_INTERNALS]?: LoggerInternals;
|
|
34
|
+
};
|
|
35
|
+
/** Read whatever internals a config carries; an empty object when it carries none. */
|
|
36
|
+
export declare function readLoggerInternals(config: Partial<LoggerConfig>): LoggerInternals;
|
|
37
|
+
/**
|
|
38
|
+
* Attach internals to a copy of `config`.
|
|
39
|
+
*
|
|
40
|
+
* The property is enumerable, which is what lets `mergeConfigs` carry it
|
|
41
|
+
* through: object spread copies own enumerable symbol-keyed properties.
|
|
42
|
+
* @param config - Configuration to copy
|
|
43
|
+
* @param internals - Values to pin
|
|
44
|
+
* @returns A new config object carrying the internals
|
|
45
|
+
*/
|
|
46
|
+
export declare function withLoggerInternals<T extends Partial<LoggerConfig>>(config: T, internals: LoggerInternals): T & ConfigWithInternals;
|
|
47
|
+
export {};
|
package/dist/core/logger.d.cts
CHANGED
|
@@ -3,6 +3,14 @@ export declare abstract class BaseLogger implements ILogger {
|
|
|
3
3
|
protected level: LogLevel;
|
|
4
4
|
protected config: Partial<LoggerConfig>;
|
|
5
5
|
protected runtime: RuntimeName;
|
|
6
|
+
/**
|
|
7
|
+
* Source of the `timestamp` on every record.
|
|
8
|
+
*
|
|
9
|
+
* A seam rather than a direct `new Date()` so conformance fixtures can pin it
|
|
10
|
+
* and compare output byte for byte. See `core/internal.ts` for why it is not
|
|
11
|
+
* a public config field.
|
|
12
|
+
*/
|
|
13
|
+
protected readonly now: () => Date;
|
|
6
14
|
protected childMetadata: Record<string, any>;
|
|
7
15
|
protected constructor(config?: Partial<LoggerConfig>);
|
|
8
16
|
debug(message: LogMessage, metadata?: any): void;
|
package/dist/core/logger.d.mts
CHANGED
|
@@ -3,6 +3,14 @@ export declare abstract class BaseLogger implements ILogger {
|
|
|
3
3
|
protected level: LogLevel;
|
|
4
4
|
protected config: Partial<LoggerConfig>;
|
|
5
5
|
protected runtime: RuntimeName;
|
|
6
|
+
/**
|
|
7
|
+
* Source of the `timestamp` on every record.
|
|
8
|
+
*
|
|
9
|
+
* A seam rather than a direct `new Date()` so conformance fixtures can pin it
|
|
10
|
+
* and compare output byte for byte. See `core/internal.ts` for why it is not
|
|
11
|
+
* a public config field.
|
|
12
|
+
*/
|
|
13
|
+
protected readonly now: () => Date;
|
|
6
14
|
protected childMetadata: Record<string, any>;
|
|
7
15
|
protected constructor(config?: Partial<LoggerConfig>);
|
|
8
16
|
debug(message: LogMessage, metadata?: any): void;
|
package/dist/core/logger.d.ts
CHANGED
|
@@ -3,6 +3,14 @@ export declare abstract class BaseLogger implements ILogger {
|
|
|
3
3
|
protected level: LogLevel;
|
|
4
4
|
protected config: Partial<LoggerConfig>;
|
|
5
5
|
protected runtime: RuntimeName;
|
|
6
|
+
/**
|
|
7
|
+
* Source of the `timestamp` on every record.
|
|
8
|
+
*
|
|
9
|
+
* A seam rather than a direct `new Date()` so conformance fixtures can pin it
|
|
10
|
+
* and compare output byte for byte. See `core/internal.ts` for why it is not
|
|
11
|
+
* a public config field.
|
|
12
|
+
*/
|
|
13
|
+
protected readonly now: () => Date;
|
|
6
14
|
protected childMetadata: Record<string, any>;
|
|
7
15
|
protected constructor(config?: Partial<LoggerConfig>);
|
|
8
16
|
debug(message: LogMessage, metadata?: any): void;
|
package/dist/deno.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/config-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/config-BIFVBkeG.cjs"),t=require("./chunks/config-file-BNPm7ZNS.cjs");exports.BrowserLogger=e.u,exports.ConsoleGroupLogger=e.d,exports.ConsoleTransport=t.l,exports.PerformanceLogger=e.f,exports.createLogger=t.r,exports.createLoggerForEnvironment=t.i,exports.createTransports=t.u,exports.detectRuntime=e.v,exports.filterSensitiveData=e.p,exports.formatLevel=e.c,exports.formatLogEntry=e.l,exports.getDefaultConfig=e.t,exports.isBrowser=e.y,exports.isBun=e.b,exports.isDeno=e.x,exports.isNode=e.S,exports.loadConfigFromEnvironment=e.n,exports.loadConfigFromFile=t.t,exports.mergeConfigs=e.r,exports.registerTransport=t.f,exports.resetEnvironmentWarnings=e.i,exports.safeStringify=e.m,exports.serializeError=e.h,exports.shouldColorize=e.a,exports.tryParseLogLevel=e.o;
|
package/dist/deno.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { S as e, a as t, b as n, c as r, d as i, f as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, t as m, u as h, v as g, x as _, y as v } from "./chunks/config-
|
|
2
|
-
import { f as y, i as b, l as x, r as S, t as C, u as w } from "./chunks/config-file-
|
|
1
|
+
import { S as e, a as t, b as n, c as r, d as i, f as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, t as m, u as h, v as g, x as _, y as v } from "./chunks/config-C0Vj3nIk.mjs";
|
|
2
|
+
import { f as y, i as b, l as x, r as S, t as C, u as w } from "./chunks/config-file-CmxNUX1Z.mjs";
|
|
3
3
|
export { h as BrowserLogger, i as ConsoleGroupLogger, x as ConsoleTransport, a as PerformanceLogger, S as createLogger, b as createLoggerForEnvironment, w as createTransports, g as detectRuntime, f as filterSensitiveData, r as formatLevel, c as formatLogEntry, m as getDefaultConfig, v as isBrowser, n as isBun, _ as isDeno, e as isNode, u as loadConfigFromEnvironment, C as loadConfigFromFile, p as mergeConfigs, y as registerTransport, s as resetEnvironmentWarnings, l as safeStringify, o as serializeError, t as shouldColorize, d as tryParseLogLevel };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/config-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/config-BIFVBkeG.cjs"),t=require("./chunks/config-file-BNPm7ZNS.cjs");var n=t.i(),r={debug:(e,t)=>n.debug(e,t),info:(e,t)=>n.info(e,t),warn:(e,t)=>n.warn(e,t),error:(e,t)=>n.error(e,t)};exports.BaseLogger=e.g,exports.BrowserLogger=e.u,exports.ConsoleGroupLogger=e.d,exports.ConsoleTransport=t.l,exports.LogLevel=e._,exports.LoggerFactory=t.n,exports.PerformanceLogger=e.f,exports.createLogger=t.r,exports.createLoggerForEnvironment=t.i,exports.createTransports=t.u,exports.detectRuntime=e.v,exports.filterSensitiveData=e.p,exports.formatLevel=e.c,exports.formatLogEntry=e.l,exports.getDefaultConfig=e.t,exports.getTransportFactory=t.d,exports.isBrowser=e.y,exports.isBun=e.b,exports.isDeno=e.x,exports.isNode=e.S,exports.loadConfigFromEnvironment=e.n,exports.loadConfigFromFile=t.t,exports.log=r,exports.logLevelToString=t.a,exports.logger=n,exports.mergeConfigs=e.r,exports.registerTransport=t.f,exports.resetEnvironmentWarnings=e.i,exports.safeStringify=e.m,exports.serializeError=e.h,exports.shouldColorize=e.a,exports.stringToLogLevel=t.o,exports.tryParseLogLevel=e.o;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, t as g, u as _, v, x as y, y as b } from "./chunks/config-
|
|
2
|
-
import { a as x, d as S, f as C, i as w, l as T, n as E, o as D, r as O, t as k, u as A } from "./chunks/config-file-
|
|
1
|
+
import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, t as g, u as _, v, x as y, y as b } from "./chunks/config-C0Vj3nIk.mjs";
|
|
2
|
+
import { a as x, d as S, f as C, i as w, l as T, n as E, o as D, r as O, t as k, u as A } from "./chunks/config-file-CmxNUX1Z.mjs";
|
|
3
3
|
//#region src/index.ts
|
|
4
4
|
var j = w(), M = {
|
|
5
5
|
debug: (e, t) => j.debug(e, t),
|
package/dist/node.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/config-file-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/config-file-BNPm7ZNS.cjs"),t=require("./chunks/file-transport-oFpf1vbE.cjs");exports.ConsoleTransport=e.l,exports.FileTransport=t.t,exports.NodeLogger=e.s,exports.createLogger=e.r,exports.createLoggerForEnvironment=e.i,exports.createMorganStream=e.c,exports.createTransports=e.u,exports.loadConfigFromFile=e.t,exports.registerTransport=e.f;
|
package/dist/node.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { c as e, f as t, i as n, l as r, r as i, s as a, t as o, u as s } from "./chunks/config-file-
|
|
2
|
-
import { t as c } from "./chunks/file-transport-
|
|
1
|
+
import { c as e, f as t, i as n, l as r, r as i, s as a, t as o, u as s } from "./chunks/config-file-CmxNUX1Z.mjs";
|
|
2
|
+
import { t as c } from "./chunks/file-transport-Y2ZoG0re.mjs";
|
|
3
3
|
export { r as ConsoleTransport, c as FileTransport, a as NodeLogger, i as createLogger, n as createLoggerForEnvironment, e as createMorganStream, s as createTransports, o as loadConfigFromFile, t as registerTransport };
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(){let e=t();return{name:e,version:n(e),capabilities:r(e)}}function t(){return globalThis.Deno===void 0?globalThis.Bun===void 0?typeof window<`u`&&typeof document<`u`?`browser`:typeof globalThis.importScripts==`function`&&typeof window>`u`?`webworker`:typeof process<`u`&&process.versions&&process.versions.node?`node`:`unknown`:`bun`:`deno`}function n(e){switch(e){case`node`:return typeof process<`u`?process.version:void 0;case`deno`:return globalThis.Deno===void 0?void 0:globalThis.Deno.version?.deno;case`bun`:return globalThis.Bun===void 0?void 0:globalThis.Bun.version;case`browser`:return typeof navigator<`u`?navigator.userAgent:void 0;default:return}}function r(e){switch(e){case`node`:return{fileSystem:!0,colorSupport:!0,processInfo:!0,streams:!0};case`deno`:return{fileSystem:!0,colorSupport:!0,processInfo:!0,streams:!0};case`bun`:return{fileSystem:!0,colorSupport:!0,processInfo:!0,streams:!0};case`browser`:return{fileSystem:!1,colorSupport:!0,processInfo:!1,streams:!1};case`webworker`:return{fileSystem:!1,colorSupport:!1,processInfo:!1,streams:!1};default:return{fileSystem:!1,colorSupport:!1,processInfo:!1,streams:!1}}}function i(){return t()===`node`}function a(){return t()===`browser`}function o(){return t()===`deno`}function s(){return t()===`bun`}var c=function(e){return e[e.DEBUG=0]=`DEBUG`,e[e.INFO=1]=`INFO`,e[e.WARN=2]=`WARN`,e[e.ERROR=3]=`ERROR`,e[e.SILENT=4]=`SILENT`,e}({}),l=class{constructor(t={}){this.childMetadata={},this.config=t,this.level=t.level??c.INFO,this.runtime=e().name,this.childMetadata={...t.metadata}}debug(e,t){this.log(c.DEBUG,e,t)}info(e,t){this.log(c.INFO,e,t)}warn(e,t){this.log(c.WARN,e,t)}error(e,t){this.log(c.ERROR,e,t)}log(e,t,n){if(!this.shouldLog(e))return;let r=typeof t==`function`?t():t,i={...this.childMetadata,...n},a={timestamp:new Date,level:e,message:r,metadata:Object.keys(i).length>0?i:void 0,runtime:this.runtime};this.writeLog(a)}setLevel(e){this.level=e}getLevel(){return this.level}child(e){let t=this.createChild();return t.childMetadata={...this.childMetadata,...e},t}shouldLog(e){return e>=this.level}},u=100;function d(e,t,n,r){if(e===void 0)return`[undefined]`;if(typeof e==`bigint`)return`[BigInt: ${e.toString()}]`;if(typeof e==`symbol`)return`[Symbol: ${e.toString()}]`;if(typeof e==`function`)return`[Function: ${e.name||`anonymous`}]`;if(typeof e!=`object`||!e)return e;let i=e;if(t.has(i))return`[Circular]`;if(n>=r)return`[MaxDepth]`;t.add(i);try{if(i instanceof Error)return f(C(i),t,n,r);let e=i.toJSON;if(typeof e==`function`)return d(e.call(i),t,n,r);if(Array.isArray(i)){let e=[];for(let a=0;a<i.length;a++)e.push(d(i[a],t,n+1,r));return e}return f(i,t,n,r)}finally{t.delete(i)}}function f(e,t,n,r){let i={};for(let[a,o]of Object.entries(e))i[a]=d(o,t,n+1,r);return i}function p(e,t,n={}){let r=n.maxDepth??u;return JSON.stringify(d(e,new Set,0,r),null,t)}var m=[`password`,`token`,`secret`,`key`,`auth`,`authorization`,`apikey`,`authtoken`,`accesstoken`,`secretkey`],h=/[A-Z]+(?![a-z])|[A-Z]?[a-z]+|[0-9]+/g;function g(e){return(e.match(h)??[]).map(e=>e.toLowerCase())}function _(e){let t=[];for(let n of e){let e=g(n);if(e.length===0)continue;let r=e.join(``);t.push({tokens:e.map(e=>[e,`${e}s`]),joined:r,joinedPlural:`${r}s`})}return t}function v(e,t){let n=g(e);if(n.length===0)return!1;let r=n.join(``);return t.some(e=>e.tokens.every(([e,t])=>n.includes(e)||n.includes(t))||r===e.joined||r===e.joinedPlural)}function y(e,t){if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let[r,i]of Object.entries(e))n[r]=v(r,t)?`[REDACTED]`:typeof i==`object`&&i?y(i,t):i;return n}function b(e,t=m){return y(e,_(t))}var x=[`name`,`message`,`stack`];function S(e,t){let n=Object.getOwnPropertyDescriptor(e,t);if(n){if(n.get)try{return n.get.call(e)}catch{return`[Throws]`}return n.value}}function C(e){if(!(e instanceof Error))return e;let t={name:e.name,message:e.message};e.stack!==void 0&&(t.stack=e.stack);for(let n of Object.getOwnPropertyNames(e))x.includes(n)||(t[n]=S(e,n));return t}var w=class e extends l{constructor(e={}){super(e)}writeLog(e){let t=this.formatMessage(e),n=this.getConsoleStyle(e.level),r=`%c${t}${e.metadata?` ${p(e.metadata)}`:``}`;switch(e.level){case c.DEBUG:console.debug?console.debug(r,n):console.log(r,n);break;case c.INFO:console.info(r,n);break;case c.WARN:console.warn(r,n);break;case c.ERROR:console.error(r,n)}}createChild(){return new e(this.config)}formatMessage(e){return`[${e.timestamp.toISOString()}] ${c[e.level].toUpperCase()}: ${e.message}`}getConsoleStyle(e){if(!this.config.colorize)return``;switch(e){case c.DEBUG:return`color: #888; font-weight: normal;`;case c.INFO:return`color: #007acc; font-weight: normal;`;case c.WARN:return`color: #ff8c00; font-weight: bold;`;case c.ERROR:return`color: #dc3545; font-weight: bold;`;default:return``}}shouldLogInProduction(){return(globalThis.process?.env?.NODE_ENV||globalThis.process?.env?.NEXT_PUBLIC_APP_ENV||`development`)!==`production`||this.level<=c.ERROR}shouldLog(e){return!this.shouldLogInProduction()&&e<c.ERROR?!1:super.shouldLog(e)}},T=class extends w{constructor(...e){super(...e),this.groupStack=[]}group(e){console.group(e),this.groupStack.push(e)}groupCollapsed(e){console.groupCollapsed(e),this.groupStack.push(e)}groupEnd(){console.groupEnd(),this.groupStack.pop()}getCurrentGroupStack(){return[...this.groupStack]}getCurrentGroupPath(){return this.groupStack.join(` > `)}time(e){console.time(e)}timeEnd(e){console.timeEnd(e)}trace(e,t){console.trace(e,t)}count(e){console.count(e)}countReset(e){console.countReset(e)}table(e){console.table(e)}},E=class extends w{mark(e){typeof performance<`u`&&performance.mark&&performance.mark(e)}measure(e,t,n){if(typeof performance<`u`&&performance.measure)try{performance.measure(e,t,n);let r=performance.getEntriesByName(e,`measure`);if(r.length>0){let t=r[r.length-1];this.info(`Performance: ${e}`,{duration:t.duration,startTime:t.startTime})}}catch(t){this.warn(`Failed to measure performance`,{name:e,error:t})}}clearMarks(e){typeof performance<`u`&&performance.clearMarks&&performance.clearMarks(e)}clearMeasures(e){typeof performance<`u`&&performance.clearMeasures&&performance.clearMeasures(e)}};function D(e,t=`text`,n={}){if(t===`json`){let t={timestamp:e.timestamp.toISOString(),level:c[e.level].toLowerCase(),message:e.message,runtime:e.runtime};return e.metadata!==void 0&&(t.metadata=e.metadata),p(t)}let r=n.timestamp===!1?``:`[${e.timestamp.toISOString()}] `,i=O(e.level,n.colorize===!0),a=e.metadata?` ${p(e.metadata)}`:``;return`${r}${i}: ${e.message}${a}`}function O(e,t=!1){let n=c[e].toUpperCase();if(!t)return n;let r={[c.DEBUG]:`\x1B[36m`,[c.INFO]:`\x1B[32m`,[c.WARN]:`\x1B[33m`,[c.ERROR]:`\x1B[31m`,[c.SILENT]:`\x1B[37m`};return`${r[e]||r[c.INFO]}${n}[0m`}var k=new Set;function A(e){k.has(e)||(k.add(e),console.warn(e))}function j(){k.clear()}function M(){return e().capabilities.colorSupport?typeof process>`u`||!process.env?!0:process.env.NO_COLOR?!1:process.env.FORCE_COLOR?process.env.FORCE_COLOR!==`0`:process.stdout?.isTTY===!0:!1}function N(){return{level:c.INFO,format:`text`,timestamp:!0,colorize:M(),metadata:{},transports:[{type:`console`,options:{}}]}}var P=[`true`,`1`,`yes`,`on`],F=[`false`,`0`,`no`,`off`];function I(){j()}function L(e){switch(e.trim().toLowerCase()){case`debug`:return c.DEBUG;case`info`:return c.INFO;case`warn`:case`warning`:return c.WARN;case`error`:return c.ERROR;case`silent`:case`none`:return c.SILENT;default:return}}function R(e,t){let n=t.trim().toLowerCase();if(P.includes(n))return!0;if(F.includes(n))return!1;A(`[logan-logger] ${e}="${t}" is not a recognized boolean and was ignored. Accepted: ${P.join(`, `)} / ${F.join(`, `)}.`)}function z(){let e={};if(typeof process>`u`||!process.env)return e;let t=process.env;if(t.LOG_LEVEL){let n=L(t.LOG_LEVEL);n===void 0?A(`[logan-logger] LOG_LEVEL="${t.LOG_LEVEL}" is not a recognized level and was ignored. Accepted: debug, info, warn, error, silent.`):e.level=n}if(t.LOG_FORMAT){let n=t.LOG_FORMAT.trim().toLowerCase();n===`json`||n===`text`?e.format=n:A(`[logan-logger] LOG_FORMAT="${t.LOG_FORMAT}" is not a recognized format and was ignored. Accepted: json, text.`)}if(t.LOG_TIMESTAMP){let n=R(`LOG_TIMESTAMP`,t.LOG_TIMESTAMP);n!==void 0&&(e.timestamp=n)}if(t.LOG_COLOR){let n=R(`LOG_COLOR`,t.LOG_COLOR);n!==void 0&&(e.colorize=n)}return e}function B(...e){let t=N();return e.reduce((e,t)=>({...e,...t,metadata:{...e.metadata,...t.metadata},transports:t.transports||e.transports}),t)}Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return a}});
|