logan-logger 1.0.0 → 1.0.2
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/__vite-browser-external-BcPniuRQ.js +0 -1
- package/dist/__vite-browser-external-DYxpcVy9.mjs +0 -1
- package/dist/index.d.ts +44 -1
- package/dist/index.esm.js +100 -75
- package/dist/index.js +1 -2
- package/package.json +13 -18
- package/dist/__vite-browser-external-BcPniuRQ.js.map +0 -1
- package/dist/__vite-browser-external-DYxpcVy9.mjs.map +0 -1
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare abstract class BaseLogger implements ILogger {
|
|
|
3
3
|
protected config: Partial<LoggerConfig>;
|
|
4
4
|
protected runtime: RuntimeName;
|
|
5
5
|
protected childMetadata: Record<string, any>;
|
|
6
|
-
constructor(config?: Partial<LoggerConfig>);
|
|
6
|
+
protected constructor(config?: Partial<LoggerConfig>);
|
|
7
7
|
debug(message: LogMessage, metadata?: any): void;
|
|
8
8
|
info(message: LogMessage, metadata?: any): void;
|
|
9
9
|
warn(message: LogMessage, metadata?: any): void;
|
|
@@ -32,6 +32,8 @@ export declare class ConsoleGroupLogger extends BrowserLogger {
|
|
|
32
32
|
group(label: string): void;
|
|
33
33
|
groupCollapsed(label: string): void;
|
|
34
34
|
groupEnd(): void;
|
|
35
|
+
getCurrentGroupStack(): string[];
|
|
36
|
+
getCurrentGroupPath(): string;
|
|
35
37
|
time(label: string): void;
|
|
36
38
|
timeEnd(label: string): void;
|
|
37
39
|
trace(message: string, metadata?: any): void;
|
|
@@ -95,6 +97,36 @@ export declare function detectRuntime(): RuntimeInfo;
|
|
|
95
97
|
*/
|
|
96
98
|
export declare function filterSensitiveData(obj: any, sensitiveKeys?: string[]): any;
|
|
97
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Format log level as a colored string for terminal output.
|
|
102
|
+
* @param level - The log level to format
|
|
103
|
+
* @param colorize - Whether to apply ANSI color codes
|
|
104
|
+
* @returns Formatted level string with optional colors
|
|
105
|
+
*/
|
|
106
|
+
export declare function formatLevel(level: LogLevel, colorize?: boolean): string;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Format a log entry for output in different formats.
|
|
110
|
+
* @param entry - The log entry to format
|
|
111
|
+
* @param format - Output format ('json' or 'text')
|
|
112
|
+
* @returns Formatted log string
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* const entry: LogEntry = {
|
|
116
|
+
* timestamp: new Date(),
|
|
117
|
+
* level: LogLevel.INFO,
|
|
118
|
+
* message: 'User logged in',
|
|
119
|
+
* metadata: { userId: 123 },
|
|
120
|
+
* runtime: 'node'
|
|
121
|
+
* };
|
|
122
|
+
*
|
|
123
|
+
* const textFormat = formatLogEntry(entry, 'text');
|
|
124
|
+
* // Result: "[2024-01-01T12:00:00.000Z] INFO: User logged in {\"userId\":123}"
|
|
125
|
+
*
|
|
126
|
+
* const jsonFormat = formatLogEntry(entry, 'json');
|
|
127
|
+
* // Result: {"timestamp":"2024-01-01T12:00:00.000Z","level":"info","message":"User logged in","metadata":{"userId":123},"runtime":"node"}
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
98
130
|
export declare function formatLogEntry(entry: LogEntry, format?: 'json' | 'text'): string;
|
|
99
131
|
|
|
100
132
|
export declare function getDefaultConfig(): LoggerConfig;
|
|
@@ -357,6 +389,17 @@ export declare type RuntimeName = 'node' | 'deno' | 'bun' | 'browser' | 'webwork
|
|
|
357
389
|
*/
|
|
358
390
|
export declare function safeStringify(obj: any, space?: number): string;
|
|
359
391
|
|
|
392
|
+
/**
|
|
393
|
+
* Serialize Error objects to plain objects for logging.
|
|
394
|
+
* @param error - The error to serialize
|
|
395
|
+
* @returns Serialized error object or original value if not an Error
|
|
396
|
+
* @example
|
|
397
|
+
* ```typescript
|
|
398
|
+
* const error = new Error('Something went wrong');
|
|
399
|
+
* const serialized = serializeError(error);
|
|
400
|
+
* // Result: { name: 'Error', message: 'Something went wrong', stack: '...' }
|
|
401
|
+
* ```
|
|
402
|
+
*/
|
|
360
403
|
export declare function serializeError(error: any): any;
|
|
361
404
|
|
|
362
405
|
export declare function stringToLogLevel(level: string): LogLevel;
|
package/dist/index.esm.js
CHANGED
|
@@ -74,41 +74,15 @@ function b(t) {
|
|
|
74
74
|
function T() {
|
|
75
75
|
return u() === "node";
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function B() {
|
|
78
78
|
return u() === "browser";
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function D() {
|
|
81
81
|
return u() === "deno";
|
|
82
82
|
}
|
|
83
83
|
function $() {
|
|
84
84
|
return u() === "bun";
|
|
85
85
|
}
|
|
86
|
-
function f(t, e) {
|
|
87
|
-
const r = /* @__PURE__ */ new WeakSet();
|
|
88
|
-
return JSON.stringify(t, (s, o) => {
|
|
89
|
-
if (typeof o == "object" && o !== null) {
|
|
90
|
-
if (r.has(o))
|
|
91
|
-
return "[Circular]";
|
|
92
|
-
r.add(o);
|
|
93
|
-
}
|
|
94
|
-
return o instanceof Error ? {
|
|
95
|
-
name: o.name,
|
|
96
|
-
message: o.message,
|
|
97
|
-
stack: o.stack,
|
|
98
|
-
...Object.getOwnPropertyNames(o).reduce((a, i) => (i !== "name" && i !== "message" && i !== "stack" && (a[i] = o[i]), a), {})
|
|
99
|
-
} : typeof o == "function" ? `[Function: ${o.name || "anonymous"}]` : o === void 0 ? "[undefined]" : typeof o == "bigint" ? `[BigInt: ${o.toString()}]` : typeof o == "symbol" ? `[Symbol: ${o.toString()}]` : o;
|
|
100
|
-
}, e);
|
|
101
|
-
}
|
|
102
|
-
function N(t, e = ["password", "token", "secret", "key", "auth"]) {
|
|
103
|
-
if (typeof t != "object" || t === null)
|
|
104
|
-
return t;
|
|
105
|
-
const r = Array.isArray(t) ? [] : {};
|
|
106
|
-
for (const [s, o] of Object.entries(t))
|
|
107
|
-
e.some(
|
|
108
|
-
(i) => s.toLowerCase().includes(i.toLowerCase())
|
|
109
|
-
) ? r[s] = "[REDACTED]" : typeof o == "object" && o !== null ? r[s] = N(o, e) : r[s] = o;
|
|
110
|
-
return r;
|
|
111
|
-
}
|
|
112
86
|
class p {
|
|
113
87
|
constructor(e = {}) {
|
|
114
88
|
this.childMetadata = {}, this.config = e, this.level = e.level ?? n.INFO, this.runtime = d().name;
|
|
@@ -151,7 +125,33 @@ class p {
|
|
|
151
125
|
return e >= this.level;
|
|
152
126
|
}
|
|
153
127
|
}
|
|
154
|
-
function
|
|
128
|
+
function f(t, e) {
|
|
129
|
+
const r = /* @__PURE__ */ new WeakSet();
|
|
130
|
+
return JSON.stringify(t, (s, o) => {
|
|
131
|
+
if (typeof o == "object" && o !== null) {
|
|
132
|
+
if (r.has(o))
|
|
133
|
+
return "[Circular]";
|
|
134
|
+
r.add(o);
|
|
135
|
+
}
|
|
136
|
+
return o instanceof Error ? {
|
|
137
|
+
name: o.name,
|
|
138
|
+
message: o.message,
|
|
139
|
+
stack: o.stack,
|
|
140
|
+
...Object.getOwnPropertyNames(o).reduce((a, i) => (i !== "name" && i !== "message" && i !== "stack" && (a[i] = o[i]), a), {})
|
|
141
|
+
} : typeof o == "function" ? `[Function: ${o.name || "anonymous"}]` : o === void 0 ? "[undefined]" : typeof o == "bigint" ? `[BigInt: ${o.toString()}]` : typeof o == "symbol" ? `[Symbol: ${o.toString()}]` : o;
|
|
142
|
+
}, e);
|
|
143
|
+
}
|
|
144
|
+
function N(t, e = ["password", "token", "secret", "key", "auth"]) {
|
|
145
|
+
if (typeof t != "object" || t === null)
|
|
146
|
+
return t;
|
|
147
|
+
const r = Array.isArray(t) ? [] : {};
|
|
148
|
+
for (const [s, o] of Object.entries(t))
|
|
149
|
+
e.some(
|
|
150
|
+
(i) => s.toLowerCase().includes(i.toLowerCase())
|
|
151
|
+
) ? r[s] = "[REDACTED]" : typeof o == "object" && o !== null ? r[s] = N(o, e) : r[s] = o;
|
|
152
|
+
return r;
|
|
153
|
+
}
|
|
154
|
+
function M(t) {
|
|
155
155
|
return t instanceof Error ? {
|
|
156
156
|
name: t.name,
|
|
157
157
|
message: t.message,
|
|
@@ -160,18 +160,6 @@ function W(t) {
|
|
|
160
160
|
// Include any additional properties
|
|
161
161
|
} : t;
|
|
162
162
|
}
|
|
163
|
-
function A(t, e = "text") {
|
|
164
|
-
if (e === "json")
|
|
165
|
-
return f({
|
|
166
|
-
timestamp: t.timestamp.toISOString(),
|
|
167
|
-
level: n[t.level].toLowerCase(),
|
|
168
|
-
message: t.message,
|
|
169
|
-
metadata: t.metadata,
|
|
170
|
-
runtime: t.runtime
|
|
171
|
-
});
|
|
172
|
-
const r = t.timestamp.toISOString(), s = n[t.level].toUpperCase(), o = t.metadata ? ` ${f(t.metadata)}` : "";
|
|
173
|
-
return `[${r}] ${s}: ${t.message}${o}`;
|
|
174
|
-
}
|
|
175
163
|
class m extends p {
|
|
176
164
|
constructor(e = {}) {
|
|
177
165
|
super(e), this.initializeWinston();
|
|
@@ -269,7 +257,7 @@ class m extends p {
|
|
|
269
257
|
super.setLevel(e), this.winston && (this.winston.level = this.getWinstonLevel(e));
|
|
270
258
|
}
|
|
271
259
|
}
|
|
272
|
-
function
|
|
260
|
+
function W(t) {
|
|
273
261
|
return {
|
|
274
262
|
write: (e) => {
|
|
275
263
|
t.info(e.trim());
|
|
@@ -340,6 +328,12 @@ class G extends c {
|
|
|
340
328
|
groupEnd() {
|
|
341
329
|
console.groupEnd(), this.groupStack.pop();
|
|
342
330
|
}
|
|
331
|
+
getCurrentGroupStack() {
|
|
332
|
+
return [...this.groupStack];
|
|
333
|
+
}
|
|
334
|
+
getCurrentGroupPath() {
|
|
335
|
+
return this.groupStack.join(" > ");
|
|
336
|
+
}
|
|
343
337
|
time(e) {
|
|
344
338
|
console.time(e);
|
|
345
339
|
}
|
|
@@ -359,7 +353,7 @@ class G extends c {
|
|
|
359
353
|
console.table(e);
|
|
360
354
|
}
|
|
361
355
|
}
|
|
362
|
-
class
|
|
356
|
+
class A extends c {
|
|
363
357
|
mark(e) {
|
|
364
358
|
typeof performance < "u" && performance.mark && performance.mark(e);
|
|
365
359
|
}
|
|
@@ -402,7 +396,7 @@ function h() {
|
|
|
402
396
|
]
|
|
403
397
|
};
|
|
404
398
|
}
|
|
405
|
-
function
|
|
399
|
+
function _() {
|
|
406
400
|
const t = {};
|
|
407
401
|
if (typeof process < "u" && process.env) {
|
|
408
402
|
const e = process.env;
|
|
@@ -410,14 +404,14 @@ function j() {
|
|
|
410
404
|
}
|
|
411
405
|
return t;
|
|
412
406
|
}
|
|
413
|
-
async function
|
|
407
|
+
async function x(t) {
|
|
414
408
|
const e = d();
|
|
415
409
|
if (!e.capabilities.fileSystem)
|
|
416
410
|
return {};
|
|
417
411
|
const r = t ? [t] : [
|
|
418
412
|
"logan.config.json",
|
|
419
413
|
"logan.config.js",
|
|
420
|
-
".loganrc
|
|
414
|
+
".loganrc",
|
|
421
415
|
"package.json"
|
|
422
416
|
// Check for logan config in package.json
|
|
423
417
|
];
|
|
@@ -426,9 +420,9 @@ async function U(t) {
|
|
|
426
420
|
if (e.name === "node")
|
|
427
421
|
return await w(s);
|
|
428
422
|
if (e.name === "deno")
|
|
429
|
-
return await v(s);
|
|
430
|
-
if (e.name === "bun")
|
|
431
423
|
return await S(s);
|
|
424
|
+
if (e.name === "bun")
|
|
425
|
+
return await v(s);
|
|
432
426
|
} catch {
|
|
433
427
|
}
|
|
434
428
|
return {};
|
|
@@ -449,7 +443,7 @@ async function w(t) {
|
|
|
449
443
|
}
|
|
450
444
|
return {};
|
|
451
445
|
}
|
|
452
|
-
async function
|
|
446
|
+
async function S(t) {
|
|
453
447
|
try {
|
|
454
448
|
if (t.endsWith(".json")) {
|
|
455
449
|
const e = await globalThis.Deno.readTextFile(t), r = JSON.parse(e);
|
|
@@ -465,7 +459,7 @@ async function v(t) {
|
|
|
465
459
|
}
|
|
466
460
|
return {};
|
|
467
461
|
}
|
|
468
|
-
async function
|
|
462
|
+
async function v(t) {
|
|
469
463
|
return w(t);
|
|
470
464
|
}
|
|
471
465
|
function L(t) {
|
|
@@ -486,7 +480,7 @@ function L(t) {
|
|
|
486
480
|
return n.INFO;
|
|
487
481
|
}
|
|
488
482
|
}
|
|
489
|
-
function
|
|
483
|
+
function j(...t) {
|
|
490
484
|
const e = h();
|
|
491
485
|
return t.reduce((r, s) => ({
|
|
492
486
|
...r,
|
|
@@ -498,7 +492,7 @@ function P(...t) {
|
|
|
498
492
|
transports: s.transports || r.transports
|
|
499
493
|
}), e);
|
|
500
494
|
}
|
|
501
|
-
class
|
|
495
|
+
class C {
|
|
502
496
|
/**
|
|
503
497
|
* Create a logger instance appropriate for the current runtime.
|
|
504
498
|
* @param config - Optional configuration for the logger
|
|
@@ -541,17 +535,17 @@ class y {
|
|
|
541
535
|
};
|
|
542
536
|
}
|
|
543
537
|
}
|
|
544
|
-
function
|
|
545
|
-
return
|
|
538
|
+
function k(t) {
|
|
539
|
+
return C.create(t);
|
|
546
540
|
}
|
|
547
|
-
function
|
|
541
|
+
function y() {
|
|
548
542
|
const t = I(), e = {
|
|
549
543
|
level: F(t),
|
|
550
544
|
colorize: t !== "production",
|
|
551
545
|
timestamp: !0,
|
|
552
546
|
format: t === "production" ? "json" : "text"
|
|
553
547
|
};
|
|
554
|
-
return
|
|
548
|
+
return k(e);
|
|
555
549
|
}
|
|
556
550
|
function I() {
|
|
557
551
|
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";
|
|
@@ -570,7 +564,7 @@ function F(t) {
|
|
|
570
564
|
return n.INFO;
|
|
571
565
|
}
|
|
572
566
|
}
|
|
573
|
-
function
|
|
567
|
+
function U(t) {
|
|
574
568
|
switch (t.toLowerCase()) {
|
|
575
569
|
case "debug":
|
|
576
570
|
return n.DEBUG;
|
|
@@ -588,7 +582,7 @@ function x(t) {
|
|
|
588
582
|
return n.INFO;
|
|
589
583
|
}
|
|
590
584
|
}
|
|
591
|
-
function
|
|
585
|
+
function P(t) {
|
|
592
586
|
switch (t) {
|
|
593
587
|
case n.DEBUG:
|
|
594
588
|
return "debug";
|
|
@@ -604,7 +598,38 @@ function V(t) {
|
|
|
604
598
|
return "info";
|
|
605
599
|
}
|
|
606
600
|
}
|
|
607
|
-
|
|
601
|
+
function V(t, e = "text") {
|
|
602
|
+
if (e === "json") {
|
|
603
|
+
const a = {
|
|
604
|
+
timestamp: t.timestamp.toISOString(),
|
|
605
|
+
level: n[t.level].toLowerCase(),
|
|
606
|
+
message: t.message,
|
|
607
|
+
runtime: t.runtime
|
|
608
|
+
};
|
|
609
|
+
return t.metadata !== void 0 && (a.metadata = t.metadata), f(a);
|
|
610
|
+
}
|
|
611
|
+
const r = t.timestamp.toISOString(), s = n[t.level].toUpperCase(), o = t.metadata ? ` ${f(t.metadata)}` : "";
|
|
612
|
+
return `[${r}] ${s}: ${t.message}${o}`;
|
|
613
|
+
}
|
|
614
|
+
function z(t, e = !1) {
|
|
615
|
+
const r = n[t].toUpperCase();
|
|
616
|
+
if (!e)
|
|
617
|
+
return r;
|
|
618
|
+
const s = {
|
|
619
|
+
[n.DEBUG]: "\x1B[36m",
|
|
620
|
+
// Cyan
|
|
621
|
+
[n.INFO]: "\x1B[32m",
|
|
622
|
+
// Green
|
|
623
|
+
[n.WARN]: "\x1B[33m",
|
|
624
|
+
// Yellow
|
|
625
|
+
[n.ERROR]: "\x1B[31m",
|
|
626
|
+
// Red
|
|
627
|
+
[n.SILENT]: "\x1B[37m"
|
|
628
|
+
// White
|
|
629
|
+
};
|
|
630
|
+
return `${s[t] || s[n.INFO]}${r}\x1B[0m`;
|
|
631
|
+
}
|
|
632
|
+
const l = y(), H = {
|
|
608
633
|
debug: (t, e) => l.debug(t, e),
|
|
609
634
|
info: (t, e) => l.info(t, e),
|
|
610
635
|
warn: (t, e) => l.warn(t, e),
|
|
@@ -615,28 +640,28 @@ export {
|
|
|
615
640
|
c as BrowserLogger,
|
|
616
641
|
G as ConsoleGroupLogger,
|
|
617
642
|
n as LogLevel,
|
|
618
|
-
|
|
643
|
+
C as LoggerFactory,
|
|
619
644
|
m as NodeLogger,
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
645
|
+
A as PerformanceLogger,
|
|
646
|
+
k as createLogger,
|
|
647
|
+
y as createLoggerForEnvironment,
|
|
648
|
+
W as createMorganStream,
|
|
624
649
|
d as detectRuntime,
|
|
625
650
|
N as filterSensitiveData,
|
|
626
|
-
|
|
651
|
+
z as formatLevel,
|
|
652
|
+
V as formatLogEntry,
|
|
627
653
|
h as getDefaultConfig,
|
|
628
|
-
|
|
654
|
+
B as isBrowser,
|
|
629
655
|
$ as isBun,
|
|
630
|
-
|
|
656
|
+
D as isDeno,
|
|
631
657
|
T as isNode,
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
658
|
+
_ as loadConfigFromEnvironment,
|
|
659
|
+
x as loadConfigFromFile,
|
|
660
|
+
H as log,
|
|
661
|
+
P as logLevelToString,
|
|
636
662
|
l as logger,
|
|
637
|
-
|
|
663
|
+
j as mergeConfigs,
|
|
638
664
|
f as safeStringify,
|
|
639
|
-
|
|
640
|
-
|
|
665
|
+
M as serializeError,
|
|
666
|
+
U as stringToLogLevel
|
|
641
667
|
};
|
|
642
|
-
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";var S=Object.create;var w=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var I=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of C(e))!k.call(t,o)&&o!==r&&w(t,o,{get:()=>e[o],enumerable:!(s=y(e,o))||s.enumerable});return t};var T=(t,e,r)=>(r=t!=null?S(F(t)):{},I(e||!t||!t.__esModule?w(r,"default",{value:t,enumerable:!0}):r,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var n=(t=>(t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR",t[t.SILENT=4]="SILENT",t))(n||{});function m(){const t=g(),e=D(t),r=M(t);return{name:t,version:e,capabilities:r}}function g(){return typeof globalThis.Deno<"u"?"deno":typeof globalThis.Bun<"u"?"bun":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"}function D(t){switch(t){case"node":return typeof process<"u"?process.version:void 0;case"deno":return typeof globalThis.Deno<"u"?globalThis.Deno.version?.deno:void 0;case"bun":return typeof globalThis.Bun<"u"?globalThis.Bun.version:void 0;case"browser":return typeof navigator<"u"?navigator.userAgent:void 0;default:return}}function M(t){switch(t){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 B(){return g()==="node"}function $(){return g()==="browser"}function W(){return g()==="deno"}function A(){return g()==="bun"}function l(t,e){const r=new WeakSet;return JSON.stringify(t,(s,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular]";r.add(o)}return o instanceof Error?{name:o.name,message:o.message,stack:o.stack,...Object.getOwnPropertyNames(o).reduce((a,i)=>(i!=="name"&&i!=="message"&&i!=="stack"&&(a[i]=o[i]),a),{})}:typeof o=="function"?`[Function: ${o.name||"anonymous"}]`:o===void 0?"[undefined]":typeof o=="bigint"?`[BigInt: ${o.toString()}]`:typeof o=="symbol"?`[Symbol: ${o.toString()}]`:o},e)}function E(t,e=["password","token","secret","key","auth"]){if(typeof t!="object"||t===null)return t;const r=Array.isArray(t)?[]:{};for(const[s,o]of Object.entries(t))e.some(i=>s.toLowerCase().includes(i.toLowerCase()))?r[s]="[REDACTED]":typeof o=="object"&&o!==null?r[s]=E(o,e):r[s]=o;return r}class d{constructor(e={}){this.childMetadata={},this.config=e,this.level=e.level??n.INFO,this.runtime=m().name}debug(e,r){this.log(n.DEBUG,e,r)}info(e,r){this.log(n.INFO,e,r)}warn(e,r){this.log(n.WARN,e,r)}error(e,r){this.log(n.ERROR,e,r)}log(e,r,s){if(!this.shouldLog(e))return;const o=typeof r=="function"?r():r,a={...this.childMetadata,...s},i={timestamp:new Date,level:e,message:o,metadata:Object.keys(a).length>0?a:void 0,runtime:this.runtime};this.writeLog(i)}setLevel(e){this.level=e}getLevel(){return this.level}child(e){const r=this.createChild();return r.childMetadata={...this.childMetadata,...e},r}shouldLog(e){return e>=this.level}}function G(t){return t instanceof Error?{name:t.name,message:t.message,stack:t.stack,...t}:t}function _(t,e="text"){if(e==="json")return l({timestamp:t.timestamp.toISOString(),level:n[t.level].toLowerCase(),message:t.message,metadata:t.metadata,runtime:t.runtime});const r=t.timestamp.toISOString(),s=n[t.level].toUpperCase(),o=t.metadata?` ${l(t.metadata)}`:"";return`[${r}] ${s}: ${t.message}${o}`}class f extends d{constructor(e={}){super(e),this.initializeWinston()}async initializeWinston(){try{const e=await import("winston");this.winston=this.createWinstonLogger(e)}catch{console.warn("[logan-logger] Winston not found, falling back to console logging")}}createWinstonLogger(e){const r=e.format.combine(e.format.timestamp({format:"YYYY-MM-DD HH:mm:ss"}),e.format.errors({stack:!0}),e.format.json(),e.format.prettyPrint()),s=e.format.combine(e.format.colorize(),e.format.timestamp({format:"HH:mm:ss"}),e.format.printf(({timestamp:a,level:i,message:L,...h})=>{const N=Object.keys(h).length?JSON.stringify(h,null,2):"";return`${a} [${i}]: ${L} ${N}`})),o=e.createLogger({level:this.getWinstonLevel(this.level),format:r,transports:[new e.transports.Console({format:process.env.NODE_ENV==="production"?r:s})]});return process.env.NODE_ENV==="production"&&(o.add(new e.transports.File({filename:"logs/error.log",level:"error",maxsize:5242880,maxFiles:5})),o.add(new e.transports.File({filename:"logs/combined.log",maxsize:5242880,maxFiles:10}))),o}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 f(this.config)}writeToConsole(e){const r=e.timestamp.toISOString(),s=n[e.level].toLowerCase(),o=e.metadata?` ${l(e.metadata)}`:"",a=`[${r}] ${s.toUpperCase()}: ${e.message}${o}`;switch(e.level){case n.DEBUG:console.debug(a);break;case n.INFO:console.info(a);break;case n.WARN:console.warn(a);break;case n.ERROR:console.error(a);break}}getWinstonLevel(e){switch(e){case n.DEBUG:return"debug";case n.INFO:return"info";case n.WARN:return"warn";case n.ERROR:return"error";default:return"info"}}setLevel(e){super.setLevel(e),this.winston&&(this.winston.level=this.getWinstonLevel(e))}}function P(t){return{write:e=>{t.info(e.trim())}}}class c extends d{constructor(e={}){super(e)}writeLog(e){const r=this.formatMessage(e),s=this.getConsoleStyle(e.level),o=e.metadata?` ${l(e.metadata)}`:"",a=`%c${r}${o}`;switch(e.level){case n.DEBUG:console.debug?console.debug(a,s):console.log(a,s);break;case n.INFO:console.info(a,s);break;case n.WARN:console.warn(a,s);break;case n.ERROR:console.error(a,s);break}}createChild(){return new c(this.config)}formatMessage(e){const r=e.timestamp.toISOString(),s=n[e.level].toUpperCase();return`[${r}] ${s}: ${e.message}`}getConsoleStyle(e){if(!this.config.colorize)return"";switch(e){case n.DEBUG:return"color: #888; font-weight: normal;";case n.INFO:return"color: #007acc; font-weight: normal;";case n.WARN:return"color: #ff8c00; font-weight: bold;";case n.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<=n.ERROR}shouldLog(e){return!this.shouldLogInProduction()&&e<n.ERROR?!1:super.shouldLog(e)}}class j extends c{constructor(){super(...arguments),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()}time(e){console.time(e)}timeEnd(e){console.timeEnd(e)}trace(e,r){console.trace(e,r)}count(e){console.count(e)}countReset(e){console.countReset(e)}table(e){console.table(e)}}class U extends c{mark(e){typeof performance<"u"&&performance.mark&&performance.mark(e)}measure(e,r,s){if(typeof performance<"u"&&performance.measure)try{performance.measure(e,r,s);const o=performance.getEntriesByName(e,"measure");if(o.length>0){const a=o[o.length-1];this.info(`Performance: ${e}`,{duration:a.duration,startTime:a.startTime})}}catch(o){this.warn("Failed to measure performance",{name:e,error:o})}}clearMarks(e){typeof performance<"u"&&performance.clearMarks&&performance.clearMarks(e)}clearMeasures(e){typeof performance<"u"&&performance.clearMeasures&&performance.clearMeasures(e)}}function p(){const t=m();return{level:n.INFO,format:"text",timestamp:!0,colorize:t.capabilities.colorSupport,metadata:{},transports:[{type:"console",options:{}}]}}function x(){const t={};if(typeof process<"u"&&process.env){const e=process.env;e.LOG_LEVEL&&(t.level=H(e.LOG_LEVEL)),e.LOG_FORMAT&&["json","text"].includes(e.LOG_FORMAT)&&(t.format=e.LOG_FORMAT),e.LOG_TIMESTAMP&&(t.timestamp=e.LOG_TIMESTAMP.toLowerCase()==="true"),e.LOG_COLOR&&(t.colorize=e.LOG_COLOR.toLowerCase()==="true")}return t}async function z(t){const e=m();if(!e.capabilities.fileSystem)return{};const r=t?[t]:["logan.config.json","logan.config.js",".loganrc.json","package.json"];for(const s of r)try{if(e.name==="node")return await R(s);if(e.name==="deno")return await V(s);if(e.name==="bun")return await q(s)}catch{}return{}}async function R(t){try{const e=await Promise.resolve().then(()=>require("./__vite-browser-external-BcPniuRQ.js")),r=await Promise.resolve().then(()=>require("./__vite-browser-external-BcPniuRQ.js"));if(t.endsWith(".json")){const s=await e.readFile(t,"utf-8"),o=JSON.parse(s);return t==="package.json"?o.logan||{}:o}else if(t.endsWith(".js")){const s=r.resolve(t);delete require.cache[s];const o=require(s);return o.default||o}}catch{}return{}}async function V(t){try{if(t.endsWith(".json")){const e=await globalThis.Deno.readTextFile(t),r=JSON.parse(e);return t==="package.json"?r.logan||{}:r}else if(t.endsWith(".js")){const e=await import(`./${t}`);return e.default||e}}catch{}return{}}async function q(t){return R(t)}function H(t){switch(t.toLowerCase()){case"debug":return n.DEBUG;case"info":return n.INFO;case"warn":case"warning":return n.WARN;case"error":return n.ERROR;case"silent":case"none":return n.SILENT;default:return n.INFO}}function J(...t){const e=p();return t.reduce((r,s)=>({...r,...s,metadata:{...r.metadata,...s.metadata},transports:s.transports||r.transports}),e)}class b{static create(e={}){const r=m(),s=this.mergeConfig(e);switch(r.name){case"node":return new f(s);case"deno":return new c(s);case"bun":return new f(s);case"browser":case"webworker":return new c(s);default:return new c(s)}}static createChild(e,r){return e.child(r)}static mergeConfig(e){const r=p();return{...r,...e,metadata:{...r.metadata,...e.metadata}}}}function O(t){return b.create(t)}function v(){const t=Y(),e={level:X(t),colorize:t!=="production",timestamp:!0,format:t==="production"?"json":"text"};return O(e)}function Y(){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 X(t){switch(t){case"production":return n.ERROR;case"staging":case"test":return n.WARN;case"development":case"dev":return n.DEBUG;default:return n.INFO}}function Q(t){switch(t.toLowerCase()){case"debug":return n.DEBUG;case"info":return n.INFO;case"warn":case"warning":return n.WARN;case"error":return n.ERROR;case"silent":case"none":return n.SILENT;default:return n.INFO}}function Z(t){switch(t){case n.DEBUG:return"debug";case n.INFO:return"info";case n.WARN:return"warn";case n.ERROR:return"error";case n.SILENT:return"silent";default:return"info"}}const u=v(),K={debug:(t,e)=>u.debug(t,e),info:(t,e)=>u.info(t,e),warn:(t,e)=>u.warn(t,e),error:(t,e)=>u.error(t,e)};exports.BaseLogger=d;exports.BrowserLogger=c;exports.ConsoleGroupLogger=j;exports.LogLevel=n;exports.LoggerFactory=b;exports.NodeLogger=f;exports.PerformanceLogger=U;exports.createLogger=O;exports.createLoggerForEnvironment=v;exports.createMorganStream=P;exports.detectRuntime=m;exports.filterSensitiveData=E;exports.formatLogEntry=_;exports.getDefaultConfig=p;exports.isBrowser=$;exports.isBun=A;exports.isDeno=W;exports.isNode=B;exports.loadConfigFromEnvironment=x;exports.loadConfigFromFile=z;exports.log=K;exports.logLevelToString=Z;exports.logger=u;exports.mergeConfigs=J;exports.safeStringify=l;exports.serializeError=G;exports.stringToLogLevel=Q;
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";var S=Object.create;var w=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var I=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of y(e))!k.call(t,n)&&n!==r&&w(t,n,{get:()=>e[n],enumerable:!(s=C(e,n))||s.enumerable});return t};var T=(t,e,r)=>(r=t!=null?S(F(t)):{},I(e||!t||!t.__esModule?w(r,"default",{value:t,enumerable:!0}):r,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var o=(t=>(t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR",t[t.SILENT=4]="SILENT",t))(o||{});function m(){const t=g(),e=B(t),r=D(t);return{name:t,version:e,capabilities:r}}function g(){return typeof globalThis.Deno<"u"?"deno":typeof globalThis.Bun<"u"?"bun":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"}function B(t){switch(t){case"node":return typeof process<"u"?process.version:void 0;case"deno":return typeof globalThis.Deno<"u"?globalThis.Deno.version?.deno:void 0;case"bun":return typeof globalThis.Bun<"u"?globalThis.Bun.version:void 0;case"browser":return typeof navigator<"u"?navigator.userAgent:void 0;default:return}}function D(t){switch(t){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 M(){return g()==="node"}function $(){return g()==="browser"}function W(){return g()==="deno"}function G(){return g()==="bun"}class d{constructor(e={}){this.childMetadata={},this.config=e,this.level=e.level??o.INFO,this.runtime=m().name}debug(e,r){this.log(o.DEBUG,e,r)}info(e,r){this.log(o.INFO,e,r)}warn(e,r){this.log(o.WARN,e,r)}error(e,r){this.log(o.ERROR,e,r)}log(e,r,s){if(!this.shouldLog(e))return;const n=typeof r=="function"?r():r,a={...this.childMetadata,...s},i={timestamp:new Date,level:e,message:n,metadata:Object.keys(a).length>0?a:void 0,runtime:this.runtime};this.writeLog(i)}setLevel(e){this.level=e}getLevel(){return this.level}child(e){const r=this.createChild();return r.childMetadata={...this.childMetadata,...e},r}shouldLog(e){return e>=this.level}}function l(t,e){const r=new WeakSet;return JSON.stringify(t,(s,n)=>{if(typeof n=="object"&&n!==null){if(r.has(n))return"[Circular]";r.add(n)}return n instanceof Error?{name:n.name,message:n.message,stack:n.stack,...Object.getOwnPropertyNames(n).reduce((a,i)=>(i!=="name"&&i!=="message"&&i!=="stack"&&(a[i]=n[i]),a),{})}:typeof n=="function"?`[Function: ${n.name||"anonymous"}]`:n===void 0?"[undefined]":typeof n=="bigint"?`[BigInt: ${n.toString()}]`:typeof n=="symbol"?`[Symbol: ${n.toString()}]`:n},e)}function E(t,e=["password","token","secret","key","auth"]){if(typeof t!="object"||t===null)return t;const r=Array.isArray(t)?[]:{};for(const[s,n]of Object.entries(t))e.some(i=>s.toLowerCase().includes(i.toLowerCase()))?r[s]="[REDACTED]":typeof n=="object"&&n!==null?r[s]=E(n,e):r[s]=n;return r}function A(t){return t instanceof Error?{name:t.name,message:t.message,stack:t.stack,...t}:t}class f extends d{constructor(e={}){super(e),this.initializeWinston()}async initializeWinston(){try{const e=await import("winston");this.winston=this.createWinstonLogger(e)}catch{console.warn("[logan-logger] Winston not found, falling back to console logging")}}createWinstonLogger(e){const r=e.format.combine(e.format.timestamp({format:"YYYY-MM-DD HH:mm:ss"}),e.format.errors({stack:!0}),e.format.json(),e.format.prettyPrint()),s=e.format.combine(e.format.colorize(),e.format.timestamp({format:"HH:mm:ss"}),e.format.printf(({timestamp:a,level:i,message:b,...h})=>{const N=Object.keys(h).length?JSON.stringify(h,null,2):"";return`${a} [${i}]: ${b} ${N}`})),n=e.createLogger({level:this.getWinstonLevel(this.level),format:r,transports:[new e.transports.Console({format:process.env.NODE_ENV==="production"?r:s})]});return process.env.NODE_ENV==="production"&&(n.add(new e.transports.File({filename:"logs/error.log",level:"error",maxsize:5242880,maxFiles:5})),n.add(new e.transports.File({filename:"logs/combined.log",maxsize:5242880,maxFiles:10}))),n}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 f(this.config)}writeToConsole(e){const r=e.timestamp.toISOString(),s=o[e.level].toLowerCase(),n=e.metadata?` ${l(e.metadata)}`:"",a=`[${r}] ${s.toUpperCase()}: ${e.message}${n}`;switch(e.level){case o.DEBUG:console.debug(a);break;case o.INFO:console.info(a);break;case o.WARN:console.warn(a);break;case o.ERROR:console.error(a);break}}getWinstonLevel(e){switch(e){case o.DEBUG:return"debug";case o.INFO:return"info";case o.WARN:return"warn";case o.ERROR:return"error";default:return"info"}}setLevel(e){super.setLevel(e),this.winston&&(this.winston.level=this.getWinstonLevel(e))}}function _(t){return{write:e=>{t.info(e.trim())}}}class c extends d{constructor(e={}){super(e)}writeLog(e){const r=this.formatMessage(e),s=this.getConsoleStyle(e.level),n=e.metadata?` ${l(e.metadata)}`:"",a=`%c${r}${n}`;switch(e.level){case o.DEBUG:console.debug?console.debug(a,s):console.log(a,s);break;case o.INFO:console.info(a,s);break;case o.WARN:console.warn(a,s);break;case o.ERROR:console.error(a,s);break}}createChild(){return new c(this.config)}formatMessage(e){const r=e.timestamp.toISOString(),s=o[e.level].toUpperCase();return`[${r}] ${s}: ${e.message}`}getConsoleStyle(e){if(!this.config.colorize)return"";switch(e){case o.DEBUG:return"color: #888; font-weight: normal;";case o.INFO:return"color: #007acc; font-weight: normal;";case o.WARN:return"color: #ff8c00; font-weight: bold;";case o.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<=o.ERROR}shouldLog(e){return!this.shouldLogInProduction()&&e<o.ERROR?!1:super.shouldLog(e)}}class P extends c{constructor(){super(...arguments),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,r){console.trace(e,r)}count(e){console.count(e)}countReset(e){console.countReset(e)}table(e){console.table(e)}}class j extends c{mark(e){typeof performance<"u"&&performance.mark&&performance.mark(e)}measure(e,r,s){if(typeof performance<"u"&&performance.measure)try{performance.measure(e,r,s);const n=performance.getEntriesByName(e,"measure");if(n.length>0){const a=n[n.length-1];this.info(`Performance: ${e}`,{duration:a.duration,startTime:a.startTime})}}catch(n){this.warn("Failed to measure performance",{name:e,error:n})}}clearMarks(e){typeof performance<"u"&&performance.clearMarks&&performance.clearMarks(e)}clearMeasures(e){typeof performance<"u"&&performance.clearMeasures&&performance.clearMeasures(e)}}function p(){const t=m();return{level:o.INFO,format:"text",timestamp:!0,colorize:t.capabilities.colorSupport,metadata:{},transports:[{type:"console",options:{}}]}}function x(){const t={};if(typeof process<"u"&&process.env){const e=process.env;e.LOG_LEVEL&&(t.level=q(e.LOG_LEVEL)),e.LOG_FORMAT&&["json","text"].includes(e.LOG_FORMAT)&&(t.format=e.LOG_FORMAT),e.LOG_TIMESTAMP&&(t.timestamp=e.LOG_TIMESTAMP.toLowerCase()==="true"),e.LOG_COLOR&&(t.colorize=e.LOG_COLOR.toLowerCase()==="true")}return t}async function U(t){const e=m();if(!e.capabilities.fileSystem)return{};const r=t?[t]:["logan.config.json","logan.config.js",".loganrc","package.json"];for(const s of r)try{if(e.name==="node")return await R(s);if(e.name==="deno")return await z(s);if(e.name==="bun")return await V(s)}catch{}return{}}async function R(t){try{const e=await Promise.resolve().then(()=>require("./__vite-browser-external-BcPniuRQ.js")),r=await Promise.resolve().then(()=>require("./__vite-browser-external-BcPniuRQ.js"));if(t.endsWith(".json")){const s=await e.readFile(t,"utf-8"),n=JSON.parse(s);return t==="package.json"?n.logan||{}:n}else if(t.endsWith(".js")){const s=r.resolve(t);delete require.cache[s];const n=require(s);return n.default||n}}catch{}return{}}async function z(t){try{if(t.endsWith(".json")){const e=await globalThis.Deno.readTextFile(t),r=JSON.parse(e);return t==="package.json"?r.logan||{}:r}else if(t.endsWith(".js")){const e=await import(`./${t}`);return e.default||e}}catch{}return{}}async function V(t){return R(t)}function q(t){switch(t.toLowerCase()){case"debug":return o.DEBUG;case"info":return o.INFO;case"warn":case"warning":return o.WARN;case"error":return o.ERROR;case"silent":case"none":return o.SILENT;default:return o.INFO}}function H(...t){const e=p();return t.reduce((r,s)=>({...r,...s,metadata:{...r.metadata,...s.metadata},transports:s.transports||r.transports}),e)}class O{static create(e={}){const r=m(),s=this.mergeConfig(e);switch(r.name){case"node":return new f(s);case"deno":return new c(s);case"bun":return new f(s);case"browser":case"webworker":return new c(s);default:return new c(s)}}static createChild(e,r){return e.child(r)}static mergeConfig(e){const r=p();return{...r,...e,metadata:{...r.metadata,...e.metadata}}}}function v(t){return O.create(t)}function L(){const t=J(),e={level:Y(t),colorize:t!=="production",timestamp:!0,format:t==="production"?"json":"text"};return v(e)}function J(){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 Y(t){switch(t){case"production":return o.ERROR;case"staging":case"test":return o.WARN;case"development":case"dev":return o.DEBUG;default:return o.INFO}}function X(t){switch(t.toLowerCase()){case"debug":return o.DEBUG;case"info":return o.INFO;case"warn":case"warning":return o.WARN;case"error":return o.ERROR;case"silent":case"none":return o.SILENT;default:return o.INFO}}function Q(t){switch(t){case o.DEBUG:return"debug";case o.INFO:return"info";case o.WARN:return"warn";case o.ERROR:return"error";case o.SILENT:return"silent";default:return"info"}}function Z(t,e="text"){if(e==="json"){const a={timestamp:t.timestamp.toISOString(),level:o[t.level].toLowerCase(),message:t.message,runtime:t.runtime};return t.metadata!==void 0&&(a.metadata=t.metadata),l(a)}const r=t.timestamp.toISOString(),s=o[t.level].toUpperCase(),n=t.metadata?` ${l(t.metadata)}`:"";return`[${r}] ${s}: ${t.message}${n}`}function K(t,e=!1){const r=o[t].toUpperCase();if(!e)return r;const s={[o.DEBUG]:"\x1B[36m",[o.INFO]:"\x1B[32m",[o.WARN]:"\x1B[33m",[o.ERROR]:"\x1B[31m",[o.SILENT]:"\x1B[37m"};return`${s[t]||s[o.INFO]}${r}\x1B[0m`}const u=L(),ee={debug:(t,e)=>u.debug(t,e),info:(t,e)=>u.info(t,e),warn:(t,e)=>u.warn(t,e),error:(t,e)=>u.error(t,e)};exports.BaseLogger=d;exports.BrowserLogger=c;exports.ConsoleGroupLogger=P;exports.LogLevel=o;exports.LoggerFactory=O;exports.NodeLogger=f;exports.PerformanceLogger=j;exports.createLogger=v;exports.createLoggerForEnvironment=L;exports.createMorganStream=_;exports.detectRuntime=m;exports.filterSensitiveData=E;exports.formatLevel=K;exports.formatLogEntry=Z;exports.getDefaultConfig=p;exports.isBrowser=$;exports.isBun=G;exports.isDeno=W;exports.isNode=M;exports.loadConfigFromEnvironment=x;exports.loadConfigFromFile=U;exports.log=ee;exports.logLevelToString=Q;exports.logger=u;exports.mergeConfigs=H;exports.safeStringify=l;exports.serializeError=A;exports.stringToLogLevel=X;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "logan-logger",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Universal TypeScript logging library for all JavaScript runtimes",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -12,19 +12,6 @@
|
|
|
12
12
|
"require": "./dist/index.js"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "pnpm build:clean && pnpm build:lib",
|
|
17
|
-
"build:clean": "rm -rf dist",
|
|
18
|
-
"build:lib": "vite build",
|
|
19
|
-
"dev": "bun run src/index.ts",
|
|
20
|
-
"test": "vitest run --reporter=default",
|
|
21
|
-
"test:watch": "vitest",
|
|
22
|
-
"test:ui": "vitest --ui",
|
|
23
|
-
"test:coverage": "vitest run --coverage",
|
|
24
|
-
"lint": "eslint src --ext .ts",
|
|
25
|
-
"typecheck": "tsc --noEmit",
|
|
26
|
-
"publish:jsr": "deno publish"
|
|
27
|
-
},
|
|
28
15
|
"keywords": [
|
|
29
16
|
"logging",
|
|
30
17
|
"logger",
|
|
@@ -65,9 +52,17 @@
|
|
|
65
52
|
"README.md",
|
|
66
53
|
"LICENSE"
|
|
67
54
|
],
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "pnpm build:clean && pnpm build:lib",
|
|
57
|
+
"build:clean": "rm -rf dist",
|
|
58
|
+
"build:lib": "vite build",
|
|
59
|
+
"dev": "bun run src/index.ts",
|
|
60
|
+
"test": "vitest run --reporter=default",
|
|
61
|
+
"test:watch": "vitest",
|
|
62
|
+
"test:ui": "vitest --ui",
|
|
63
|
+
"test:coverage": "vitest run --coverage",
|
|
64
|
+
"lint": "eslint src --ext .ts",
|
|
65
|
+
"typecheck": "tsc --noEmit",
|
|
66
|
+
"publish:jsr": "deno publish --set-version ${npm_package_version:-$(npm pkg get version | tr -d '\"')}"
|
|
72
67
|
}
|
|
73
68
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"__vite-browser-external-BcPniuRQ.js","sources":["../__vite-browser-external"],"sourcesContent":["export default {}"],"names":["__viteBrowserExternal"],"mappings":"gFAAA,MAAAA,EAAe,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"__vite-browser-external-DYxpcVy9.mjs","sources":["../__vite-browser-external"],"sourcesContent":["export default {}"],"names":["__viteBrowserExternal"],"mappings":"AAAA,MAAAA,IAAe,CAAA;"}
|
package/dist/index.esm.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/core/types.ts","../src/utils/runtime.ts","../src/utils/serialization.ts","../src/core/logger.ts","../src/runtime/node.ts","../src/runtime/browser.ts","../src/utils/config.ts","../src/core/factory.ts","../src/index.ts"],"sourcesContent":["/**\n * Log levels in ascending order of severity.\n * Used to filter which messages should be logged.\n */\nexport enum LogLevel {\n /** Debug messages - most verbose */\n DEBUG = 0,\n /** Informational messages */\n INFO = 1,\n /** Warning messages */\n WARN = 2,\n /** Error messages */\n ERROR = 3,\n /** No messages - silent mode */\n SILENT = 4\n}\n\n/**\n * String representation of log levels.\n */\nexport type LogLevelString = 'debug' | 'info' | 'warn' | 'error' | 'silent';\n\n/**\n * Supported JavaScript runtime environments.\n */\nexport type RuntimeName = 'node' | 'deno' | 'bun' | 'browser' | 'webworker' | 'unknown';\n\n/**\n * Information about the detected JavaScript runtime environment.\n */\nexport interface RuntimeInfo {\n /** The name of the runtime */\n name: RuntimeName;\n /** Version string of the runtime (if available) */\n version?: string;\n /** Capabilities supported by this runtime */\n capabilities: RuntimeCapabilities;\n}\n\n/**\n * Capabilities that a runtime may or may not support.\n */\nexport interface RuntimeCapabilities {\n /** Whether the runtime supports file system operations */\n fileSystem: boolean;\n /** Whether the runtime supports colored console output */\n colorSupport: boolean;\n /** Whether the runtime provides process information */\n processInfo: boolean;\n /** Whether the runtime supports streams */\n streams: boolean;\n}\n\n/**\n * Configuration options for creating a logger instance.\n */\nexport interface LoggerConfig {\n /** Minimum log level to output */\n level: LogLevel;\n /** Output format for log messages */\n format: 'json' | 'text' | 'custom';\n /** Whether to include timestamps in log output */\n timestamp: boolean;\n /** Whether to colorize log output (if supported) */\n colorize: boolean;\n /** Default metadata to include with all log messages */\n metadata: Record<string, any>;\n /** Transport configurations for log output */\n transports?: TransportConfig[];\n}\n\n/**\n * Configuration for a specific log transport (output destination).\n */\nexport interface TransportConfig {\n /** Type of transport */\n type: 'console' | 'file' | 'http' | 'custom';\n /** Minimum log level for this transport */\n level?: LogLevel;\n /** Transport-specific options */\n options: Record<string, any>;\n}\n\n/**\n * A log message can be a string or a function that returns a string.\n * Functions enable lazy evaluation for expensive log message generation.\n */\nexport type LogMessage = string | (() => string);\n\n/**\n * Internal representation of a log entry.\n */\nexport interface LogEntry {\n /** When the log entry was created */\n timestamp: Date;\n /** Log level of this entry */\n level: LogLevel;\n /** The log message */\n message: string;\n /** Additional structured data */\n metadata?: Record<string, any>;\n /** Runtime that generated this log entry */\n runtime: RuntimeName;\n}\n\n/**\n * Main logger interface providing methods for logging at different levels.\n * This interface is implemented by all logger implementations across different runtimes.\n */\nexport interface ILogger {\n /**\n * Log a debug message. Only shown when log level is DEBUG.\n * @param message - The message to log (string or lazy function)\n * @param metadata - Optional structured data to include\n */\n debug(message: LogMessage, metadata?: any): void;\n \n /**\n * Log an informational message.\n * @param message - The message to log (string or lazy function)\n * @param metadata - Optional structured data to include\n */\n info(message: LogMessage, metadata?: any): void;\n \n /**\n * Log a warning message.\n * @param message - The message to log (string or lazy function)\n * @param metadata - Optional structured data to include\n */\n warn(message: LogMessage, metadata?: any): void;\n \n /**\n * Log an error message.\n * @param message - The message to log (string or lazy function)\n * @param metadata - Optional structured data to include\n */\n error(message: LogMessage, metadata?: any): void;\n \n /**\n * Log a message at a specific level.\n * @param level - The log level\n * @param message - The message to log (string or lazy function)\n * @param metadata - Optional structured data to include\n */\n log(level: LogLevel, message: LogMessage, metadata?: any): void;\n \n /**\n * Set the minimum log level for this logger.\n * @param level - The minimum log level\n */\n setLevel(level: LogLevel): void;\n \n /**\n * Get the current minimum log level.\n * @returns The current log level\n */\n getLevel(): LogLevel;\n \n /**\n * Create a child logger with additional metadata.\n * @param metadata - Additional metadata to include in all child log messages\n * @returns A new logger instance with the additional metadata\n */\n child(metadata: Record<string, any>): ILogger;\n}\n\n/**\n * Interface for logger adapters that handle the actual log output.\n * This abstraction allows different implementations for different runtimes.\n */\nexport interface ILoggerAdapter {\n /**\n * Write a log entry to the output destination.\n * @param entry - The log entry to write\n */\n log(entry: LogEntry): void;\n \n /**\n * Set the minimum log level for this adapter.\n * @param level - The minimum log level\n */\n setLevel(level: LogLevel): void;\n \n /**\n * Get the current minimum log level.\n * @returns The current log level\n */\n getLevel(): LogLevel;\n}","import { RuntimeInfo, RuntimeName, RuntimeCapabilities } from '../core/types.ts';\n\n/**\n * Detects the current JavaScript runtime environment and its capabilities.\n * @returns Information about the detected runtime\n * @example\n * ```typescript\n * const runtime = detectRuntime();\n * console.log(`Running on: ${runtime.name} ${runtime.version}`);\n * ```\n */\nexport function detectRuntime(): RuntimeInfo {\n const name = detectRuntimeName();\n const version = getRuntimeVersion(name);\n const capabilities = getRuntimeCapabilities(name);\n\n return {\n name,\n version,\n capabilities\n };\n}\n\nfunction detectRuntimeName(): RuntimeName {\n // Check for Deno\n if (typeof (globalThis as any).Deno !== 'undefined') {\n return 'deno';\n }\n\n // Check for Bun\n if (typeof (globalThis as any).Bun !== 'undefined') {\n return 'bun';\n }\n\n // Check for browser environment\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n return 'browser';\n }\n\n // Check for Web Worker\n if (typeof (globalThis as any).importScripts === 'function' && typeof window === 'undefined') {\n return 'webworker';\n }\n\n // Check for Node.js\n if (typeof process !== 'undefined' && process.versions && process.versions.node) {\n return 'node';\n }\n\n return 'unknown';\n}\n\nfunction getRuntimeVersion(runtime: RuntimeName): string | undefined {\n switch (runtime) {\n case 'node':\n return typeof process !== 'undefined' ? process.version : undefined;\n \n case 'deno':\n return typeof (globalThis as any).Deno !== 'undefined' \n ? (globalThis as any).Deno.version?.deno \n : undefined;\n \n case 'bun':\n return typeof (globalThis as any).Bun !== 'undefined'\n ? (globalThis as any).Bun.version\n : undefined;\n \n case 'browser':\n return typeof navigator !== 'undefined' ? navigator.userAgent : undefined;\n \n default:\n return undefined;\n }\n}\n\nfunction getRuntimeCapabilities(runtime: RuntimeName): RuntimeCapabilities {\n switch (runtime) {\n case 'node':\n return {\n fileSystem: true,\n colorSupport: true,\n processInfo: true,\n streams: true\n };\n \n case 'deno':\n return {\n fileSystem: true,\n colorSupport: true,\n processInfo: true,\n streams: true\n };\n \n case 'bun':\n return {\n fileSystem: true,\n colorSupport: true,\n processInfo: true,\n streams: true\n };\n \n case 'browser':\n return {\n fileSystem: false,\n colorSupport: true, // CSS styling in console\n processInfo: false,\n streams: false\n };\n \n case 'webworker':\n return {\n fileSystem: false,\n colorSupport: false,\n processInfo: false,\n streams: false\n };\n \n default:\n return {\n fileSystem: false,\n colorSupport: false,\n processInfo: false,\n streams: false\n };\n }\n}\n\n/**\n * Check if the current runtime is Node.js.\n * @returns True if running in Node.js\n */\nexport function isNode(): boolean {\n return detectRuntimeName() === 'node';\n}\n\n/**\n * Check if the current runtime is a browser.\n * @returns True if running in a browser\n */\nexport function isBrowser(): boolean {\n return detectRuntimeName() === 'browser';\n}\n\n/**\n * Check if the current runtime is Deno.\n * @returns True if running in Deno\n */\nexport function isDeno(): boolean {\n return detectRuntimeName() === 'deno';\n}\n\n/**\n * Check if the current runtime is Bun.\n * @returns True if running in Bun\n */\nexport function isBun(): boolean {\n return detectRuntimeName() === 'bun';\n}","/**\n * Safely stringify an object to JSON, handling circular references,\n * Error objects, functions, and other non-serializable values.\n * @param obj - The object to stringify\n * @param space - Number of spaces for pretty-printing (optional)\n * @returns JSON string representation\n */\nexport function safeStringify(obj: any, space?: number): string {\n const seen = new WeakSet();\n \n return JSON.stringify(obj, (key, value) => {\n // Handle circular references\n if (typeof value === 'object' && value !== null) {\n if (seen.has(value)) {\n return '[Circular]';\n }\n seen.add(value);\n }\n \n // Handle Error objects\n if (value instanceof Error) {\n return {\n name: value.name,\n message: value.message,\n stack: value.stack,\n ...Object.getOwnPropertyNames(value).reduce((acc, prop) => {\n if (prop !== 'name' && prop !== 'message' && prop !== 'stack') {\n acc[prop] = (value as any)[prop];\n }\n return acc;\n }, {} as any)\n };\n }\n \n // Handle functions\n if (typeof value === 'function') {\n return `[Function: ${value.name || 'anonymous'}]`;\n }\n \n // Handle undefined (JSON.stringify normally omits these)\n if (value === undefined) {\n return '[undefined]';\n }\n \n // Handle BigInt\n if (typeof value === 'bigint') {\n return `[BigInt: ${value.toString()}]`;\n }\n \n // Handle Symbol\n if (typeof value === 'symbol') {\n return `[Symbol: ${value.toString()}]`;\n }\n \n return value;\n }, space);\n}\n\n/**\n * Filter out sensitive data from an object before logging.\n * @param obj - The object to filter\n * @param sensitiveKeys - Array of key names to redact (case-insensitive)\n * @returns A new object with sensitive values replaced with '[REDACTED]'\n * @example\n * ```typescript\n * const data = { username: 'john', password: 'secret123' };\n * const filtered = filterSensitiveData(data);\n * // Result: { username: 'john', password: '[REDACTED]' }\n * ```\n */\nexport function filterSensitiveData(obj: any, sensitiveKeys: string[] = ['password', 'token', 'secret', 'key', 'auth']): any {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n \n const filtered = Array.isArray(obj) ? [] : {};\n \n for (const [key, value] of Object.entries(obj)) {\n const shouldFilter = sensitiveKeys.some(sensitiveKey => \n key.toLowerCase().includes(sensitiveKey.toLowerCase())\n );\n \n if (shouldFilter) {\n (filtered as any)[key] = '[REDACTED]';\n } else if (typeof value === 'object' && value !== null) {\n (filtered as any)[key] = filterSensitiveData(value, sensitiveKeys);\n } else {\n (filtered as any)[key] = value;\n }\n }\n \n return filtered;\n}","import { \n ILogger, \n LogLevel, \n LogMessage, \n LogEntry,\n RuntimeName,\n LoggerConfig \n} from './types.ts';\nimport { detectRuntime } from '../utils/runtime.ts';\nimport { safeStringify } from '../utils/serialization.ts';\n\nexport abstract class BaseLogger implements ILogger {\n protected level: LogLevel;\n protected config: Partial<LoggerConfig>;\n protected runtime: RuntimeName;\n protected childMetadata: Record<string, any> = {};\n\n constructor(config: Partial<LoggerConfig> = {}) {\n this.config = config;\n this.level = config.level ?? LogLevel.INFO;\n this.runtime = detectRuntime().name;\n }\n\n debug(message: LogMessage, metadata?: any): void {\n this.log(LogLevel.DEBUG, message, metadata);\n }\n\n info(message: LogMessage, metadata?: any): void {\n this.log(LogLevel.INFO, message, metadata);\n }\n\n warn(message: LogMessage, metadata?: any): void {\n this.log(LogLevel.WARN, message, metadata);\n }\n\n error(message: LogMessage, metadata?: any): void {\n this.log(LogLevel.ERROR, message, metadata);\n }\n\n log(level: LogLevel, message: LogMessage, metadata?: any): void {\n if (!this.shouldLog(level)) {\n return;\n }\n\n const resolvedMessage = typeof message === 'function' ? message() : message;\n const combinedMetadata = { ...this.childMetadata, ...metadata };\n\n const entry: LogEntry = {\n timestamp: new Date(),\n level,\n message: resolvedMessage,\n metadata: Object.keys(combinedMetadata).length > 0 ? combinedMetadata : undefined,\n runtime: this.runtime\n };\n\n this.writeLog(entry);\n }\n\n setLevel(level: LogLevel): void {\n this.level = level;\n }\n\n getLevel(): LogLevel {\n return this.level;\n }\n\n child(metadata: Record<string, any>): ILogger {\n const childLogger = this.createChild();\n childLogger.childMetadata = { ...this.childMetadata, ...metadata };\n return childLogger;\n }\n\n protected shouldLog(level: LogLevel): boolean {\n return level >= this.level;\n }\n\n protected abstract writeLog(entry: LogEntry): void;\n protected abstract createChild(): BaseLogger;\n}\n\nexport function serializeError(error: any): any {\n if (error instanceof Error) {\n return {\n name: error.name,\n message: error.message,\n stack: error.stack,\n ...(error as any) // Include any additional properties\n };\n }\n return error;\n}\n\nexport function formatLogEntry(entry: LogEntry, format: 'json' | 'text' = 'text'): string {\n if (format === 'json') {\n return safeStringify({\n timestamp: entry.timestamp.toISOString(),\n level: LogLevel[entry.level].toLowerCase(),\n message: entry.message,\n metadata: entry.metadata,\n runtime: entry.runtime\n });\n }\n\n // Text format\n const timestamp = entry.timestamp.toISOString();\n const level = LogLevel[entry.level].toUpperCase();\n const metaStr = entry.metadata ? ` ${safeStringify(entry.metadata)}` : '';\n \n return `[${timestamp}] ${level}: ${entry.message}${metaStr}`;\n}","import { BaseLogger } from '../core/logger.ts';\nimport { LogEntry, LogLevel, LoggerConfig } from '../core/types.ts';\nimport { safeStringify } from '../utils/serialization.ts';\n\nexport class NodeLogger extends BaseLogger {\n private winston?: any;\n\n constructor(config: Partial<LoggerConfig> = {}) {\n super(config);\n this.initializeWinston();\n }\n\n private async initializeWinston(): Promise<void> {\n try {\n // Try to load Winston if available\n // @ts-ignore - Optional peer dependency\n const winston = await import('winston');\n this.winston = this.createWinstonLogger(winston);\n } catch (error) {\n // Winston not available, will fall back to console\n console.warn('[logan-logger] Winston not found, falling back to console logging');\n }\n }\n\n private createWinstonLogger(winston: any): any {\n const logFormat = winston.format.combine(\n winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),\n winston.format.errors({ stack: true }),\n winston.format.json(),\n winston.format.prettyPrint()\n );\n\n const consoleFormat = winston.format.combine(\n winston.format.colorize(),\n winston.format.timestamp({ format: 'HH:mm:ss' }),\n winston.format.printf(({ timestamp, level, message, ...meta }: any) => {\n const metaStr = Object.keys(meta).length ? JSON.stringify(meta, null, 2) : '';\n return `${timestamp} [${level}]: ${message} ${metaStr}`;\n })\n );\n\n const logger = winston.createLogger({\n level: this.getWinstonLevel(this.level),\n format: logFormat,\n transports: [\n new winston.transports.Console({\n format: process.env.NODE_ENV === 'production' ? logFormat : consoleFormat,\n }),\n ],\n });\n\n // Add file transports for production\n if (process.env.NODE_ENV === 'production') {\n logger.add(\n new winston.transports.File({\n filename: 'logs/error.log',\n level: 'error',\n maxsize: 5242880, // 5MB\n maxFiles: 5,\n })\n );\n\n logger.add(\n new winston.transports.File({\n filename: 'logs/combined.log',\n maxsize: 5242880, // 5MB\n maxFiles: 10,\n })\n );\n }\n\n return logger;\n }\n\n protected writeLog(entry: LogEntry): void {\n if (this.winston) {\n this.winston.log({\n level: this.getWinstonLevel(entry.level),\n message: entry.message,\n timestamp: entry.timestamp,\n ...entry.metadata,\n });\n } else {\n // Fallback to console\n this.writeToConsole(entry);\n }\n }\n\n protected createChild(): BaseLogger {\n return new NodeLogger(this.config);\n }\n\n private writeToConsole(entry: LogEntry): void {\n const timestamp = entry.timestamp.toISOString();\n const level = LogLevel[entry.level].toLowerCase();\n const metaStr = entry.metadata ? ` ${safeStringify(entry.metadata)}` : '';\n const message = `[${timestamp}] ${level.toUpperCase()}: ${entry.message}${metaStr}`;\n\n switch (entry.level) {\n case LogLevel.DEBUG:\n console.debug(message);\n break;\n case LogLevel.INFO:\n console.info(message);\n break;\n case LogLevel.WARN:\n console.warn(message);\n break;\n case LogLevel.ERROR:\n console.error(message);\n break;\n }\n }\n\n private getWinstonLevel(level: LogLevel): string {\n switch (level) {\n case LogLevel.DEBUG:\n return 'debug';\n case LogLevel.INFO:\n return 'info';\n case LogLevel.WARN:\n return 'warn';\n case LogLevel.ERROR:\n return 'error';\n default:\n return 'info';\n }\n }\n\n setLevel(level: LogLevel): void {\n super.setLevel(level);\n if (this.winston) {\n this.winston.level = this.getWinstonLevel(level);\n }\n }\n}\n\n// Create Morgan-compatible stream\nexport function createMorganStream(logger: NodeLogger) {\n return {\n write: (message: string) => {\n logger.info(message.trim());\n },\n };\n}","import { BaseLogger } from '../core/logger.ts';\nimport { LogEntry, LogLevel, LoggerConfig } from '../core/types.ts';\nimport { safeStringify } from '../utils/serialization.ts';\n\nexport class BrowserLogger extends BaseLogger {\n constructor(config: Partial<LoggerConfig> = {}) {\n super(config);\n }\n\n protected writeLog(entry: LogEntry): void {\n const message = this.formatMessage(entry);\n const style = this.getConsoleStyle(entry.level);\n\n // Use safeStringify for metadata to handle circular references\n const metaStr = entry.metadata ? ` ${safeStringify(entry.metadata)}` : '';\n const fullMessage = `%c${message}${metaStr}`;\n\n switch (entry.level) {\n case LogLevel.DEBUG:\n if (console.debug) {\n console.debug(fullMessage, style);\n } else {\n console.log(fullMessage, style);\n }\n break;\n case LogLevel.INFO:\n console.info(fullMessage, style);\n break;\n case LogLevel.WARN:\n console.warn(fullMessage, style);\n break;\n case LogLevel.ERROR:\n console.error(fullMessage, style);\n break;\n }\n }\n\n protected createChild(): BaseLogger {\n return new BrowserLogger(this.config);\n }\n\n private formatMessage(entry: LogEntry): string {\n const timestamp = entry.timestamp.toISOString();\n const level = LogLevel[entry.level].toUpperCase();\n return `[${timestamp}] ${level}: ${entry.message}`;\n }\n\n private getConsoleStyle(level: LogLevel): string {\n if (!this.config.colorize) {\n return '';\n }\n\n switch (level) {\n case LogLevel.DEBUG:\n return 'color: #888; font-weight: normal;';\n case LogLevel.INFO:\n return 'color: #007acc; font-weight: normal;';\n case LogLevel.WARN:\n return 'color: #ff8c00; font-weight: bold;';\n case LogLevel.ERROR:\n return 'color: #dc3545; font-weight: bold;';\n default:\n return '';\n }\n }\n\n private shouldLogInProduction(): boolean {\n // Check various environment indicators\n const env = \n (globalThis as any).process?.env?.NODE_ENV ||\n (globalThis as any).process?.env?.NEXT_PUBLIC_APP_ENV ||\n 'development';\n \n return env !== 'production' || this.level <= LogLevel.ERROR;\n }\n\n protected shouldLog(level: LogLevel): boolean {\n // In browser, respect production environment\n if (!this.shouldLogInProduction() && level < LogLevel.ERROR) {\n return false;\n }\n \n return super.shouldLog(level);\n }\n}\n\n// Browser-specific utilities\nexport class ConsoleGroupLogger extends BrowserLogger {\n private groupStack: string[] = [];\n\n group(label: string): void {\n console.group(label);\n this.groupStack.push(label);\n }\n\n groupCollapsed(label: string): void {\n console.groupCollapsed(label);\n this.groupStack.push(label);\n }\n\n groupEnd(): void {\n console.groupEnd();\n this.groupStack.pop();\n }\n\n time(label: string): void {\n console.time(label);\n }\n\n timeEnd(label: string): void {\n console.timeEnd(label);\n }\n\n trace(message: string, metadata?: any): void {\n console.trace(message, metadata);\n }\n\n count(label?: string): void {\n console.count(label);\n }\n\n countReset(label?: string): void {\n console.countReset(label);\n }\n\n table(data: any): void {\n console.table(data);\n }\n}\n\n// Performance logging for browser\nexport class PerformanceLogger extends BrowserLogger {\n mark(name: string): void {\n if (typeof performance !== 'undefined' && performance.mark) {\n performance.mark(name);\n }\n }\n\n measure(name: string, startMark?: string, endMark?: string): void {\n if (typeof performance !== 'undefined' && performance.measure) {\n try {\n performance.measure(name, startMark, endMark);\n const entries = performance.getEntriesByName(name, 'measure');\n if (entries.length > 0) {\n const entry = entries[entries.length - 1];\n this.info(`Performance: ${name}`, {\n duration: entry.duration,\n startTime: entry.startTime\n });\n }\n } catch (error) {\n this.warn('Failed to measure performance', { name, error });\n }\n }\n }\n\n clearMarks(name?: string): void {\n if (typeof performance !== 'undefined' && performance.clearMarks) {\n performance.clearMarks(name);\n }\n }\n\n clearMeasures(name?: string): void {\n if (typeof performance !== 'undefined' && performance.clearMeasures) {\n performance.clearMeasures(name);\n }\n }\n}","import { LoggerConfig, LogLevel } from '../core/types.ts';\nimport { detectRuntime } from './runtime.ts';\n\nexport function getDefaultConfig(): LoggerConfig {\n const runtime = detectRuntime();\n \n return {\n level: LogLevel.INFO,\n format: 'text',\n timestamp: true,\n colorize: runtime.capabilities.colorSupport,\n metadata: {},\n transports: [\n {\n type: 'console',\n options: {}\n }\n ]\n };\n}\n\nexport function loadConfigFromEnvironment(): Partial<LoggerConfig> {\n const config: Partial<LoggerConfig> = {};\n \n // Check for environment variables\n if (typeof process !== 'undefined' && process.env) {\n const env = process.env;\n \n // Log level\n if (env.LOG_LEVEL) {\n config.level = stringToLogLevel(env.LOG_LEVEL);\n }\n \n // Format\n if (env.LOG_FORMAT && ['json', 'text'].includes(env.LOG_FORMAT)) {\n config.format = env.LOG_FORMAT as 'json' | 'text';\n }\n \n // Timestamp\n if (env.LOG_TIMESTAMP) {\n config.timestamp = env.LOG_TIMESTAMP.toLowerCase() === 'true';\n }\n \n // Colorize\n if (env.LOG_COLOR) {\n config.colorize = env.LOG_COLOR.toLowerCase() === 'true';\n }\n }\n \n return config;\n}\n\nexport async function loadConfigFromFile(configPath?: string): Promise<Partial<LoggerConfig>> {\n const runtime = detectRuntime();\n \n if (!runtime.capabilities.fileSystem) {\n return {};\n }\n \n const possiblePaths = configPath ? [configPath] : [\n 'logan.config.json',\n 'logan.config.js',\n '.loganrc.json',\n 'package.json' // Check for logan config in package.json\n ];\n \n for (const path of possiblePaths) {\n try {\n if (runtime.name === 'node') {\n return await loadNodeConfig(path);\n } else if (runtime.name === 'deno') {\n return await loadDenoConfig(path);\n } else if (runtime.name === 'bun') {\n return await loadBunConfig(path);\n }\n } catch (error) {\n // Continue to next path\n }\n }\n \n return {};\n}\n\nasync function loadNodeConfig(path: string): Promise<Partial<LoggerConfig>> {\n try {\n const fs = await import('fs/promises');\n const pathModule = await import('path');\n \n if (path.endsWith('.json')) {\n const content = await fs.readFile(path, 'utf-8');\n const parsed = JSON.parse(content);\n \n if (path === 'package.json') {\n return parsed.logan || {};\n }\n return parsed;\n } else if (path.endsWith('.js')) {\n const fullPath = pathModule.resolve(path);\n delete require.cache[fullPath]; // Clear cache\n const config = require(fullPath);\n return config.default || config;\n }\n } catch (error) {\n // File doesn't exist or can't be parsed\n }\n \n return {};\n}\n\nasync function loadDenoConfig(path: string): Promise<Partial<LoggerConfig>> {\n try {\n if (path.endsWith('.json')) {\n const content = await (globalThis as any).Deno.readTextFile(path);\n const parsed = JSON.parse(content);\n \n if (path === 'package.json') {\n return parsed.logan || {};\n }\n return parsed;\n } else if (path.endsWith('.js')) {\n const config = await import(/* @vite-ignore */ `./${path}`);\n return config.default || config;\n }\n } catch (error) {\n // File doesn't exist or can't be parsed\n }\n \n return {};\n}\n\nasync function loadBunConfig(path: string): Promise<Partial<LoggerConfig>> {\n // Bun can use Node.js-style require or ES modules\n return loadNodeConfig(path);\n}\n\nfunction stringToLogLevel(level: string): LogLevel {\n switch (level.toLowerCase()) {\n case 'debug':\n return LogLevel.DEBUG;\n case 'info':\n return LogLevel.INFO;\n case 'warn':\n case 'warning':\n return LogLevel.WARN;\n case 'error':\n return LogLevel.ERROR;\n case 'silent':\n case 'none':\n return LogLevel.SILENT;\n default:\n return LogLevel.INFO;\n }\n}\n\nexport function mergeConfigs(...configs: Partial<LoggerConfig>[]): LoggerConfig {\n const defaultConfig = getDefaultConfig();\n \n return configs.reduce<LoggerConfig>((merged, config) => ({\n ...merged,\n ...config,\n metadata: {\n ...merged.metadata,\n ...config.metadata\n },\n transports: config.transports || merged.transports\n }), defaultConfig);\n}","import { ILogger, LoggerConfig, LogLevel } from './types.ts';\nimport { detectRuntime } from '../utils/runtime.ts';\nimport { NodeLogger } from '../runtime/node.ts';\nimport { BrowserLogger } from '../runtime/browser.ts';\nimport { getDefaultConfig } from '../utils/config.ts';\n\n/**\n * Factory class for creating logger instances based on the detected runtime.\n */\nexport class LoggerFactory {\n /**\n * Create a logger instance appropriate for the current runtime.\n * @param config - Optional configuration for the logger\n * @returns A logger instance\n */\n static create(config: Partial<LoggerConfig> = {}): ILogger {\n const runtime = detectRuntime();\n const mergedConfig = this.mergeConfig(config);\n\n switch (runtime.name) {\n case 'node':\n return new NodeLogger(mergedConfig);\n \n case 'deno':\n // For now, use console-based logger for Deno\n // TODO: Implement Deno-specific logger\n return new BrowserLogger(mergedConfig);\n \n case 'bun':\n // For now, use Node.js logger for Bun (similar APIs)\n return new NodeLogger(mergedConfig);\n \n case 'browser':\n case 'webworker':\n return new BrowserLogger(mergedConfig);\n \n default:\n // Fallback to console-based logger\n return new BrowserLogger(mergedConfig);\n }\n }\n\n /**\n * Create a child logger with additional metadata.\n * @param parent - The parent logger instance\n * @param metadata - Additional metadata to include in all child log messages\n * @returns A new logger instance with the additional metadata\n */\n static createChild(parent: ILogger, metadata: Record<string, any>): ILogger {\n return parent.child(metadata);\n }\n\n private static mergeConfig(userConfig: Partial<LoggerConfig>): Partial<LoggerConfig> {\n const defaultConfig = getDefaultConfig();\n return {\n ...defaultConfig,\n ...userConfig,\n metadata: {\n ...defaultConfig.metadata,\n ...userConfig.metadata\n }\n };\n }\n}\n\n/**\n * Convenience function for creating a logger instance.\n * @param config - Optional configuration for the logger\n * @returns A logger instance appropriate for the current runtime\n * @example\n * ```typescript\n * import { createLogger, LogLevel } from 'logan-logger';\n * \n * const logger = createLogger({\n * level: LogLevel.DEBUG,\n * colorize: true\n * });\n * \n * logger.info('Hello world!');\n * ```\n */\nexport function createLogger(config?: Partial<LoggerConfig>): ILogger {\n return LoggerFactory.create(config);\n}\n\n/**\n * Create a logger with configuration based on the current environment.\n * Automatically detects production/development/test environments and\n * sets appropriate log levels and formatting.\n * @returns A logger instance configured for the current environment\n */\nexport function createLoggerForEnvironment(): ILogger {\n const env = getEnvironment();\n \n const config: Partial<LoggerConfig> = {\n level: getLogLevelForEnvironment(env),\n colorize: env !== 'production',\n timestamp: true,\n format: env === 'production' ? 'json' : 'text'\n };\n\n return createLogger(config);\n}\n\nfunction getEnvironment(): string {\n // Check various environment variables\n if (typeof process !== 'undefined' && process.env) {\n return process.env.NODE_ENV || \n process.env.NEXT_PUBLIC_APP_ENV || \n process.env.ENVIRONMENT || \n 'development';\n }\n \n // Browser environment detection\n if (typeof window !== 'undefined') {\n // Check for common build-time environment indicators\n return (globalThis as any).__ENV__ || 'development';\n }\n \n return 'development';\n}\n\nfunction getLogLevelForEnvironment(env: string): LogLevel {\n switch (env) {\n case 'production':\n return LogLevel.ERROR;\n case 'staging':\n case 'test':\n return LogLevel.WARN;\n case 'development':\n case 'dev':\n return LogLevel.DEBUG;\n default:\n return LogLevel.INFO;\n }\n}\n\n// Type-safe log level conversion\nexport function stringToLogLevel(level: string): LogLevel {\n switch (level.toLowerCase()) {\n case 'debug':\n return LogLevel.DEBUG;\n case 'info':\n return LogLevel.INFO;\n case 'warn':\n case 'warning':\n return LogLevel.WARN;\n case 'error':\n return LogLevel.ERROR;\n case 'silent':\n case 'none':\n return LogLevel.SILENT;\n default:\n return LogLevel.INFO;\n }\n}\n\nexport function logLevelToString(level: LogLevel): string {\n switch (level) {\n case LogLevel.DEBUG:\n return 'debug';\n case LogLevel.INFO:\n return 'info';\n case LogLevel.WARN:\n return 'warn';\n case LogLevel.ERROR:\n return 'error';\n case LogLevel.SILENT:\n return 'silent';\n default:\n return 'info';\n }\n}","// Main entry point for logan-logger\nexport * from './core/types.ts';\nexport * from './core/logger.ts';\nexport * from './core/factory.ts';\n\n// Runtime-specific exports\nexport { NodeLogger, createMorganStream } from './runtime/node.ts';\nexport { BrowserLogger, ConsoleGroupLogger, PerformanceLogger } from './runtime/browser.ts';\n\n// Utilities\nexport * from './utils/runtime.ts';\nexport * from './utils/config.ts';\nexport * from './utils/serialization.ts';\n\n// Main factory function (available as named export)\n\n// Convenience exports for common use cases\nimport { createLogger, createLoggerForEnvironment } from './core/factory.ts';\nimport { LogLevel, ILogger } from './core/types.ts';\n\n// Pre-configured loggers for different environments\nexport const logger: ILogger = createLoggerForEnvironment();\n\n// Legacy compatibility - matches your existing client/server code\nexport const log = {\n debug: (message: string, meta?: any): void => logger.debug(message, meta),\n info: (message: string, meta?: any): void => logger.info(message, meta),\n warn: (message: string, meta?: any): void => logger.warn(message, meta),\n error: (message: string, meta?: any): void => logger.error(message, meta),\n};\n\n// Named exports for explicit imports\nexport {\n createLogger,\n createLoggerForEnvironment,\n LogLevel\n};\n\n// Type-only exports for better tree-shaking\nexport type {\n ILogger,\n LoggerConfig,\n RuntimeInfo,\n RuntimeCapabilities,\n LogEntry,\n LogMessage,\n LogLevelString,\n RuntimeName,\n TransportConfig,\n ILoggerAdapter\n} from './core/types.ts';"],"names":["LogLevel","detectRuntime","name","detectRuntimeName","version","getRuntimeVersion","capabilities","getRuntimeCapabilities","runtime","isNode","isBrowser","isDeno","isBun","safeStringify","obj","space","seen","key","value","acc","prop","filterSensitiveData","sensitiveKeys","filtered","sensitiveKey","BaseLogger","config","message","metadata","level","resolvedMessage","combinedMetadata","entry","childLogger","serializeError","error","formatLogEntry","format","timestamp","metaStr","NodeLogger","winston","logFormat","consoleFormat","meta","logger","createMorganStream","BrowserLogger","style","fullMessage","ConsoleGroupLogger","label","data","PerformanceLogger","startMark","endMark","entries","getDefaultConfig","loadConfigFromEnvironment","env","stringToLogLevel","loadConfigFromFile","configPath","possiblePaths","path","loadNodeConfig","loadDenoConfig","loadBunConfig","fs","pathModule","content","parsed","fullPath","mergeConfigs","configs","defaultConfig","merged","LoggerFactory","mergedConfig","parent","userConfig","createLogger","createLoggerForEnvironment","getEnvironment","getLogLevelForEnvironment","logLevelToString","log"],"mappings":"AAIO,IAAKA,sBAAAA,OAEVA,EAAAA,EAAA,QAAQ,CAAA,IAAR,SAEAA,EAAAA,EAAA,OAAO,CAAA,IAAP,QAEAA,EAAAA,EAAA,OAAO,CAAA,IAAP,QAEAA,EAAAA,EAAA,QAAQ,CAAA,IAAR,SAEAA,EAAAA,EAAA,SAAS,CAAA,IAAT,UAVUA,IAAAA,KAAA,CAAA,CAAA;ACOL,SAASC,IAA6B;AAC3C,QAAMC,IAAOC,EAAA,GACPC,IAAUC,EAAkBH,CAAI,GAChCI,IAAeC,EAAuBL,CAAI;AAEhD,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B,GAAiBiB,MAAqBC,EAAO,KAAKlB,GAASiB,CAAI;AAAA,EACtE,MAAM,CAACjB,GAAiBiB,MAAqBC,EAAO,KAAKlB,GAASiB,CAAI;AAAA,EACtE,OAAO,CAACjB,GAAiBiB,MAAqBC,EAAO,MAAMlB,GAASiB,CAAI;AAC1E;"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/core/types.ts","../src/utils/runtime.ts","../src/utils/serialization.ts","../src/core/logger.ts","../src/runtime/node.ts","../src/runtime/browser.ts","../src/utils/config.ts","../src/core/factory.ts","../src/index.ts"],"sourcesContent":["/**\n * Log levels in ascending order of severity.\n * Used to filter which messages should be logged.\n */\nexport enum LogLevel {\n /** Debug messages - most verbose */\n DEBUG = 0,\n /** Informational messages */\n INFO = 1,\n /** Warning messages */\n WARN = 2,\n /** Error messages */\n ERROR = 3,\n /** No messages - silent mode */\n SILENT = 4\n}\n\n/**\n * String representation of log levels.\n */\nexport type LogLevelString = 'debug' | 'info' | 'warn' | 'error' | 'silent';\n\n/**\n * Supported JavaScript runtime environments.\n */\nexport type RuntimeName = 'node' | 'deno' | 'bun' | 'browser' | 'webworker' | 'unknown';\n\n/**\n * Information about the detected JavaScript runtime environment.\n */\nexport interface RuntimeInfo {\n /** The name of the runtime */\n name: RuntimeName;\n /** Version string of the runtime (if available) */\n version?: string;\n /** Capabilities supported by this runtime */\n capabilities: RuntimeCapabilities;\n}\n\n/**\n * Capabilities that a runtime may or may not support.\n */\nexport interface RuntimeCapabilities {\n /** Whether the runtime supports file system operations */\n fileSystem: boolean;\n /** Whether the runtime supports colored console output */\n colorSupport: boolean;\n /** Whether the runtime provides process information */\n processInfo: boolean;\n /** Whether the runtime supports streams */\n streams: boolean;\n}\n\n/**\n * Configuration options for creating a logger instance.\n */\nexport interface LoggerConfig {\n /** Minimum log level to output */\n level: LogLevel;\n /** Output format for log messages */\n format: 'json' | 'text' | 'custom';\n /** Whether to include timestamps in log output */\n timestamp: boolean;\n /** Whether to colorize log output (if supported) */\n colorize: boolean;\n /** Default metadata to include with all log messages */\n metadata: Record<string, any>;\n /** Transport configurations for log output */\n transports?: TransportConfig[];\n}\n\n/**\n * Configuration for a specific log transport (output destination).\n */\nexport interface TransportConfig {\n /** Type of transport */\n type: 'console' | 'file' | 'http' | 'custom';\n /** Minimum log level for this transport */\n level?: LogLevel;\n /** Transport-specific options */\n options: Record<string, any>;\n}\n\n/**\n * A log message can be a string or a function that returns a string.\n * Functions enable lazy evaluation for expensive log message generation.\n */\nexport type LogMessage = string | (() => string);\n\n/**\n * Internal representation of a log entry.\n */\nexport interface LogEntry {\n /** When the log entry was created */\n timestamp: Date;\n /** Log level of this entry */\n level: LogLevel;\n /** The log message */\n message: string;\n /** Additional structured data */\n metadata?: Record<string, any>;\n /** Runtime that generated this log entry */\n runtime: RuntimeName;\n}\n\n/**\n * Main logger interface providing methods for logging at different levels.\n * This interface is implemented by all logger implementations across different runtimes.\n */\nexport interface ILogger {\n /**\n * Log a debug message. Only shown when log level is DEBUG.\n * @param message - The message to log (string or lazy function)\n * @param metadata - Optional structured data to include\n */\n debug(message: LogMessage, metadata?: any): void;\n \n /**\n * Log an informational message.\n * @param message - The message to log (string or lazy function)\n * @param metadata - Optional structured data to include\n */\n info(message: LogMessage, metadata?: any): void;\n \n /**\n * Log a warning message.\n * @param message - The message to log (string or lazy function)\n * @param metadata - Optional structured data to include\n */\n warn(message: LogMessage, metadata?: any): void;\n \n /**\n * Log an error message.\n * @param message - The message to log (string or lazy function)\n * @param metadata - Optional structured data to include\n */\n error(message: LogMessage, metadata?: any): void;\n \n /**\n * Log a message at a specific level.\n * @param level - The log level\n * @param message - The message to log (string or lazy function)\n * @param metadata - Optional structured data to include\n */\n log(level: LogLevel, message: LogMessage, metadata?: any): void;\n \n /**\n * Set the minimum log level for this logger.\n * @param level - The minimum log level\n */\n setLevel(level: LogLevel): void;\n \n /**\n * Get the current minimum log level.\n * @returns The current log level\n */\n getLevel(): LogLevel;\n \n /**\n * Create a child logger with additional metadata.\n * @param metadata - Additional metadata to include in all child log messages\n * @returns A new logger instance with the additional metadata\n */\n child(metadata: Record<string, any>): ILogger;\n}\n\n/**\n * Interface for logger adapters that handle the actual log output.\n * This abstraction allows different implementations for different runtimes.\n */\nexport interface ILoggerAdapter {\n /**\n * Write a log entry to the output destination.\n * @param entry - The log entry to write\n */\n log(entry: LogEntry): void;\n \n /**\n * Set the minimum log level for this adapter.\n * @param level - The minimum log level\n */\n setLevel(level: LogLevel): void;\n \n /**\n * Get the current minimum log level.\n * @returns The current log level\n */\n getLevel(): LogLevel;\n}","import { RuntimeInfo, RuntimeName, RuntimeCapabilities } from '../core/types.ts';\n\n/**\n * Detects the current JavaScript runtime environment and its capabilities.\n * @returns Information about the detected runtime\n * @example\n * ```typescript\n * const runtime = detectRuntime();\n * console.log(`Running on: ${runtime.name} ${runtime.version}`);\n * ```\n */\nexport function detectRuntime(): RuntimeInfo {\n const name = detectRuntimeName();\n const version = getRuntimeVersion(name);\n const capabilities = getRuntimeCapabilities(name);\n\n return {\n name,\n version,\n capabilities\n };\n}\n\nfunction detectRuntimeName(): RuntimeName {\n // Check for Deno\n if (typeof (globalThis as any).Deno !== 'undefined') {\n return 'deno';\n }\n\n // Check for Bun\n if (typeof (globalThis as any).Bun !== 'undefined') {\n return 'bun';\n }\n\n // Check for browser environment\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n return 'browser';\n }\n\n // Check for Web Worker\n if (typeof (globalThis as any).importScripts === 'function' && typeof window === 'undefined') {\n return 'webworker';\n }\n\n // Check for Node.js\n if (typeof process !== 'undefined' && process.versions && process.versions.node) {\n return 'node';\n }\n\n return 'unknown';\n}\n\nfunction getRuntimeVersion(runtime: RuntimeName): string | undefined {\n switch (runtime) {\n case 'node':\n return typeof process !== 'undefined' ? process.version : undefined;\n \n case 'deno':\n return typeof (globalThis as any).Deno !== 'undefined' \n ? (globalThis as any).Deno.version?.deno \n : undefined;\n \n case 'bun':\n return typeof (globalThis as any).Bun !== 'undefined'\n ? (globalThis as any).Bun.version\n : undefined;\n \n case 'browser':\n return typeof navigator !== 'undefined' ? navigator.userAgent : undefined;\n \n default:\n return undefined;\n }\n}\n\nfunction getRuntimeCapabilities(runtime: RuntimeName): RuntimeCapabilities {\n switch (runtime) {\n case 'node':\n return {\n fileSystem: true,\n colorSupport: true,\n processInfo: true,\n streams: true\n };\n \n case 'deno':\n return {\n fileSystem: true,\n colorSupport: true,\n processInfo: true,\n streams: true\n };\n \n case 'bun':\n return {\n fileSystem: true,\n colorSupport: true,\n processInfo: true,\n streams: true\n };\n \n case 'browser':\n return {\n fileSystem: false,\n colorSupport: true, // CSS styling in console\n processInfo: false,\n streams: false\n };\n \n case 'webworker':\n return {\n fileSystem: false,\n colorSupport: false,\n processInfo: false,\n streams: false\n };\n \n default:\n return {\n fileSystem: false,\n colorSupport: false,\n processInfo: false,\n streams: false\n };\n }\n}\n\n/**\n * Check if the current runtime is Node.js.\n * @returns True if running in Node.js\n */\nexport function isNode(): boolean {\n return detectRuntimeName() === 'node';\n}\n\n/**\n * Check if the current runtime is a browser.\n * @returns True if running in a browser\n */\nexport function isBrowser(): boolean {\n return detectRuntimeName() === 'browser';\n}\n\n/**\n * Check if the current runtime is Deno.\n * @returns True if running in Deno\n */\nexport function isDeno(): boolean {\n return detectRuntimeName() === 'deno';\n}\n\n/**\n * Check if the current runtime is Bun.\n * @returns True if running in Bun\n */\nexport function isBun(): boolean {\n return detectRuntimeName() === 'bun';\n}","/**\n * Safely stringify an object to JSON, handling circular references,\n * Error objects, functions, and other non-serializable values.\n * @param obj - The object to stringify\n * @param space - Number of spaces for pretty-printing (optional)\n * @returns JSON string representation\n */\nexport function safeStringify(obj: any, space?: number): string {\n const seen = new WeakSet();\n \n return JSON.stringify(obj, (key, value) => {\n // Handle circular references\n if (typeof value === 'object' && value !== null) {\n if (seen.has(value)) {\n return '[Circular]';\n }\n seen.add(value);\n }\n \n // Handle Error objects\n if (value instanceof Error) {\n return {\n name: value.name,\n message: value.message,\n stack: value.stack,\n ...Object.getOwnPropertyNames(value).reduce((acc, prop) => {\n if (prop !== 'name' && prop !== 'message' && prop !== 'stack') {\n acc[prop] = (value as any)[prop];\n }\n return acc;\n }, {} as any)\n };\n }\n \n // Handle functions\n if (typeof value === 'function') {\n return `[Function: ${value.name || 'anonymous'}]`;\n }\n \n // Handle undefined (JSON.stringify normally omits these)\n if (value === undefined) {\n return '[undefined]';\n }\n \n // Handle BigInt\n if (typeof value === 'bigint') {\n return `[BigInt: ${value.toString()}]`;\n }\n \n // Handle Symbol\n if (typeof value === 'symbol') {\n return `[Symbol: ${value.toString()}]`;\n }\n \n return value;\n }, space);\n}\n\n/**\n * Filter out sensitive data from an object before logging.\n * @param obj - The object to filter\n * @param sensitiveKeys - Array of key names to redact (case-insensitive)\n * @returns A new object with sensitive values replaced with '[REDACTED]'\n * @example\n * ```typescript\n * const data = { username: 'john', password: 'secret123' };\n * const filtered = filterSensitiveData(data);\n * // Result: { username: 'john', password: '[REDACTED]' }\n * ```\n */\nexport function filterSensitiveData(obj: any, sensitiveKeys: string[] = ['password', 'token', 'secret', 'key', 'auth']): any {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n \n const filtered = Array.isArray(obj) ? [] : {};\n \n for (const [key, value] of Object.entries(obj)) {\n const shouldFilter = sensitiveKeys.some(sensitiveKey => \n key.toLowerCase().includes(sensitiveKey.toLowerCase())\n );\n \n if (shouldFilter) {\n (filtered as any)[key] = '[REDACTED]';\n } else if (typeof value === 'object' && value !== null) {\n (filtered as any)[key] = filterSensitiveData(value, sensitiveKeys);\n } else {\n (filtered as any)[key] = value;\n }\n }\n \n return filtered;\n}","import { \n ILogger, \n LogLevel, \n LogMessage, \n LogEntry,\n RuntimeName,\n LoggerConfig \n} from './types.ts';\nimport { detectRuntime } from '../utils/runtime.ts';\nimport { safeStringify } from '../utils/serialization.ts';\n\nexport abstract class BaseLogger implements ILogger {\n protected level: LogLevel;\n protected config: Partial<LoggerConfig>;\n protected runtime: RuntimeName;\n protected childMetadata: Record<string, any> = {};\n\n constructor(config: Partial<LoggerConfig> = {}) {\n this.config = config;\n this.level = config.level ?? LogLevel.INFO;\n this.runtime = detectRuntime().name;\n }\n\n debug(message: LogMessage, metadata?: any): void {\n this.log(LogLevel.DEBUG, message, metadata);\n }\n\n info(message: LogMessage, metadata?: any): void {\n this.log(LogLevel.INFO, message, metadata);\n }\n\n warn(message: LogMessage, metadata?: any): void {\n this.log(LogLevel.WARN, message, metadata);\n }\n\n error(message: LogMessage, metadata?: any): void {\n this.log(LogLevel.ERROR, message, metadata);\n }\n\n log(level: LogLevel, message: LogMessage, metadata?: any): void {\n if (!this.shouldLog(level)) {\n return;\n }\n\n const resolvedMessage = typeof message === 'function' ? message() : message;\n const combinedMetadata = { ...this.childMetadata, ...metadata };\n\n const entry: LogEntry = {\n timestamp: new Date(),\n level,\n message: resolvedMessage,\n metadata: Object.keys(combinedMetadata).length > 0 ? combinedMetadata : undefined,\n runtime: this.runtime\n };\n\n this.writeLog(entry);\n }\n\n setLevel(level: LogLevel): void {\n this.level = level;\n }\n\n getLevel(): LogLevel {\n return this.level;\n }\n\n child(metadata: Record<string, any>): ILogger {\n const childLogger = this.createChild();\n childLogger.childMetadata = { ...this.childMetadata, ...metadata };\n return childLogger;\n }\n\n protected shouldLog(level: LogLevel): boolean {\n return level >= this.level;\n }\n\n protected abstract writeLog(entry: LogEntry): void;\n protected abstract createChild(): BaseLogger;\n}\n\nexport function serializeError(error: any): any {\n if (error instanceof Error) {\n return {\n name: error.name,\n message: error.message,\n stack: error.stack,\n ...(error as any) // Include any additional properties\n };\n }\n return error;\n}\n\nexport function formatLogEntry(entry: LogEntry, format: 'json' | 'text' = 'text'): string {\n if (format === 'json') {\n return safeStringify({\n timestamp: entry.timestamp.toISOString(),\n level: LogLevel[entry.level].toLowerCase(),\n message: entry.message,\n metadata: entry.metadata,\n runtime: entry.runtime\n });\n }\n\n // Text format\n const timestamp = entry.timestamp.toISOString();\n const level = LogLevel[entry.level].toUpperCase();\n const metaStr = entry.metadata ? ` ${safeStringify(entry.metadata)}` : '';\n \n return `[${timestamp}] ${level}: ${entry.message}${metaStr}`;\n}","import { BaseLogger } from '../core/logger.ts';\nimport { LogEntry, LogLevel, LoggerConfig } from '../core/types.ts';\nimport { safeStringify } from '../utils/serialization.ts';\n\nexport class NodeLogger extends BaseLogger {\n private winston?: any;\n\n constructor(config: Partial<LoggerConfig> = {}) {\n super(config);\n this.initializeWinston();\n }\n\n private async initializeWinston(): Promise<void> {\n try {\n // Try to load Winston if available\n // @ts-ignore - Optional peer dependency\n const winston = await import('winston');\n this.winston = this.createWinstonLogger(winston);\n } catch (error) {\n // Winston not available, will fall back to console\n console.warn('[logan-logger] Winston not found, falling back to console logging');\n }\n }\n\n private createWinstonLogger(winston: any): any {\n const logFormat = winston.format.combine(\n winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),\n winston.format.errors({ stack: true }),\n winston.format.json(),\n winston.format.prettyPrint()\n );\n\n const consoleFormat = winston.format.combine(\n winston.format.colorize(),\n winston.format.timestamp({ format: 'HH:mm:ss' }),\n winston.format.printf(({ timestamp, level, message, ...meta }: any) => {\n const metaStr = Object.keys(meta).length ? JSON.stringify(meta, null, 2) : '';\n return `${timestamp} [${level}]: ${message} ${metaStr}`;\n })\n );\n\n const logger = winston.createLogger({\n level: this.getWinstonLevel(this.level),\n format: logFormat,\n transports: [\n new winston.transports.Console({\n format: process.env.NODE_ENV === 'production' ? logFormat : consoleFormat,\n }),\n ],\n });\n\n // Add file transports for production\n if (process.env.NODE_ENV === 'production') {\n logger.add(\n new winston.transports.File({\n filename: 'logs/error.log',\n level: 'error',\n maxsize: 5242880, // 5MB\n maxFiles: 5,\n })\n );\n\n logger.add(\n new winston.transports.File({\n filename: 'logs/combined.log',\n maxsize: 5242880, // 5MB\n maxFiles: 10,\n })\n );\n }\n\n return logger;\n }\n\n protected writeLog(entry: LogEntry): void {\n if (this.winston) {\n this.winston.log({\n level: this.getWinstonLevel(entry.level),\n message: entry.message,\n timestamp: entry.timestamp,\n ...entry.metadata,\n });\n } else {\n // Fallback to console\n this.writeToConsole(entry);\n }\n }\n\n protected createChild(): BaseLogger {\n return new NodeLogger(this.config);\n }\n\n private writeToConsole(entry: LogEntry): void {\n const timestamp = entry.timestamp.toISOString();\n const level = LogLevel[entry.level].toLowerCase();\n const metaStr = entry.metadata ? ` ${safeStringify(entry.metadata)}` : '';\n const message = `[${timestamp}] ${level.toUpperCase()}: ${entry.message}${metaStr}`;\n\n switch (entry.level) {\n case LogLevel.DEBUG:\n console.debug(message);\n break;\n case LogLevel.INFO:\n console.info(message);\n break;\n case LogLevel.WARN:\n console.warn(message);\n break;\n case LogLevel.ERROR:\n console.error(message);\n break;\n }\n }\n\n private getWinstonLevel(level: LogLevel): string {\n switch (level) {\n case LogLevel.DEBUG:\n return 'debug';\n case LogLevel.INFO:\n return 'info';\n case LogLevel.WARN:\n return 'warn';\n case LogLevel.ERROR:\n return 'error';\n default:\n return 'info';\n }\n }\n\n setLevel(level: LogLevel): void {\n super.setLevel(level);\n if (this.winston) {\n this.winston.level = this.getWinstonLevel(level);\n }\n }\n}\n\n// Create Morgan-compatible stream\nexport function createMorganStream(logger: NodeLogger) {\n return {\n write: (message: string) => {\n logger.info(message.trim());\n },\n };\n}","import { BaseLogger } from '../core/logger.ts';\nimport { LogEntry, LogLevel, LoggerConfig } from '../core/types.ts';\nimport { safeStringify } from '../utils/serialization.ts';\n\nexport class BrowserLogger extends BaseLogger {\n constructor(config: Partial<LoggerConfig> = {}) {\n super(config);\n }\n\n protected writeLog(entry: LogEntry): void {\n const message = this.formatMessage(entry);\n const style = this.getConsoleStyle(entry.level);\n\n // Use safeStringify for metadata to handle circular references\n const metaStr = entry.metadata ? ` ${safeStringify(entry.metadata)}` : '';\n const fullMessage = `%c${message}${metaStr}`;\n\n switch (entry.level) {\n case LogLevel.DEBUG:\n if (console.debug) {\n console.debug(fullMessage, style);\n } else {\n console.log(fullMessage, style);\n }\n break;\n case LogLevel.INFO:\n console.info(fullMessage, style);\n break;\n case LogLevel.WARN:\n console.warn(fullMessage, style);\n break;\n case LogLevel.ERROR:\n console.error(fullMessage, style);\n break;\n }\n }\n\n protected createChild(): BaseLogger {\n return new BrowserLogger(this.config);\n }\n\n private formatMessage(entry: LogEntry): string {\n const timestamp = entry.timestamp.toISOString();\n const level = LogLevel[entry.level].toUpperCase();\n return `[${timestamp}] ${level}: ${entry.message}`;\n }\n\n private getConsoleStyle(level: LogLevel): string {\n if (!this.config.colorize) {\n return '';\n }\n\n switch (level) {\n case LogLevel.DEBUG:\n return 'color: #888; font-weight: normal;';\n case LogLevel.INFO:\n return 'color: #007acc; font-weight: normal;';\n case LogLevel.WARN:\n return 'color: #ff8c00; font-weight: bold;';\n case LogLevel.ERROR:\n return 'color: #dc3545; font-weight: bold;';\n default:\n return '';\n }\n }\n\n private shouldLogInProduction(): boolean {\n // Check various environment indicators\n const env = \n (globalThis as any).process?.env?.NODE_ENV ||\n (globalThis as any).process?.env?.NEXT_PUBLIC_APP_ENV ||\n 'development';\n \n return env !== 'production' || this.level <= LogLevel.ERROR;\n }\n\n protected shouldLog(level: LogLevel): boolean {\n // In browser, respect production environment\n if (!this.shouldLogInProduction() && level < LogLevel.ERROR) {\n return false;\n }\n \n return super.shouldLog(level);\n }\n}\n\n// Browser-specific utilities\nexport class ConsoleGroupLogger extends BrowserLogger {\n private groupStack: string[] = [];\n\n group(label: string): void {\n console.group(label);\n this.groupStack.push(label);\n }\n\n groupCollapsed(label: string): void {\n console.groupCollapsed(label);\n this.groupStack.push(label);\n }\n\n groupEnd(): void {\n console.groupEnd();\n this.groupStack.pop();\n }\n\n time(label: string): void {\n console.time(label);\n }\n\n timeEnd(label: string): void {\n console.timeEnd(label);\n }\n\n trace(message: string, metadata?: any): void {\n console.trace(message, metadata);\n }\n\n count(label?: string): void {\n console.count(label);\n }\n\n countReset(label?: string): void {\n console.countReset(label);\n }\n\n table(data: any): void {\n console.table(data);\n }\n}\n\n// Performance logging for browser\nexport class PerformanceLogger extends BrowserLogger {\n mark(name: string): void {\n if (typeof performance !== 'undefined' && performance.mark) {\n performance.mark(name);\n }\n }\n\n measure(name: string, startMark?: string, endMark?: string): void {\n if (typeof performance !== 'undefined' && performance.measure) {\n try {\n performance.measure(name, startMark, endMark);\n const entries = performance.getEntriesByName(name, 'measure');\n if (entries.length > 0) {\n const entry = entries[entries.length - 1];\n this.info(`Performance: ${name}`, {\n duration: entry.duration,\n startTime: entry.startTime\n });\n }\n } catch (error) {\n this.warn('Failed to measure performance', { name, error });\n }\n }\n }\n\n clearMarks(name?: string): void {\n if (typeof performance !== 'undefined' && performance.clearMarks) {\n performance.clearMarks(name);\n }\n }\n\n clearMeasures(name?: string): void {\n if (typeof performance !== 'undefined' && performance.clearMeasures) {\n performance.clearMeasures(name);\n }\n }\n}","import { LoggerConfig, LogLevel } from '../core/types.ts';\nimport { detectRuntime } from './runtime.ts';\n\nexport function getDefaultConfig(): LoggerConfig {\n const runtime = detectRuntime();\n \n return {\n level: LogLevel.INFO,\n format: 'text',\n timestamp: true,\n colorize: runtime.capabilities.colorSupport,\n metadata: {},\n transports: [\n {\n type: 'console',\n options: {}\n }\n ]\n };\n}\n\nexport function loadConfigFromEnvironment(): Partial<LoggerConfig> {\n const config: Partial<LoggerConfig> = {};\n \n // Check for environment variables\n if (typeof process !== 'undefined' && process.env) {\n const env = process.env;\n \n // Log level\n if (env.LOG_LEVEL) {\n config.level = stringToLogLevel(env.LOG_LEVEL);\n }\n \n // Format\n if (env.LOG_FORMAT && ['json', 'text'].includes(env.LOG_FORMAT)) {\n config.format = env.LOG_FORMAT as 'json' | 'text';\n }\n \n // Timestamp\n if (env.LOG_TIMESTAMP) {\n config.timestamp = env.LOG_TIMESTAMP.toLowerCase() === 'true';\n }\n \n // Colorize\n if (env.LOG_COLOR) {\n config.colorize = env.LOG_COLOR.toLowerCase() === 'true';\n }\n }\n \n return config;\n}\n\nexport async function loadConfigFromFile(configPath?: string): Promise<Partial<LoggerConfig>> {\n const runtime = detectRuntime();\n \n if (!runtime.capabilities.fileSystem) {\n return {};\n }\n \n const possiblePaths = configPath ? [configPath] : [\n 'logan.config.json',\n 'logan.config.js',\n '.loganrc.json',\n 'package.json' // Check for logan config in package.json\n ];\n \n for (const path of possiblePaths) {\n try {\n if (runtime.name === 'node') {\n return await loadNodeConfig(path);\n } else if (runtime.name === 'deno') {\n return await loadDenoConfig(path);\n } else if (runtime.name === 'bun') {\n return await loadBunConfig(path);\n }\n } catch (error) {\n // Continue to next path\n }\n }\n \n return {};\n}\n\nasync function loadNodeConfig(path: string): Promise<Partial<LoggerConfig>> {\n try {\n const fs = await import('fs/promises');\n const pathModule = await import('path');\n \n if (path.endsWith('.json')) {\n const content = await fs.readFile(path, 'utf-8');\n const parsed = JSON.parse(content);\n \n if (path === 'package.json') {\n return parsed.logan || {};\n }\n return parsed;\n } else if (path.endsWith('.js')) {\n const fullPath = pathModule.resolve(path);\n delete require.cache[fullPath]; // Clear cache\n const config = require(fullPath);\n return config.default || config;\n }\n } catch (error) {\n // File doesn't exist or can't be parsed\n }\n \n return {};\n}\n\nasync function loadDenoConfig(path: string): Promise<Partial<LoggerConfig>> {\n try {\n if (path.endsWith('.json')) {\n const content = await (globalThis as any).Deno.readTextFile(path);\n const parsed = JSON.parse(content);\n \n if (path === 'package.json') {\n return parsed.logan || {};\n }\n return parsed;\n } else if (path.endsWith('.js')) {\n const config = await import(/* @vite-ignore */ `./${path}`);\n return config.default || config;\n }\n } catch (error) {\n // File doesn't exist or can't be parsed\n }\n \n return {};\n}\n\nasync function loadBunConfig(path: string): Promise<Partial<LoggerConfig>> {\n // Bun can use Node.js-style require or ES modules\n return loadNodeConfig(path);\n}\n\nfunction stringToLogLevel(level: string): LogLevel {\n switch (level.toLowerCase()) {\n case 'debug':\n return LogLevel.DEBUG;\n case 'info':\n return LogLevel.INFO;\n case 'warn':\n case 'warning':\n return LogLevel.WARN;\n case 'error':\n return LogLevel.ERROR;\n case 'silent':\n case 'none':\n return LogLevel.SILENT;\n default:\n return LogLevel.INFO;\n }\n}\n\nexport function mergeConfigs(...configs: Partial<LoggerConfig>[]): LoggerConfig {\n const defaultConfig = getDefaultConfig();\n \n return configs.reduce<LoggerConfig>((merged, config) => ({\n ...merged,\n ...config,\n metadata: {\n ...merged.metadata,\n ...config.metadata\n },\n transports: config.transports || merged.transports\n }), defaultConfig);\n}","import { ILogger, LoggerConfig, LogLevel } from './types.ts';\nimport { detectRuntime } from '../utils/runtime.ts';\nimport { NodeLogger } from '../runtime/node.ts';\nimport { BrowserLogger } from '../runtime/browser.ts';\nimport { getDefaultConfig } from '../utils/config.ts';\n\n/**\n * Factory class for creating logger instances based on the detected runtime.\n */\nexport class LoggerFactory {\n /**\n * Create a logger instance appropriate for the current runtime.\n * @param config - Optional configuration for the logger\n * @returns A logger instance\n */\n static create(config: Partial<LoggerConfig> = {}): ILogger {\n const runtime = detectRuntime();\n const mergedConfig = this.mergeConfig(config);\n\n switch (runtime.name) {\n case 'node':\n return new NodeLogger(mergedConfig);\n \n case 'deno':\n // For now, use console-based logger for Deno\n // TODO: Implement Deno-specific logger\n return new BrowserLogger(mergedConfig);\n \n case 'bun':\n // For now, use Node.js logger for Bun (similar APIs)\n return new NodeLogger(mergedConfig);\n \n case 'browser':\n case 'webworker':\n return new BrowserLogger(mergedConfig);\n \n default:\n // Fallback to console-based logger\n return new BrowserLogger(mergedConfig);\n }\n }\n\n /**\n * Create a child logger with additional metadata.\n * @param parent - The parent logger instance\n * @param metadata - Additional metadata to include in all child log messages\n * @returns A new logger instance with the additional metadata\n */\n static createChild(parent: ILogger, metadata: Record<string, any>): ILogger {\n return parent.child(metadata);\n }\n\n private static mergeConfig(userConfig: Partial<LoggerConfig>): Partial<LoggerConfig> {\n const defaultConfig = getDefaultConfig();\n return {\n ...defaultConfig,\n ...userConfig,\n metadata: {\n ...defaultConfig.metadata,\n ...userConfig.metadata\n }\n };\n }\n}\n\n/**\n * Convenience function for creating a logger instance.\n * @param config - Optional configuration for the logger\n * @returns A logger instance appropriate for the current runtime\n * @example\n * ```typescript\n * import { createLogger, LogLevel } from 'logan-logger';\n * \n * const logger = createLogger({\n * level: LogLevel.DEBUG,\n * colorize: true\n * });\n * \n * logger.info('Hello world!');\n * ```\n */\nexport function createLogger(config?: Partial<LoggerConfig>): ILogger {\n return LoggerFactory.create(config);\n}\n\n/**\n * Create a logger with configuration based on the current environment.\n * Automatically detects production/development/test environments and\n * sets appropriate log levels and formatting.\n * @returns A logger instance configured for the current environment\n */\nexport function createLoggerForEnvironment(): ILogger {\n const env = getEnvironment();\n \n const config: Partial<LoggerConfig> = {\n level: getLogLevelForEnvironment(env),\n colorize: env !== 'production',\n timestamp: true,\n format: env === 'production' ? 'json' : 'text'\n };\n\n return createLogger(config);\n}\n\nfunction getEnvironment(): string {\n // Check various environment variables\n if (typeof process !== 'undefined' && process.env) {\n return process.env.NODE_ENV || \n process.env.NEXT_PUBLIC_APP_ENV || \n process.env.ENVIRONMENT || \n 'development';\n }\n \n // Browser environment detection\n if (typeof window !== 'undefined') {\n // Check for common build-time environment indicators\n return (globalThis as any).__ENV__ || 'development';\n }\n \n return 'development';\n}\n\nfunction getLogLevelForEnvironment(env: string): LogLevel {\n switch (env) {\n case 'production':\n return LogLevel.ERROR;\n case 'staging':\n case 'test':\n return LogLevel.WARN;\n case 'development':\n case 'dev':\n return LogLevel.DEBUG;\n default:\n return LogLevel.INFO;\n }\n}\n\n// Type-safe log level conversion\nexport function stringToLogLevel(level: string): LogLevel {\n switch (level.toLowerCase()) {\n case 'debug':\n return LogLevel.DEBUG;\n case 'info':\n return LogLevel.INFO;\n case 'warn':\n case 'warning':\n return LogLevel.WARN;\n case 'error':\n return LogLevel.ERROR;\n case 'silent':\n case 'none':\n return LogLevel.SILENT;\n default:\n return LogLevel.INFO;\n }\n}\n\nexport function logLevelToString(level: LogLevel): string {\n switch (level) {\n case LogLevel.DEBUG:\n return 'debug';\n case LogLevel.INFO:\n return 'info';\n case LogLevel.WARN:\n return 'warn';\n case LogLevel.ERROR:\n return 'error';\n case LogLevel.SILENT:\n return 'silent';\n default:\n return 'info';\n }\n}","// Main entry point for logan-logger\nexport * from './core/types.ts';\nexport * from './core/logger.ts';\nexport * from './core/factory.ts';\n\n// Runtime-specific exports\nexport { NodeLogger, createMorganStream } from './runtime/node.ts';\nexport { BrowserLogger, ConsoleGroupLogger, PerformanceLogger } from './runtime/browser.ts';\n\n// Utilities\nexport * from './utils/runtime.ts';\nexport * from './utils/config.ts';\nexport * from './utils/serialization.ts';\n\n// Main factory function (available as named export)\n\n// Convenience exports for common use cases\nimport { createLogger, createLoggerForEnvironment } from './core/factory.ts';\nimport { LogLevel, ILogger } from './core/types.ts';\n\n// Pre-configured loggers for different environments\nexport const logger: ILogger = createLoggerForEnvironment();\n\n// Legacy compatibility - matches your existing client/server code\nexport const log = {\n debug: (message: string, meta?: any): void => logger.debug(message, meta),\n info: (message: string, meta?: any): void => logger.info(message, meta),\n warn: (message: string, meta?: any): void => logger.warn(message, meta),\n error: (message: string, meta?: any): void => logger.error(message, meta),\n};\n\n// Named exports for explicit imports\nexport {\n createLogger,\n createLoggerForEnvironment,\n LogLevel\n};\n\n// Type-only exports for better tree-shaking\nexport type {\n ILogger,\n LoggerConfig,\n RuntimeInfo,\n RuntimeCapabilities,\n LogEntry,\n LogMessage,\n LogLevelString,\n RuntimeName,\n TransportConfig,\n ILoggerAdapter\n} from './core/types.ts';"],"names":["LogLevel","detectRuntime","name","detectRuntimeName","version","getRuntimeVersion","capabilities","getRuntimeCapabilities","runtime","isNode","isBrowser","isDeno","isBun","safeStringify","obj","space","seen","key","value","acc","prop","filterSensitiveData","sensitiveKeys","filtered","sensitiveKey","BaseLogger","config","message","metadata","level","resolvedMessage","combinedMetadata","entry","childLogger","serializeError","error","formatLogEntry","format","timestamp","metaStr","NodeLogger","winston","logFormat","consoleFormat","meta","logger","createMorganStream","BrowserLogger","style","fullMessage","ConsoleGroupLogger","label","data","PerformanceLogger","startMark","endMark","entries","getDefaultConfig","loadConfigFromEnvironment","env","stringToLogLevel","loadConfigFromFile","configPath","possiblePaths","path","loadNodeConfig","loadDenoConfig","loadBunConfig","fs","pathModule","content","parsed","fullPath","mergeConfigs","configs","defaultConfig","merged","LoggerFactory","mergedConfig","parent","userConfig","createLogger","createLoggerForEnvironment","getEnvironment","getLogLevelForEnvironment","logLevelToString","log"],"mappings":"2hBAIO,IAAKA,GAAAA,IAEVA,EAAAA,EAAA,MAAQ,CAAA,EAAR,QAEAA,EAAAA,EAAA,KAAO,CAAA,EAAP,OAEAA,EAAAA,EAAA,KAAO,CAAA,EAAP,OAEAA,EAAAA,EAAA,MAAQ,CAAA,EAAR,QAEAA,EAAAA,EAAA,OAAS,CAAA,EAAT,SAVUA,IAAAA,GAAA,CAAA,CAAA,ECOL,SAASC,GAA6B,CAC3C,MAAMC,EAAOC,EAAA,EACPC,EAAUC,EAAkBH,CAAI,EAChCI,EAAeC,EAAuBL,CAAI,EAEhD,MAAO,CACL,KAAAA,EACA,QAAAE,EACA,aAAAE,CAAA,CAEJ,CAEA,SAASH,GAAiC,CAExC,OAAI,OAAQ,WAAmB,KAAS,IAC/B,OAIL,OAAQ,WAAmB,IAAQ,IAC9B,MAIL,OAAO,OAAW,KAAe,OAAO,SAAa,IAChD,UAIL,OAAQ,WAAmB,eAAkB,YAAc,OAAO,OAAW,IACxE,YAIL,OAAO,QAAY,KAAe,QAAQ,UAAY,QAAQ,SAAS,KAClE,OAGF,SACT,CAEA,SAASE,EAAkBG,EAA0C,CACnE,OAAQA,EAAA,CACN,IAAK,OACH,OAAO,OAAO,QAAY,IAAc,QAAQ,QAAU,OAE5D,IAAK,OACH,OAAO,OAAQ,WAAmB,KAAS,IACtC,WAAmB,KAAK,SAAS,KAClC,OAEN,IAAK,MACH,OAAO,OAAQ,WAAmB,IAAQ,IACrC,WAAmB,IAAI,QACxB,OAEN,IAAK,UACH,OAAO,OAAO,UAA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