logan-logger 1.1.21 → 1.2.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 +21 -42
- package/dist/bun.cjs +1 -1
- package/dist/bun.d.cts +1 -0
- package/dist/bun.d.mts +1 -0
- package/dist/bun.d.ts +1 -0
- package/dist/bun.mjs +5 -4
- package/dist/chunks/{__vite-browser-external-BgoQtmXf.mjs → __vite-browser-external-CoORGUub.mjs} +1 -1
- package/dist/chunks/__vite-browser-external-cJWmSHhJ.cjs +1 -0
- package/dist/chunks/config-B48Pv18Z.cjs +1 -0
- package/dist/chunks/{browser-D5QY2oJb.mjs → config-BMoOvawe.mjs} +87 -2
- package/dist/chunks/config-file-6g_8ruoz.mjs +68 -0
- package/dist/chunks/config-file-BBER_82d.cjs +1 -0
- package/dist/chunks/factory-BgsTZqNI.cjs +1 -0
- package/dist/chunks/factory-C-jQh2-v.mjs +137 -0
- package/dist/chunks/formatting-Dd2W74v3.mjs +29 -0
- package/dist/chunks/formatting-DpOQuUe0.cjs +1 -0
- package/dist/core/factory.d.cts +22 -0
- package/dist/core/factory.d.mts +22 -0
- package/dist/core/factory.d.ts +22 -0
- package/dist/core/types.d.cts +9 -0
- package/dist/core/types.d.mts +9 -0
- package/dist/core/types.d.ts +9 -0
- package/dist/deno.cjs +1 -1
- package/dist/deno.d.cts +1 -0
- package/dist/deno.d.mts +1 -0
- package/dist/deno.d.ts +1 -0
- package/dist/deno.mjs +5 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +10 -9
- package/dist/node.cjs +1 -1
- package/dist/node.mjs +2 -2
- package/dist/utils/config-file.d.cts +2 -0
- package/dist/utils/config-file.d.mts +2 -0
- package/dist/utils/config-file.d.ts +2 -0
- package/dist/utils/config.d.cts +22 -2
- package/dist/utils/config.d.mts +22 -2
- package/dist/utils/config.d.ts +22 -2
- package/package.json +1 -1
- package/dist/chunks/__vite-browser-external-Bjj3r6ML.cjs +0 -1
- package/dist/chunks/browser-Bq67gUmd.cjs +0 -1
- package/dist/chunks/factory-2po65gyH.mjs +0 -262
- package/dist/chunks/factory-CluPoiZb.cjs +0 -1
- package/dist/chunks/formatting-CLctAPm9.mjs +0 -29
- package/dist/chunks/formatting-Cb_xXgov.cjs +0 -1
package/dist/browser.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/config-B48Pv18Z.cjs"),t=require("./chunks/formatting-DpOQuUe0.cjs");function n(){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 r(t){switch(t){case`production`:return e.p.ERROR;case`staging`:case`test`:return e.p.WARN;case`development`:case`dev`:return e.p.DEBUG;default:return e.p.INFO}}function i(t={}){let n=t.ignoreEnvironment?{}:e.n();return new e.o(e.r(t,n))}function a(){let e=n();return i({level:r(e),colorize:e!==`production`,timestamp:!0,format:e===`production`?`json`:`text`})}var o=a(),s={debug:(e,t)=>o.debug(e,t),info:(e,t)=>o.info(e,t),warn:(e,t)=>o.warn(e,t),error:(e,t)=>o.error(e,t)};exports.BrowserLogger=e.o,exports.ConsoleGroupLogger=e.s,exports.LogLevel=e.p,exports.PerformanceLogger=e.c,exports.createLogger=i,exports.createLoggerForEnvironment=a,exports.detectRuntime=e.m,exports.filterSensitiveData=e.l,exports.formatLevel=t.t,exports.formatLogEntry=t.n,exports.isBrowser=e.h,exports.isBun=e.g,exports.isDeno=e._,exports.isNode=e.v,exports.log=s,exports.logger=o,exports.safeStringify=e.u,exports.serializeError=e.d;
|
package/dist/browser.mjs
CHANGED
|
@@ -1,58 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
1
|
+
import { _ as e, c as t, d as n, g as r, h as i, l as a, m as o, n as s, o as c, p as l, r as u, s as d, u as f, v as p } from "./chunks/config-BMoOvawe.mjs";
|
|
2
|
+
import { n as m, t as h } from "./chunks/formatting-Dd2W74v3.mjs";
|
|
3
3
|
//#region src/browser.ts
|
|
4
|
-
function
|
|
5
|
-
let e = a();
|
|
6
|
-
return {
|
|
7
|
-
level: t.INFO,
|
|
8
|
-
format: "text",
|
|
9
|
-
timestamp: !0,
|
|
10
|
-
colorize: e.capabilities.colorSupport,
|
|
11
|
-
metadata: {},
|
|
12
|
-
transports: [{
|
|
13
|
-
type: "console",
|
|
14
|
-
options: {}
|
|
15
|
-
}]
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function h() {
|
|
4
|
+
function g() {
|
|
19
5
|
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";
|
|
20
6
|
}
|
|
21
|
-
function
|
|
7
|
+
function _(e) {
|
|
22
8
|
switch (e) {
|
|
23
|
-
case "production": return
|
|
9
|
+
case "production": return l.ERROR;
|
|
24
10
|
case "staging":
|
|
25
|
-
case "test": return
|
|
11
|
+
case "test": return l.WARN;
|
|
26
12
|
case "development":
|
|
27
|
-
case "dev": return
|
|
28
|
-
default: return
|
|
13
|
+
case "dev": return l.DEBUG;
|
|
14
|
+
default: return l.INFO;
|
|
29
15
|
}
|
|
30
16
|
}
|
|
31
|
-
function
|
|
32
|
-
let t =
|
|
33
|
-
|
|
34
|
-
...e,
|
|
35
|
-
metadata: {
|
|
36
|
-
...t.metadata,
|
|
37
|
-
...e.metadata
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
return new u(n);
|
|
17
|
+
function v(e = {}) {
|
|
18
|
+
let t = e.ignoreEnvironment ? {} : s();
|
|
19
|
+
return new c(u(e, t));
|
|
41
20
|
}
|
|
42
|
-
function
|
|
43
|
-
let e =
|
|
44
|
-
return
|
|
45
|
-
level:
|
|
21
|
+
function y() {
|
|
22
|
+
let e = g();
|
|
23
|
+
return v({
|
|
24
|
+
level: _(e),
|
|
46
25
|
colorize: e !== "production",
|
|
47
26
|
timestamp: !0,
|
|
48
27
|
format: e === "production" ? "json" : "text"
|
|
49
28
|
});
|
|
50
29
|
}
|
|
51
|
-
var
|
|
52
|
-
debug: (e, t) =>
|
|
53
|
-
info: (e, t) =>
|
|
54
|
-
warn: (e, t) =>
|
|
55
|
-
error: (e, t) =>
|
|
30
|
+
var b = y(), x = {
|
|
31
|
+
debug: (e, t) => b.debug(e, t),
|
|
32
|
+
info: (e, t) => b.info(e, t),
|
|
33
|
+
warn: (e, t) => b.warn(e, t),
|
|
34
|
+
error: (e, t) => b.error(e, t)
|
|
56
35
|
};
|
|
57
36
|
//#endregion
|
|
58
|
-
export {
|
|
37
|
+
export { c as BrowserLogger, d as ConsoleGroupLogger, l as LogLevel, t as PerformanceLogger, v as createLogger, y as createLoggerForEnvironment, o as detectRuntime, a as filterSensitiveData, h as formatLevel, m as formatLogEntry, i as isBrowser, r as isBun, e as isDeno, p as isNode, x as log, b as logger, f as safeStringify, n as serializeError };
|
package/dist/bun.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/config-file-BBER_82d.cjs"),t=require("./chunks/config-B48Pv18Z.cjs"),n=require("./chunks/factory-BgsTZqNI.cjs"),r=require("./chunks/formatting-DpOQuUe0.cjs");exports.NodeLogger=n.o,exports.createLogger=n.n,exports.createLoggerForEnvironment=n.r,exports.detectRuntime=t.m,exports.filterSensitiveData=t.l,exports.formatLevel=r.t,exports.formatLogEntry=r.n,exports.getDefaultConfig=t.t,exports.isBrowser=t.h,exports.isBun=t.g,exports.isDeno=t._,exports.isNode=t.v,exports.loadConfigFromEnvironment=t.n,exports.loadConfigFromFile=e.t,exports.mergeConfigs=t.r,exports.resetEnvironmentWarnings=t.i,exports.safeStringify=t.u,exports.serializeError=t.d,exports.tryParseLogLevel=t.a;
|
package/dist/bun.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { createLogger, createLoggerForEnvironment } from './core/factory.cjs';
|
|
2
2
|
export type { ILogger, LoggerConfig, LogLevel } from './core/types.cjs';
|
|
3
3
|
export { NodeLogger } from './runtime/node.cjs';
|
|
4
|
+
export * from './utils/config-file.cjs';
|
|
4
5
|
export * from './utils/config.cjs';
|
|
5
6
|
export * from './utils/formatting.cjs';
|
|
6
7
|
export * from './utils/runtime.cjs';
|
package/dist/bun.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { createLogger, createLoggerForEnvironment } from './core/factory.mjs';
|
|
2
2
|
export type { ILogger, LoggerConfig, LogLevel } from './core/types.mjs';
|
|
3
3
|
export { NodeLogger } from './runtime/node.mjs';
|
|
4
|
+
export * from './utils/config-file.mjs';
|
|
4
5
|
export * from './utils/config.mjs';
|
|
5
6
|
export * from './utils/formatting.mjs';
|
|
6
7
|
export * from './utils/runtime.mjs';
|
package/dist/bun.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { createLogger, createLoggerForEnvironment } from './core/factory';
|
|
2
2
|
export type { ILogger, LoggerConfig, LogLevel } from './core/types';
|
|
3
3
|
export { NodeLogger } from './runtime/node';
|
|
4
|
+
export * from './utils/config-file';
|
|
4
5
|
export * from './utils/config';
|
|
5
6
|
export * from './utils/formatting';
|
|
6
7
|
export * from './utils/runtime';
|
package/dist/bun.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import { n as h,
|
|
4
|
-
|
|
1
|
+
import { t as e } from "./chunks/config-file-6g_8ruoz.mjs";
|
|
2
|
+
import { _ as t, a as n, d as r, g as i, h as a, i as o, l as s, m as c, n as l, r as u, t as d, u as f, v as p } from "./chunks/config-BMoOvawe.mjs";
|
|
3
|
+
import { n as m, o as h, r as g } from "./chunks/factory-C-jQh2-v.mjs";
|
|
4
|
+
import { n as _, t as v } from "./chunks/formatting-Dd2W74v3.mjs";
|
|
5
|
+
export { h as NodeLogger, m as createLogger, g as createLoggerForEnvironment, c as detectRuntime, s as filterSensitiveData, v as formatLevel, _ as formatLogEntry, d as getDefaultConfig, a as isBrowser, i as isBun, t as isDeno, p as isNode, l as loadConfigFromEnvironment, e as loadConfigFromFile, u as mergeConfigs, o as resetEnvironmentWarnings, f as safeStringify, r as serializeError, n as tryParseLogLevel };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=require("./config-file-BBER_82d.cjs").n(((e,t)=>{t.exports={}}));Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return e()}});
|
|
@@ -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=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}};function u(e,t){let n=new WeakSet;return JSON.stringify(e,(e,t)=>{if(typeof t==`object`&&t){if(n.has(t))return`[Circular]`;n.add(t)}return t instanceof Error?m(t):typeof t==`function`?`[Function: ${t.name||`anonymous`}]`:t===void 0?`[undefined]`:typeof t==`bigint`?`[BigInt: ${t.toString()}]`:typeof t==`symbol`?`[Symbol: ${t.toString()}]`:t},t)}function d(e,t=[`password`,`token`,`secret`,`key`,`auth`]){if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let[r,i]of Object.entries(e))n[r]=t.some(e=>r.toLowerCase().includes(e.toLowerCase()))?`[REDACTED]`:typeof i==`object`&&i?d(i,t):i;return n}var f=[`name`,`message`,`stack`];function p(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 m(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))f.includes(n)||(t[n]=p(e,n));return t}var h=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?` ${u(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)}},g=class extends h{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)}},_=class extends h{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 v(){let t=e();return{level:c.INFO,format:`text`,timestamp:!0,colorize:t.capabilities.colorSupport,metadata:{},transports:[{type:`console`,options:{}}]}}var y=[`true`,`1`,`yes`,`on`],b=[`false`,`0`,`no`,`off`],x=new Set;function S(e){x.has(e)||(x.add(e),console.warn(e))}function C(){x.clear()}function w(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 T(e,t){let n=t.trim().toLowerCase();if(y.includes(n))return!0;if(b.includes(n))return!1;S(`[logan-logger] ${e}="${t}" is not a recognized boolean and was ignored. Accepted: ${y.join(`, `)} / ${b.join(`, `)}.`)}function E(){let e={};if(typeof process>`u`||!process.env)return e;let t=process.env;if(t.LOG_LEVEL){let n=w(t.LOG_LEVEL);n===void 0?S(`[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:S(`[logan-logger] LOG_FORMAT="${t.LOG_FORMAT}" is not a recognized format and was ignored. Accepted: json, text.`)}if(t.LOG_TIMESTAMP){let n=T(`LOG_TIMESTAMP`,t.LOG_TIMESTAMP);n!==void 0&&(e.timestamp=n)}if(t.LOG_COLOR){let n=T(`LOG_COLOR`,t.LOG_COLOR);n!==void 0&&(e.colorize=n)}return e}function D(...e){let t=v();return e.reduce((e,t)=>({...e,...t,metadata:{...e.metadata,...t.metadata},transports:t.transports||e.transports}),t)}Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return i}});
|
|
@@ -77,7 +77,7 @@ var c = /* @__PURE__ */ function(e) {
|
|
|
77
77
|
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
78
|
}({}), l = class {
|
|
79
79
|
constructor(t = {}) {
|
|
80
|
-
this.childMetadata = {}, this.config = t, this.level = t.level ?? c.INFO, this.runtime = e().name;
|
|
80
|
+
this.childMetadata = {}, this.config = t, this.level = t.level ?? c.INFO, this.runtime = e().name, this.childMetadata = { ...t.metadata };
|
|
81
81
|
}
|
|
82
82
|
debug(e, t) {
|
|
83
83
|
this.log(c.DEBUG, e, t);
|
|
@@ -282,4 +282,89 @@ var h = class e extends l {
|
|
|
282
282
|
}
|
|
283
283
|
};
|
|
284
284
|
//#endregion
|
|
285
|
-
|
|
285
|
+
//#region src/utils/config.ts
|
|
286
|
+
function v() {
|
|
287
|
+
let t = e();
|
|
288
|
+
return {
|
|
289
|
+
level: c.INFO,
|
|
290
|
+
format: "text",
|
|
291
|
+
timestamp: !0,
|
|
292
|
+
colorize: t.capabilities.colorSupport,
|
|
293
|
+
metadata: {},
|
|
294
|
+
transports: [{
|
|
295
|
+
type: "console",
|
|
296
|
+
options: {}
|
|
297
|
+
}]
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
var y = [
|
|
301
|
+
"true",
|
|
302
|
+
"1",
|
|
303
|
+
"yes",
|
|
304
|
+
"on"
|
|
305
|
+
], b = [
|
|
306
|
+
"false",
|
|
307
|
+
"0",
|
|
308
|
+
"no",
|
|
309
|
+
"off"
|
|
310
|
+
], x = /* @__PURE__ */ new Set();
|
|
311
|
+
function S(e) {
|
|
312
|
+
x.has(e) || (x.add(e), console.warn(e));
|
|
313
|
+
}
|
|
314
|
+
function C() {
|
|
315
|
+
x.clear();
|
|
316
|
+
}
|
|
317
|
+
function w(e) {
|
|
318
|
+
switch (e.trim().toLowerCase()) {
|
|
319
|
+
case "debug": return c.DEBUG;
|
|
320
|
+
case "info": return c.INFO;
|
|
321
|
+
case "warn":
|
|
322
|
+
case "warning": return c.WARN;
|
|
323
|
+
case "error": return c.ERROR;
|
|
324
|
+
case "silent":
|
|
325
|
+
case "none": return c.SILENT;
|
|
326
|
+
default: return;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
function T(e, t) {
|
|
330
|
+
let n = t.trim().toLowerCase();
|
|
331
|
+
if (y.includes(n)) return !0;
|
|
332
|
+
if (b.includes(n)) return !1;
|
|
333
|
+
S(`[logan-logger] ${e}="${t}" is not a recognized boolean and was ignored. Accepted: ${y.join(", ")} / ${b.join(", ")}.`);
|
|
334
|
+
}
|
|
335
|
+
function E() {
|
|
336
|
+
let e = {};
|
|
337
|
+
if (typeof process > "u" || !process.env) return e;
|
|
338
|
+
let t = process.env;
|
|
339
|
+
if (t.LOG_LEVEL) {
|
|
340
|
+
let n = w(t.LOG_LEVEL);
|
|
341
|
+
n === void 0 ? S(`[logan-logger] LOG_LEVEL="${t.LOG_LEVEL}" is not a recognized level and was ignored. Accepted: debug, info, warn, error, silent.`) : e.level = n;
|
|
342
|
+
}
|
|
343
|
+
if (t.LOG_FORMAT) {
|
|
344
|
+
let n = t.LOG_FORMAT.trim().toLowerCase();
|
|
345
|
+
n === "json" || n === "text" ? e.format = n : S(`[logan-logger] LOG_FORMAT="${t.LOG_FORMAT}" is not a recognized format and was ignored. Accepted: json, text.`);
|
|
346
|
+
}
|
|
347
|
+
if (t.LOG_TIMESTAMP) {
|
|
348
|
+
let n = T("LOG_TIMESTAMP", t.LOG_TIMESTAMP);
|
|
349
|
+
n !== void 0 && (e.timestamp = n);
|
|
350
|
+
}
|
|
351
|
+
if (t.LOG_COLOR) {
|
|
352
|
+
let n = T("LOG_COLOR", t.LOG_COLOR);
|
|
353
|
+
n !== void 0 && (e.colorize = n);
|
|
354
|
+
}
|
|
355
|
+
return e;
|
|
356
|
+
}
|
|
357
|
+
function D(...e) {
|
|
358
|
+
let t = v();
|
|
359
|
+
return e.reduce((e, t) => ({
|
|
360
|
+
...e,
|
|
361
|
+
...t,
|
|
362
|
+
metadata: {
|
|
363
|
+
...e.metadata,
|
|
364
|
+
...t.metadata
|
|
365
|
+
},
|
|
366
|
+
transports: t.transports || e.transports
|
|
367
|
+
}), t);
|
|
368
|
+
}
|
|
369
|
+
//#endregion
|
|
370
|
+
export { o as _, w as a, _ as c, m as d, l as f, s as g, a as h, C as i, d as l, e as m, E as n, h as o, c as p, D as r, g as s, v as t, u, i as v };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { m as e } from "./config-BMoOvawe.mjs";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var t = Object.create, n = Object.defineProperty, r = Object.getOwnPropertyDescriptor, i = Object.getOwnPropertyNames, a = Object.getPrototypeOf, o = Object.prototype.hasOwnProperty, s = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), c = (e, t, a, s) => {
|
|
4
|
+
if (t && typeof t == "object" || typeof t == "function") for (var c = i(t), l = 0, u = c.length, d; l < u; l++) d = c[l], !o.call(e, d) && d !== a && n(e, d, {
|
|
5
|
+
get: ((e) => t[e]).bind(null, d),
|
|
6
|
+
enumerable: !(s = r(t, d)) || s.enumerable
|
|
7
|
+
});
|
|
8
|
+
return e;
|
|
9
|
+
}, l = (e, r, i) => (i = e == null ? {} : t(a(e)), c(r || !e || !e.__esModule || !o.call(e, "default") ? n(i, "default", {
|
|
10
|
+
value: e,
|
|
11
|
+
enumerable: !0
|
|
12
|
+
}) : i, e));
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/utils/config-file.ts
|
|
15
|
+
async function u(t) {
|
|
16
|
+
let n = e();
|
|
17
|
+
if (!n.capabilities.fileSystem) return {};
|
|
18
|
+
let r = t ? [t] : [
|
|
19
|
+
"logan.config.json",
|
|
20
|
+
"logan.config.js",
|
|
21
|
+
".loganrc",
|
|
22
|
+
"package.json"
|
|
23
|
+
];
|
|
24
|
+
for (let e of r) try {
|
|
25
|
+
if (n.name === "node") return await d(e);
|
|
26
|
+
if (n.name === "deno") return await f(e);
|
|
27
|
+
if (n.name === "bun") return await p(e);
|
|
28
|
+
} catch {}
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
async function d(e) {
|
|
32
|
+
try {
|
|
33
|
+
let t = await import("./__vite-browser-external-CoORGUub.mjs").then((e) => /* @__PURE__ */ l(e.default)), n = await import("./__vite-browser-external-CoORGUub.mjs").then((e) => /* @__PURE__ */ l(e.default));
|
|
34
|
+
if (e.endsWith(".json")) {
|
|
35
|
+
let n = await t.readFile(e, "utf-8"), r = JSON.parse(n);
|
|
36
|
+
return e === "package.json" ? r.logan || {} : r;
|
|
37
|
+
}
|
|
38
|
+
if (e.endsWith(".js")) {
|
|
39
|
+
let t = await import(
|
|
40
|
+
/* @vite-ignore */
|
|
41
|
+
`file://${n.resolve(e)}`
|
|
42
|
+
);
|
|
43
|
+
return t.default || t;
|
|
44
|
+
}
|
|
45
|
+
} catch {}
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
async function f(e) {
|
|
49
|
+
try {
|
|
50
|
+
if (e.endsWith(".json")) {
|
|
51
|
+
let t = await globalThis.Deno.readTextFile(e), n = JSON.parse(t);
|
|
52
|
+
return e === "package.json" ? n.logan || {} : n;
|
|
53
|
+
}
|
|
54
|
+
if (e.endsWith(".js")) {
|
|
55
|
+
let t = await import(
|
|
56
|
+
/* @vite-ignore */
|
|
57
|
+
`./${e}`
|
|
58
|
+
);
|
|
59
|
+
return t.default || t;
|
|
60
|
+
}
|
|
61
|
+
} catch {}
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
64
|
+
async function p(e) {
|
|
65
|
+
return d(e);
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { s as n, u as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));const l=require("./config-B48Pv18Z.cjs");async function u(e){let t=l.m();if(!t.capabilities.fileSystem)return{};let n=e?[e]:[`logan.config.json`,`logan.config.js`,`.loganrc`,`package.json`];for(let e of n)try{if(t.name===`node`)return await d(e);if(t.name===`deno`)return await f(e);if(t.name===`bun`)return await p(e)}catch{}return{}}async function d(e){try{let t=await Promise.resolve().then(()=>c(require("./__vite-browser-external-cJWmSHhJ.cjs").default)),n=await Promise.resolve().then(()=>c(require("./__vite-browser-external-cJWmSHhJ.cjs").default));if(e.endsWith(`.json`)){let n=await t.readFile(e,`utf-8`),r=JSON.parse(n);return e===`package.json`?r.logan||{}:r}if(e.endsWith(`.js`)){let t=await import(`file://${n.resolve(e)}`);return t.default||t}}catch{}return{}}async function f(e){try{if(e.endsWith(`.json`)){let t=await globalThis.Deno.readTextFile(e),n=JSON.parse(t);return e===`package.json`?n.logan||{}:n}if(e.endsWith(`.js`)){let t=await import(`./${e}`);return t.default||t}}catch{}return{}}async function p(e){return d(e)}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./config-B48Pv18Z.cjs");var t=class t extends e.f{constructor(e={}){super(e),this.initializeWinston()}async initializeWinston(){try{let e=await import(`winston`);this.winston=this.createWinstonLogger(e)}catch(e){console.warn(`[logan-logger] Winston not found, falling back to console logging:`,e)}}createWinstonLogger(e){let t=e.format.combine(e.format.timestamp({format:`YYYY-MM-DD HH:mm:ss`}),e.format.errors({stack:!0}),e.format.json(),e.format.prettyPrint()),n=e.format.combine(e.format.colorize(),e.format.timestamp({format:`HH:mm:ss`}),e.format.printf(({timestamp:e,level:t,message:n,...r})=>`${e} [${t}]: ${n} ${Object.keys(r).length?JSON.stringify(r,null,2):``}`)),r=e.createLogger({level:this.getWinstonLevel(this.level),format:t,transports:[new e.transports.Console({format:process.env.NODE_ENV===`production`?t:n})]});return process.env.NODE_ENV===`production`&&(r.add(new e.transports.File({filename:`logs/error.log`,level:`error`,maxsize:5242880,maxFiles:5})),r.add(new e.transports.File({filename:`logs/combined.log`,maxsize:5242880,maxFiles:10}))),r}writeLog(e){this.winston?this.winston.log({level:this.getWinstonLevel(e.level),message:e.message,timestamp:e.timestamp,...e.metadata}):this.writeToConsole(e)}createChild(){return new t(this.config)}writeToConsole(t){let n=t.timestamp.toISOString(),r=e.p[t.level].toLowerCase(),i=t.metadata?` ${e.u(t.metadata)}`:``,a=`[${n}] ${r.toUpperCase()}: ${t.message}${i}`;switch(t.level){case e.p.DEBUG:console.debug(a);break;case e.p.INFO:console.info(a);break;case e.p.WARN:console.warn(a);break;case e.p.ERROR:console.error(a)}}getWinstonLevel(t){switch(t){case e.p.DEBUG:return`debug`;case e.p.INFO:return`info`;case e.p.WARN:return`warn`;case e.p.ERROR:return`error`;default:return`info`}}setLevel(e){super.setLevel(e),this.winston&&(this.winston.level=this.getWinstonLevel(e))}};function n(e){return{write:t=>{e.info(t.trim())}}}var r=class n{static create(r={}){let i=e.m(),a=n.mergeConfig(r);switch(i.name){case`node`:return new t(a);case`deno`:return new e.o(a);case`bun`:return new t(a);case`browser`:case`webworker`:return new e.o(a);default:return new e.o(a)}}static createChild(e,t){return e.child(t)}static mergeConfig(t){let n=t.ignoreEnvironment?{}:e.n();return e.r(t,n)}};function i(e){return r.create(e)}function a(){let e=o();return i({level:s(e),colorize:e!==`production`,timestamp:!0,format:e===`production`?`json`:`text`})}function o(){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 s(t){switch(t){case`production`:return e.p.ERROR;case`staging`:case`test`:return e.p.WARN;case`development`:case`dev`:return e.p.DEBUG;default:return e.p.INFO}}function c(t){return e.a(t)??e.p.INFO}function l(t){switch(t){case e.p.DEBUG:return`debug`;case e.p.INFO:return`info`;case e.p.WARN:return`warn`;case e.p.ERROR:return`error`;case e.p.SILENT:return`silent`;default:return`info`}}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { a as e, f as t, m as n, n as r, o as i, p as a, r as o, u as s } from "./config-BMoOvawe.mjs";
|
|
2
|
+
//#region src/runtime/node.ts
|
|
3
|
+
var c = class e extends t {
|
|
4
|
+
constructor(e = {}) {
|
|
5
|
+
super(e), this.initializeWinston();
|
|
6
|
+
}
|
|
7
|
+
async initializeWinston() {
|
|
8
|
+
try {
|
|
9
|
+
let e = await import("winston");
|
|
10
|
+
this.winston = this.createWinstonLogger(e);
|
|
11
|
+
} catch (e) {
|
|
12
|
+
console.warn("[logan-logger] Winston not found, falling back to console logging:", e);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
createWinstonLogger(e) {
|
|
16
|
+
let t = e.format.combine(e.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }), e.format.errors({ stack: !0 }), e.format.json(), e.format.prettyPrint()), n = e.format.combine(e.format.colorize(), e.format.timestamp({ format: "HH:mm:ss" }), e.format.printf(({ timestamp: e, level: t, message: n, ...r }) => `${e} [${t}]: ${n} ${Object.keys(r).length ? JSON.stringify(r, null, 2) : ""}`)), r = e.createLogger({
|
|
17
|
+
level: this.getWinstonLevel(this.level),
|
|
18
|
+
format: t,
|
|
19
|
+
transports: [new e.transports.Console({ format: process.env.NODE_ENV === "production" ? t : n })]
|
|
20
|
+
});
|
|
21
|
+
return process.env.NODE_ENV === "production" && (r.add(new e.transports.File({
|
|
22
|
+
filename: "logs/error.log",
|
|
23
|
+
level: "error",
|
|
24
|
+
maxsize: 5242880,
|
|
25
|
+
maxFiles: 5
|
|
26
|
+
})), r.add(new e.transports.File({
|
|
27
|
+
filename: "logs/combined.log",
|
|
28
|
+
maxsize: 5242880,
|
|
29
|
+
maxFiles: 10
|
|
30
|
+
}))), r;
|
|
31
|
+
}
|
|
32
|
+
writeLog(e) {
|
|
33
|
+
this.winston ? this.winston.log({
|
|
34
|
+
level: this.getWinstonLevel(e.level),
|
|
35
|
+
message: e.message,
|
|
36
|
+
timestamp: e.timestamp,
|
|
37
|
+
...e.metadata
|
|
38
|
+
}) : this.writeToConsole(e);
|
|
39
|
+
}
|
|
40
|
+
createChild() {
|
|
41
|
+
return new e(this.config);
|
|
42
|
+
}
|
|
43
|
+
writeToConsole(e) {
|
|
44
|
+
let t = e.timestamp.toISOString(), n = a[e.level].toLowerCase(), r = e.metadata ? ` ${s(e.metadata)}` : "", i = `[${t}] ${n.toUpperCase()}: ${e.message}${r}`;
|
|
45
|
+
switch (e.level) {
|
|
46
|
+
case a.DEBUG:
|
|
47
|
+
console.debug(i);
|
|
48
|
+
break;
|
|
49
|
+
case a.INFO:
|
|
50
|
+
console.info(i);
|
|
51
|
+
break;
|
|
52
|
+
case a.WARN:
|
|
53
|
+
console.warn(i);
|
|
54
|
+
break;
|
|
55
|
+
case a.ERROR: console.error(i);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
getWinstonLevel(e) {
|
|
59
|
+
switch (e) {
|
|
60
|
+
case a.DEBUG: return "debug";
|
|
61
|
+
case a.INFO: return "info";
|
|
62
|
+
case a.WARN: return "warn";
|
|
63
|
+
case a.ERROR: return "error";
|
|
64
|
+
default: return "info";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
setLevel(e) {
|
|
68
|
+
super.setLevel(e), this.winston && (this.winston.level = this.getWinstonLevel(e));
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
function l(e) {
|
|
72
|
+
return { write: (t) => {
|
|
73
|
+
e.info(t.trim());
|
|
74
|
+
} };
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/core/factory.ts
|
|
78
|
+
var u = class e {
|
|
79
|
+
static create(t = {}) {
|
|
80
|
+
let r = n(), a = e.mergeConfig(t);
|
|
81
|
+
switch (r.name) {
|
|
82
|
+
case "node": return new c(a);
|
|
83
|
+
case "deno": return new i(a);
|
|
84
|
+
case "bun": return new c(a);
|
|
85
|
+
case "browser":
|
|
86
|
+
case "webworker": return new i(a);
|
|
87
|
+
default: return new i(a);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
static createChild(e, t) {
|
|
91
|
+
return e.child(t);
|
|
92
|
+
}
|
|
93
|
+
static mergeConfig(e) {
|
|
94
|
+
let t = e.ignoreEnvironment ? {} : r();
|
|
95
|
+
return o(e, t);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
function d(e) {
|
|
99
|
+
return u.create(e);
|
|
100
|
+
}
|
|
101
|
+
function f() {
|
|
102
|
+
let e = p();
|
|
103
|
+
return d({
|
|
104
|
+
level: m(e),
|
|
105
|
+
colorize: e !== "production",
|
|
106
|
+
timestamp: !0,
|
|
107
|
+
format: e === "production" ? "json" : "text"
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function p() {
|
|
111
|
+
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";
|
|
112
|
+
}
|
|
113
|
+
function m(e) {
|
|
114
|
+
switch (e) {
|
|
115
|
+
case "production": return a.ERROR;
|
|
116
|
+
case "staging":
|
|
117
|
+
case "test": return a.WARN;
|
|
118
|
+
case "development":
|
|
119
|
+
case "dev": return a.DEBUG;
|
|
120
|
+
default: return a.INFO;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function h(t) {
|
|
124
|
+
return e(t) ?? a.INFO;
|
|
125
|
+
}
|
|
126
|
+
function g(e) {
|
|
127
|
+
switch (e) {
|
|
128
|
+
case a.DEBUG: return "debug";
|
|
129
|
+
case a.INFO: return "info";
|
|
130
|
+
case a.WARN: return "warn";
|
|
131
|
+
case a.ERROR: return "error";
|
|
132
|
+
case a.SILENT: return "silent";
|
|
133
|
+
default: return "info";
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
export { h as a, g as i, d as n, c as o, f as r, l as s, u as t };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { p as e, u as t } from "./config-BMoOvawe.mjs";
|
|
2
|
+
//#region src/utils/formatting.ts
|
|
3
|
+
function n(n, r = "text") {
|
|
4
|
+
if (r === "json") {
|
|
5
|
+
let r = {
|
|
6
|
+
timestamp: n.timestamp.toISOString(),
|
|
7
|
+
level: e[n.level].toLowerCase(),
|
|
8
|
+
message: n.message,
|
|
9
|
+
runtime: n.runtime
|
|
10
|
+
};
|
|
11
|
+
return n.metadata !== void 0 && (r.metadata = n.metadata), t(r);
|
|
12
|
+
}
|
|
13
|
+
let i = n.timestamp.toISOString(), a = e[n.level].toUpperCase(), o = n.metadata ? ` ${t(n.metadata)}` : "";
|
|
14
|
+
return `[${i}] ${a}: ${n.message}${o}`;
|
|
15
|
+
}
|
|
16
|
+
function r(t, n = !1) {
|
|
17
|
+
let r = e[t].toUpperCase();
|
|
18
|
+
if (!n) return r;
|
|
19
|
+
let i = {
|
|
20
|
+
[e.DEBUG]: "\x1B[36m",
|
|
21
|
+
[e.INFO]: "\x1B[32m",
|
|
22
|
+
[e.WARN]: "\x1B[33m",
|
|
23
|
+
[e.ERROR]: "\x1B[31m",
|
|
24
|
+
[e.SILENT]: "\x1B[37m"
|
|
25
|
+
};
|
|
26
|
+
return `${i[t] || i[e.INFO]}${r}[0m`;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { n, r as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./config-B48Pv18Z.cjs");function t(t,n=`text`){if(n===`json`){let n={timestamp:t.timestamp.toISOString(),level:e.p[t.level].toLowerCase(),message:t.message,runtime:t.runtime};return t.metadata!==void 0&&(n.metadata=t.metadata),e.u(n)}let r=t.timestamp.toISOString(),i=e.p[t.level].toUpperCase(),a=t.metadata?` ${e.u(t.metadata)}`:``;return`[${r}] ${i}: ${t.message}${a}`}function n(t,n=!1){let r=e.p[t].toUpperCase();if(!n)return r;let i={[e.p.DEBUG]:`\x1B[36m`,[e.p.INFO]:`\x1B[32m`,[e.p.WARN]:`\x1B[33m`,[e.p.ERROR]:`\x1B[31m`,[e.p.SILENT]:`\x1B[37m`};return`${i[t]||i[e.p.INFO]}${r}[0m`}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
|
package/dist/core/factory.d.cts
CHANGED
|
@@ -16,6 +16,20 @@ export declare class LoggerFactory {
|
|
|
16
16
|
* @returns A new logger instance with the additional metadata
|
|
17
17
|
*/
|
|
18
18
|
static createChild(parent: ILogger, metadata: Record<string, any>): ILogger;
|
|
19
|
+
/**
|
|
20
|
+
* Assemble the effective configuration.
|
|
21
|
+
*
|
|
22
|
+
* Precedence, lowest to highest:
|
|
23
|
+
*
|
|
24
|
+
* library defaults < explicit config < environment variables
|
|
25
|
+
*
|
|
26
|
+
* Environment variables win so that an operator can change logging on a
|
|
27
|
+
* running service without a deploy. A consumer that must not be overridden
|
|
28
|
+
* that way sets `ignoreEnvironment: true`.
|
|
29
|
+
*
|
|
30
|
+
* The config-file link of the chain documented in `docs/environment-variables.md`
|
|
31
|
+
* is still missing: `loadConfigFromFile` is async and this path is not.
|
|
32
|
+
*/
|
|
19
33
|
private static mergeConfig;
|
|
20
34
|
}
|
|
21
35
|
/**
|
|
@@ -42,5 +56,13 @@ export declare function createLogger(config?: Partial<LoggerConfig>): ILogger;
|
|
|
42
56
|
* @returns A logger instance configured for the current environment
|
|
43
57
|
*/
|
|
44
58
|
export declare function createLoggerForEnvironment(): ILogger;
|
|
59
|
+
/**
|
|
60
|
+
* Convert a level string to a `LogLevel`, falling back to INFO.
|
|
61
|
+
*
|
|
62
|
+
* Delegates to the single parser in `utils/config.ts`; use `tryParseLogLevel`
|
|
63
|
+
* directly when an unrecognized value should be distinguishable from `info`.
|
|
64
|
+
* @param level - The value to convert
|
|
65
|
+
* @returns The matching level, or `LogLevel.INFO`
|
|
66
|
+
*/
|
|
45
67
|
export declare function stringToLogLevel(level: string): LogLevel;
|
|
46
68
|
export declare function logLevelToString(level: LogLevel): string;
|
package/dist/core/factory.d.mts
CHANGED
|
@@ -16,6 +16,20 @@ export declare class LoggerFactory {
|
|
|
16
16
|
* @returns A new logger instance with the additional metadata
|
|
17
17
|
*/
|
|
18
18
|
static createChild(parent: ILogger, metadata: Record<string, any>): ILogger;
|
|
19
|
+
/**
|
|
20
|
+
* Assemble the effective configuration.
|
|
21
|
+
*
|
|
22
|
+
* Precedence, lowest to highest:
|
|
23
|
+
*
|
|
24
|
+
* library defaults < explicit config < environment variables
|
|
25
|
+
*
|
|
26
|
+
* Environment variables win so that an operator can change logging on a
|
|
27
|
+
* running service without a deploy. A consumer that must not be overridden
|
|
28
|
+
* that way sets `ignoreEnvironment: true`.
|
|
29
|
+
*
|
|
30
|
+
* The config-file link of the chain documented in `docs/environment-variables.md`
|
|
31
|
+
* is still missing: `loadConfigFromFile` is async and this path is not.
|
|
32
|
+
*/
|
|
19
33
|
private static mergeConfig;
|
|
20
34
|
}
|
|
21
35
|
/**
|
|
@@ -42,5 +56,13 @@ export declare function createLogger(config?: Partial<LoggerConfig>): ILogger;
|
|
|
42
56
|
* @returns A logger instance configured for the current environment
|
|
43
57
|
*/
|
|
44
58
|
export declare function createLoggerForEnvironment(): ILogger;
|
|
59
|
+
/**
|
|
60
|
+
* Convert a level string to a `LogLevel`, falling back to INFO.
|
|
61
|
+
*
|
|
62
|
+
* Delegates to the single parser in `utils/config.ts`; use `tryParseLogLevel`
|
|
63
|
+
* directly when an unrecognized value should be distinguishable from `info`.
|
|
64
|
+
* @param level - The value to convert
|
|
65
|
+
* @returns The matching level, or `LogLevel.INFO`
|
|
66
|
+
*/
|
|
45
67
|
export declare function stringToLogLevel(level: string): LogLevel;
|
|
46
68
|
export declare function logLevelToString(level: LogLevel): string;
|
package/dist/core/factory.d.ts
CHANGED
|
@@ -16,6 +16,20 @@ export declare class LoggerFactory {
|
|
|
16
16
|
* @returns A new logger instance with the additional metadata
|
|
17
17
|
*/
|
|
18
18
|
static createChild(parent: ILogger, metadata: Record<string, any>): ILogger;
|
|
19
|
+
/**
|
|
20
|
+
* Assemble the effective configuration.
|
|
21
|
+
*
|
|
22
|
+
* Precedence, lowest to highest:
|
|
23
|
+
*
|
|
24
|
+
* library defaults < explicit config < environment variables
|
|
25
|
+
*
|
|
26
|
+
* Environment variables win so that an operator can change logging on a
|
|
27
|
+
* running service without a deploy. A consumer that must not be overridden
|
|
28
|
+
* that way sets `ignoreEnvironment: true`.
|
|
29
|
+
*
|
|
30
|
+
* The config-file link of the chain documented in `docs/environment-variables.md`
|
|
31
|
+
* is still missing: `loadConfigFromFile` is async and this path is not.
|
|
32
|
+
*/
|
|
19
33
|
private static mergeConfig;
|
|
20
34
|
}
|
|
21
35
|
/**
|
|
@@ -42,5 +56,13 @@ export declare function createLogger(config?: Partial<LoggerConfig>): ILogger;
|
|
|
42
56
|
* @returns A logger instance configured for the current environment
|
|
43
57
|
*/
|
|
44
58
|
export declare function createLoggerForEnvironment(): ILogger;
|
|
59
|
+
/**
|
|
60
|
+
* Convert a level string to a `LogLevel`, falling back to INFO.
|
|
61
|
+
*
|
|
62
|
+
* Delegates to the single parser in `utils/config.ts`; use `tryParseLogLevel`
|
|
63
|
+
* directly when an unrecognized value should be distinguishable from `info`.
|
|
64
|
+
* @param level - The value to convert
|
|
65
|
+
* @returns The matching level, or `LogLevel.INFO`
|
|
66
|
+
*/
|
|
45
67
|
export declare function stringToLogLevel(level: string): LogLevel;
|
|
46
68
|
export declare function logLevelToString(level: LogLevel): string;
|
package/dist/core/types.d.cts
CHANGED
|
@@ -62,6 +62,15 @@ export interface LoggerConfig {
|
|
|
62
62
|
metadata: Record<string, any>;
|
|
63
63
|
/** Transport configurations for log output */
|
|
64
64
|
transports?: TransportConfig[];
|
|
65
|
+
/**
|
|
66
|
+
* Ignore `LOG_LEVEL`, `LOG_FORMAT`, `LOG_TIMESTAMP` and `LOG_COLOR`.
|
|
67
|
+
*
|
|
68
|
+
* Environment variables normally sit at the top of the precedence chain so an
|
|
69
|
+
* operator can raise verbosity on a running service without a deploy. A
|
|
70
|
+
* library that must pin its own logging regardless of the host application's
|
|
71
|
+
* environment sets this instead.
|
|
72
|
+
*/
|
|
73
|
+
ignoreEnvironment?: boolean;
|
|
65
74
|
}
|
|
66
75
|
/**
|
|
67
76
|
* Configuration for a specific log transport (output destination).
|