logan-logger 1.1.21 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -7
- package/dist/browser.cjs +1 -1
- package/dist/browser.mjs +20 -42
- package/dist/bun.cjs +1 -1
- package/dist/bun.d.cts +4 -1
- package/dist/bun.d.mts +4 -1
- package/dist/bun.d.ts +4 -1
- package/dist/bun.mjs +5 -4
- package/dist/chunks/{browser-D5QY2oJb.mjs → config-Db6PTLH2.mjs} +158 -23
- package/dist/chunks/config-PPDFSral.cjs +1 -0
- package/dist/chunks/config-file-37L8z8Lm.mjs +56 -0
- package/dist/chunks/config-file-Dvyi1e80.cjs +1 -0
- package/dist/chunks/factory-BPYE1-Nw.cjs +1 -0
- package/dist/chunks/factory-CXO2aNcc.mjs +169 -0
- package/dist/chunks/file-transport-DRyxQq8t.mjs +80 -0
- package/dist/chunks/file-transport-SA6KG1oM.cjs +1 -0
- package/dist/core/factory.d.cts +22 -0
- package/dist/core/factory.d.mts +22 -0
- package/dist/core/factory.d.ts +22 -0
- package/dist/core/transport.d.cts +73 -0
- package/dist/core/transport.d.mts +73 -0
- package/dist/core/transport.d.ts +73 -0
- package/dist/core/types.d.cts +9 -0
- package/dist/core/types.d.mts +9 -0
- package/dist/core/types.d.ts +9 -0
- package/dist/deno.cjs +1 -1
- package/dist/deno.d.cts +3 -1
- package/dist/deno.d.mts +3 -1
- package/dist/deno.d.ts +3 -1
- package/dist/deno.mjs +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +9 -9
- package/dist/node.cjs +1 -1
- package/dist/node.d.cts +3 -1
- package/dist/node.d.mts +3 -1
- package/dist/node.d.ts +3 -1
- package/dist/node.mjs +3 -2
- package/dist/runtime/file-transport.d.cts +62 -0
- package/dist/runtime/file-transport.d.mts +62 -0
- package/dist/runtime/file-transport.d.ts +62 -0
- package/dist/runtime/node.d.cts +39 -8
- package/dist/runtime/node.d.mts +39 -8
- package/dist/runtime/node.d.ts +39 -8
- package/dist/utils/config-file.d.cts +2 -0
- package/dist/utils/config-file.d.mts +2 -0
- package/dist/utils/config-file.d.ts +2 -0
- package/dist/utils/config.d.cts +33 -2
- package/dist/utils/config.d.mts +33 -2
- package/dist/utils/config.d.ts +33 -2
- package/dist/utils/formatting.d.cts +14 -1
- package/dist/utils/formatting.d.mts +14 -1
- package/dist/utils/formatting.d.ts +14 -1
- package/dist/utils/serialization.d.cts +30 -3
- package/dist/utils/serialization.d.mts +30 -3
- package/dist/utils/serialization.d.ts +30 -3
- package/package.json +3 -10
- package/dist/chunks/__vite-browser-external-BgoQtmXf.mjs +0 -7
- package/dist/chunks/__vite-browser-external-Bjj3r6ML.cjs +0 -1
- package/dist/chunks/browser-Bq67gUmd.cjs +0 -1
- package/dist/chunks/factory-2po65gyH.mjs +0 -262
- package/dist/chunks/factory-CluPoiZb.cjs +0 -1
- package/dist/chunks/formatting-CLctAPm9.mjs +0 -29
- package/dist/chunks/formatting-Cb_xXgov.cjs +0 -1
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { LogEntry, LogLevel } from '../core/types.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Presentation options for {@link formatLogEntry}, drawn from `LoggerConfig`.
|
|
4
|
+
*/
|
|
5
|
+
export interface FormatOptions {
|
|
6
|
+
/** Include the timestamp in the text form. Defaults to `true`. */
|
|
7
|
+
timestamp?: boolean;
|
|
8
|
+
/** Apply ANSI colour to the level token in the text form. Defaults to `false`. */
|
|
9
|
+
colorize?: boolean;
|
|
10
|
+
}
|
|
2
11
|
/**
|
|
3
12
|
* Format a log entry for output in different formats.
|
|
4
13
|
* @param entry - The log entry to format
|
|
5
14
|
* @param format - Output format ('json' or 'text')
|
|
15
|
+
* @param options - Presentation options; they affect the text form only
|
|
6
16
|
* @returns Formatted log string
|
|
7
17
|
* @example
|
|
8
18
|
* ```typescript
|
|
@@ -17,11 +27,14 @@ import { LogEntry, LogLevel } from '../core/types.mjs';
|
|
|
17
27
|
* const textFormat = formatLogEntry(entry, 'text');
|
|
18
28
|
* // Result: "[2024-01-01T12:00:00.000Z] INFO: User logged in {\"userId\":123}"
|
|
19
29
|
*
|
|
30
|
+
* const bare = formatLogEntry(entry, 'text', { timestamp: false });
|
|
31
|
+
* // Result: "INFO: User logged in {\"userId\":123}"
|
|
32
|
+
*
|
|
20
33
|
* const jsonFormat = formatLogEntry(entry, 'json');
|
|
21
34
|
* // Result: {"timestamp":"2024-01-01T12:00:00.000Z","level":"info","message":"User logged in","metadata":{"userId":123},"runtime":"node"}
|
|
22
35
|
* ```
|
|
23
36
|
*/
|
|
24
|
-
export declare function formatLogEntry(entry: LogEntry, format?: 'json' | 'text'): string;
|
|
37
|
+
export declare function formatLogEntry(entry: LogEntry, format?: 'json' | 'text', options?: FormatOptions): string;
|
|
25
38
|
/**
|
|
26
39
|
* Format log level as a colored string for terminal output.
|
|
27
40
|
* @param level - The log level to format
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { LogEntry, LogLevel } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Presentation options for {@link formatLogEntry}, drawn from `LoggerConfig`.
|
|
4
|
+
*/
|
|
5
|
+
export interface FormatOptions {
|
|
6
|
+
/** Include the timestamp in the text form. Defaults to `true`. */
|
|
7
|
+
timestamp?: boolean;
|
|
8
|
+
/** Apply ANSI colour to the level token in the text form. Defaults to `false`. */
|
|
9
|
+
colorize?: boolean;
|
|
10
|
+
}
|
|
2
11
|
/**
|
|
3
12
|
* Format a log entry for output in different formats.
|
|
4
13
|
* @param entry - The log entry to format
|
|
5
14
|
* @param format - Output format ('json' or 'text')
|
|
15
|
+
* @param options - Presentation options; they affect the text form only
|
|
6
16
|
* @returns Formatted log string
|
|
7
17
|
* @example
|
|
8
18
|
* ```typescript
|
|
@@ -17,11 +27,14 @@ import { LogEntry, LogLevel } from '../core/types';
|
|
|
17
27
|
* const textFormat = formatLogEntry(entry, 'text');
|
|
18
28
|
* // Result: "[2024-01-01T12:00:00.000Z] INFO: User logged in {\"userId\":123}"
|
|
19
29
|
*
|
|
30
|
+
* const bare = formatLogEntry(entry, 'text', { timestamp: false });
|
|
31
|
+
* // Result: "INFO: User logged in {\"userId\":123}"
|
|
32
|
+
*
|
|
20
33
|
* const jsonFormat = formatLogEntry(entry, 'json');
|
|
21
34
|
* // Result: {"timestamp":"2024-01-01T12:00:00.000Z","level":"info","message":"User logged in","metadata":{"userId":123},"runtime":"node"}
|
|
22
35
|
* ```
|
|
23
36
|
*/
|
|
24
|
-
export declare function formatLogEntry(entry: LogEntry, format?: 'json' | 'text'): string;
|
|
37
|
+
export declare function formatLogEntry(entry: LogEntry, format?: 'json' | 'text', options?: FormatOptions): string;
|
|
25
38
|
/**
|
|
26
39
|
* Format log level as a colored string for terminal output.
|
|
27
40
|
* @param level - The log level to format
|
|
@@ -1,11 +1,27 @@
|
|
|
1
|
+
/** Options accepted by {@link safeStringify}. */
|
|
2
|
+
export interface SafeStringifyOptions {
|
|
3
|
+
/** Maximum nesting depth before `'[MaxDepth]'` is emitted. Defaults to 100. */
|
|
4
|
+
maxDepth?: number;
|
|
5
|
+
}
|
|
1
6
|
/**
|
|
2
|
-
* Safely stringify
|
|
7
|
+
* Safely stringify a value to JSON, handling circular references,
|
|
3
8
|
* Error objects, functions, and other non-serializable values.
|
|
4
|
-
* @param obj - The
|
|
9
|
+
* @param obj - The value to stringify
|
|
5
10
|
* @param space - Number of spaces for pretty-printing (optional)
|
|
11
|
+
* @param options - Traversal limits (optional)
|
|
6
12
|
* @returns JSON string representation
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const user = { id: 7 };
|
|
16
|
+
* safeStringify({ actor: user, owner: user });
|
|
17
|
+
* // {"actor":{"id":7},"owner":{"id":7}} — a repeated reference is not a cycle
|
|
18
|
+
*
|
|
19
|
+
* const cyclic: any = {};
|
|
20
|
+
* cyclic.self = cyclic;
|
|
21
|
+
* safeStringify(cyclic); // {"self":"[Circular]"}
|
|
22
|
+
* ```
|
|
7
23
|
*/
|
|
8
|
-
export declare function safeStringify(obj: any, space?: number): string;
|
|
24
|
+
export declare function safeStringify(obj: any, space?: number, options?: SafeStringifyOptions): string;
|
|
9
25
|
/**
|
|
10
26
|
* Filter out sensitive data from an object before logging.
|
|
11
27
|
* @param obj - The object to filter
|
|
@@ -19,4 +35,15 @@ export declare function safeStringify(obj: any, space?: number): string;
|
|
|
19
35
|
* ```
|
|
20
36
|
*/
|
|
21
37
|
export declare function filterSensitiveData(obj: any, sensitiveKeys?: string[]): any;
|
|
38
|
+
/**
|
|
39
|
+
* Serialize Error objects to plain objects for logging.
|
|
40
|
+
* @param error - The error to serialize
|
|
41
|
+
* @returns Serialized error object or original value if not an Error
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const error = new Error('Something went wrong');
|
|
45
|
+
* const serialized = serializeError(error);
|
|
46
|
+
* // Result: { name: 'Error', message: 'Something went wrong', stack: '...' }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
22
49
|
export declare function serializeError(error: any): any;
|
|
@@ -1,11 +1,27 @@
|
|
|
1
|
+
/** Options accepted by {@link safeStringify}. */
|
|
2
|
+
export interface SafeStringifyOptions {
|
|
3
|
+
/** Maximum nesting depth before `'[MaxDepth]'` is emitted. Defaults to 100. */
|
|
4
|
+
maxDepth?: number;
|
|
5
|
+
}
|
|
1
6
|
/**
|
|
2
|
-
* Safely stringify
|
|
7
|
+
* Safely stringify a value to JSON, handling circular references,
|
|
3
8
|
* Error objects, functions, and other non-serializable values.
|
|
4
|
-
* @param obj - The
|
|
9
|
+
* @param obj - The value to stringify
|
|
5
10
|
* @param space - Number of spaces for pretty-printing (optional)
|
|
11
|
+
* @param options - Traversal limits (optional)
|
|
6
12
|
* @returns JSON string representation
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const user = { id: 7 };
|
|
16
|
+
* safeStringify({ actor: user, owner: user });
|
|
17
|
+
* // {"actor":{"id":7},"owner":{"id":7}} — a repeated reference is not a cycle
|
|
18
|
+
*
|
|
19
|
+
* const cyclic: any = {};
|
|
20
|
+
* cyclic.self = cyclic;
|
|
21
|
+
* safeStringify(cyclic); // {"self":"[Circular]"}
|
|
22
|
+
* ```
|
|
7
23
|
*/
|
|
8
|
-
export declare function safeStringify(obj: any, space?: number): string;
|
|
24
|
+
export declare function safeStringify(obj: any, space?: number, options?: SafeStringifyOptions): string;
|
|
9
25
|
/**
|
|
10
26
|
* Filter out sensitive data from an object before logging.
|
|
11
27
|
* @param obj - The object to filter
|
|
@@ -19,4 +35,15 @@ export declare function safeStringify(obj: any, space?: number): string;
|
|
|
19
35
|
* ```
|
|
20
36
|
*/
|
|
21
37
|
export declare function filterSensitiveData(obj: any, sensitiveKeys?: string[]): any;
|
|
38
|
+
/**
|
|
39
|
+
* Serialize Error objects to plain objects for logging.
|
|
40
|
+
* @param error - The error to serialize
|
|
41
|
+
* @returns Serialized error object or original value if not an Error
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const error = new Error('Something went wrong');
|
|
45
|
+
* const serialized = serializeError(error);
|
|
46
|
+
* // Result: { name: 'Error', message: 'Something went wrong', stack: '...' }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
22
49
|
export declare function serializeError(error: any): any;
|
|
@@ -1,11 +1,27 @@
|
|
|
1
|
+
/** Options accepted by {@link safeStringify}. */
|
|
2
|
+
export interface SafeStringifyOptions {
|
|
3
|
+
/** Maximum nesting depth before `'[MaxDepth]'` is emitted. Defaults to 100. */
|
|
4
|
+
maxDepth?: number;
|
|
5
|
+
}
|
|
1
6
|
/**
|
|
2
|
-
* Safely stringify
|
|
7
|
+
* Safely stringify a value to JSON, handling circular references,
|
|
3
8
|
* Error objects, functions, and other non-serializable values.
|
|
4
|
-
* @param obj - The
|
|
9
|
+
* @param obj - The value to stringify
|
|
5
10
|
* @param space - Number of spaces for pretty-printing (optional)
|
|
11
|
+
* @param options - Traversal limits (optional)
|
|
6
12
|
* @returns JSON string representation
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const user = { id: 7 };
|
|
16
|
+
* safeStringify({ actor: user, owner: user });
|
|
17
|
+
* // {"actor":{"id":7},"owner":{"id":7}} — a repeated reference is not a cycle
|
|
18
|
+
*
|
|
19
|
+
* const cyclic: any = {};
|
|
20
|
+
* cyclic.self = cyclic;
|
|
21
|
+
* safeStringify(cyclic); // {"self":"[Circular]"}
|
|
22
|
+
* ```
|
|
7
23
|
*/
|
|
8
|
-
export declare function safeStringify(obj: any, space?: number): string;
|
|
24
|
+
export declare function safeStringify(obj: any, space?: number, options?: SafeStringifyOptions): string;
|
|
9
25
|
/**
|
|
10
26
|
* Filter out sensitive data from an object before logging.
|
|
11
27
|
* @param obj - The object to filter
|
|
@@ -19,4 +35,15 @@ export declare function safeStringify(obj: any, space?: number): string;
|
|
|
19
35
|
* ```
|
|
20
36
|
*/
|
|
21
37
|
export declare function filterSensitiveData(obj: any, sensitiveKeys?: string[]): any;
|
|
38
|
+
/**
|
|
39
|
+
* Serialize Error objects to plain objects for logging.
|
|
40
|
+
* @param error - The error to serialize
|
|
41
|
+
* @returns Serialized error object or original value if not an Error
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const error = new Error('Something went wrong');
|
|
45
|
+
* const serialized = serializeError(error);
|
|
46
|
+
* // Result: { name: 'Error', message: 'Something went wrong', stack: '...' }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
22
49
|
export declare function serializeError(error: any): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "logan-logger",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"packageManager": "pnpm@11.9.0",
|
|
5
5
|
"description": "Universal TypeScript logging library for all JavaScript runtimes",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -105,7 +105,8 @@
|
|
|
105
105
|
"deno",
|
|
106
106
|
"bun",
|
|
107
107
|
"browser",
|
|
108
|
-
"
|
|
108
|
+
"zero-dependencies",
|
|
109
|
+
"structured-logging"
|
|
109
110
|
],
|
|
110
111
|
"author": "Logan Lindquist Land",
|
|
111
112
|
"license": "MIT",
|
|
@@ -120,14 +121,6 @@
|
|
|
120
121
|
"vite-plugin-dts": "^4.5.4",
|
|
121
122
|
"vitest": "^4.1.0"
|
|
122
123
|
},
|
|
123
|
-
"peerDependencies": {
|
|
124
|
-
"winston": "^3.8.0"
|
|
125
|
-
},
|
|
126
|
-
"peerDependenciesMeta": {
|
|
127
|
-
"winston": {
|
|
128
|
-
"optional": true
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
124
|
"engines": {
|
|
132
125
|
"node": "^20.19.0 || >=22.12.0"
|
|
133
126
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=require("./factory-CluPoiZb.cjs").f(((e,t)=>{t.exports={}}));Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return e()}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(){let e=t();return{name:e,version:n(e),capabilities:r(e)}}function t(){return globalThis.Deno===void 0?globalThis.Bun===void 0?typeof window<`u`&&typeof document<`u`?`browser`:typeof globalThis.importScripts==`function`&&typeof window>`u`?`webworker`:typeof process<`u`&&process.versions&&process.versions.node?`node`:`unknown`:`bun`:`deno`}function n(e){switch(e){case`node`:return typeof process<`u`?process.version:void 0;case`deno`:return globalThis.Deno===void 0?void 0:globalThis.Deno.version?.deno;case`bun`:return globalThis.Bun===void 0?void 0:globalThis.Bun.version;case`browser`:return typeof navigator<`u`?navigator.userAgent:void 0;default:return}}function r(e){switch(e){case`node`:return{fileSystem:!0,colorSupport:!0,processInfo:!0,streams:!0};case`deno`:return{fileSystem:!0,colorSupport:!0,processInfo:!0,streams:!0};case`bun`:return{fileSystem:!0,colorSupport:!0,processInfo:!0,streams:!0};case`browser`:return{fileSystem:!1,colorSupport:!0,processInfo:!1,streams:!1};case`webworker`:return{fileSystem:!1,colorSupport:!1,processInfo:!1,streams:!1};default:return{fileSystem:!1,colorSupport:!1,processInfo:!1,streams:!1}}}function i(){return t()===`node`}function a(){return t()===`browser`}function o(){return t()===`deno`}function s(){return t()===`bun`}var c=function(e){return e[e.DEBUG=0]=`DEBUG`,e[e.INFO=1]=`INFO`,e[e.WARN=2]=`WARN`,e[e.ERROR=3]=`ERROR`,e[e.SILENT=4]=`SILENT`,e}({}),l=class{constructor(t={}){this.childMetadata={},this.config=t,this.level=t.level??c.INFO,this.runtime=e().name}debug(e,t){this.log(c.DEBUG,e,t)}info(e,t){this.log(c.INFO,e,t)}warn(e,t){this.log(c.WARN,e,t)}error(e,t){this.log(c.ERROR,e,t)}log(e,t,n){if(!this.shouldLog(e))return;let r=typeof t==`function`?t():t,i={...this.childMetadata,...n},a={timestamp:new Date,level:e,message:r,metadata:Object.keys(i).length>0?i:void 0,runtime:this.runtime};this.writeLog(a)}setLevel(e){this.level=e}getLevel(){return this.level}child(e){let t=this.createChild();return t.childMetadata={...this.childMetadata,...e},t}shouldLog(e){return e>=this.level}};function u(e,t){let n=new WeakSet;return JSON.stringify(e,(e,t)=>{if(typeof t==`object`&&t){if(n.has(t))return`[Circular]`;n.add(t)}return t instanceof Error?m(t):typeof t==`function`?`[Function: ${t.name||`anonymous`}]`:t===void 0?`[undefined]`:typeof t==`bigint`?`[BigInt: ${t.toString()}]`:typeof t==`symbol`?`[Symbol: ${t.toString()}]`:t},t)}function d(e,t=[`password`,`token`,`secret`,`key`,`auth`]){if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let[r,i]of Object.entries(e))n[r]=t.some(e=>r.toLowerCase().includes(e.toLowerCase()))?`[REDACTED]`:typeof i==`object`&&i?d(i,t):i;return n}var f=[`name`,`message`,`stack`];function p(e,t){let n=Object.getOwnPropertyDescriptor(e,t);if(n){if(n.get)try{return n.get.call(e)}catch{return`[Throws]`}return n.value}}function m(e){if(!(e instanceof Error))return e;let t={name:e.name,message:e.message};e.stack!==void 0&&(t.stack=e.stack);for(let n of Object.getOwnPropertyNames(e))f.includes(n)||(t[n]=p(e,n));return t}var h=class e extends l{constructor(e={}){super(e)}writeLog(e){let t=this.formatMessage(e),n=this.getConsoleStyle(e.level),r=`%c${t}${e.metadata?` ${u(e.metadata)}`:``}`;switch(e.level){case c.DEBUG:console.debug?console.debug(r,n):console.log(r,n);break;case c.INFO:console.info(r,n);break;case c.WARN:console.warn(r,n);break;case c.ERROR:console.error(r,n)}}createChild(){return new e(this.config)}formatMessage(e){return`[${e.timestamp.toISOString()}] ${c[e.level].toUpperCase()}: ${e.message}`}getConsoleStyle(e){if(!this.config.colorize)return``;switch(e){case c.DEBUG:return`color: #888; font-weight: normal;`;case c.INFO:return`color: #007acc; font-weight: normal;`;case c.WARN:return`color: #ff8c00; font-weight: bold;`;case c.ERROR:return`color: #dc3545; font-weight: bold;`;default:return``}}shouldLogInProduction(){return(globalThis.process?.env?.NODE_ENV||globalThis.process?.env?.NEXT_PUBLIC_APP_ENV||`development`)!==`production`||this.level<=c.ERROR}shouldLog(e){return!this.shouldLogInProduction()&&e<c.ERROR?!1:super.shouldLog(e)}},g=class extends h{constructor(...e){super(...e),this.groupStack=[]}group(e){console.group(e),this.groupStack.push(e)}groupCollapsed(e){console.groupCollapsed(e),this.groupStack.push(e)}groupEnd(){console.groupEnd(),this.groupStack.pop()}getCurrentGroupStack(){return[...this.groupStack]}getCurrentGroupPath(){return this.groupStack.join(` > `)}time(e){console.time(e)}timeEnd(e){console.timeEnd(e)}trace(e,t){console.trace(e,t)}count(e){console.count(e)}countReset(e){console.countReset(e)}table(e){console.table(e)}},_=class extends h{mark(e){typeof performance<`u`&&performance.mark&&performance.mark(e)}measure(e,t,n){if(typeof performance<`u`&&performance.measure)try{performance.measure(e,t,n);let r=performance.getEntriesByName(e,`measure`);if(r.length>0){let t=r[r.length-1];this.info(`Performance: ${e}`,{duration:t.duration,startTime:t.startTime})}}catch(t){this.warn(`Failed to measure performance`,{name:e,error:t})}}clearMarks(e){typeof performance<`u`&&performance.clearMarks&&performance.clearMarks(e)}clearMeasures(e){typeof performance<`u`&&performance.clearMeasures&&performance.clearMeasures(e)}};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return a}});
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import { a as e, c as t, l as n, s as r, t as i } from "./browser-D5QY2oJb.mjs";
|
|
2
|
-
//#region \0rolldown/runtime.js
|
|
3
|
-
var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescriptor, c = Object.getOwnPropertyNames, l = Object.getPrototypeOf, u = Object.prototype.hasOwnProperty, d = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), f = (e, t, n, r) => {
|
|
4
|
-
if (t && typeof t == "object" || typeof t == "function") for (var i = c(t), a = 0, l = i.length, d; a < l; a++) d = i[a], !u.call(e, d) && d !== n && o(e, d, {
|
|
5
|
-
get: ((e) => t[e]).bind(null, d),
|
|
6
|
-
enumerable: !(r = s(t, d)) || r.enumerable
|
|
7
|
-
});
|
|
8
|
-
return e;
|
|
9
|
-
}, p = (e, t, n) => (n = e == null ? {} : a(l(e)), f(t || !e || !e.__esModule || !u.call(e, "default") ? o(n, "default", {
|
|
10
|
-
value: e,
|
|
11
|
-
enumerable: !0
|
|
12
|
-
}) : n, e)), m = class n extends r {
|
|
13
|
-
constructor(e = {}) {
|
|
14
|
-
super(e), this.initializeWinston();
|
|
15
|
-
}
|
|
16
|
-
async initializeWinston() {
|
|
17
|
-
try {
|
|
18
|
-
let e = await import("winston");
|
|
19
|
-
this.winston = this.createWinstonLogger(e);
|
|
20
|
-
} catch (e) {
|
|
21
|
-
console.warn("[logan-logger] Winston not found, falling back to console logging:", e);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
createWinstonLogger(e) {
|
|
25
|
-
let t = e.format.combine(e.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }), e.format.errors({ stack: !0 }), e.format.json(), e.format.prettyPrint()), n = e.format.combine(e.format.colorize(), e.format.timestamp({ format: "HH:mm:ss" }), e.format.printf(({ timestamp: e, level: t, message: n, ...r }) => `${e} [${t}]: ${n} ${Object.keys(r).length ? JSON.stringify(r, null, 2) : ""}`)), r = e.createLogger({
|
|
26
|
-
level: this.getWinstonLevel(this.level),
|
|
27
|
-
format: t,
|
|
28
|
-
transports: [new e.transports.Console({ format: process.env.NODE_ENV === "production" ? t : n })]
|
|
29
|
-
});
|
|
30
|
-
return process.env.NODE_ENV === "production" && (r.add(new e.transports.File({
|
|
31
|
-
filename: "logs/error.log",
|
|
32
|
-
level: "error",
|
|
33
|
-
maxsize: 5242880,
|
|
34
|
-
maxFiles: 5
|
|
35
|
-
})), r.add(new e.transports.File({
|
|
36
|
-
filename: "logs/combined.log",
|
|
37
|
-
maxsize: 5242880,
|
|
38
|
-
maxFiles: 10
|
|
39
|
-
}))), r;
|
|
40
|
-
}
|
|
41
|
-
writeLog(e) {
|
|
42
|
-
this.winston ? this.winston.log({
|
|
43
|
-
level: this.getWinstonLevel(e.level),
|
|
44
|
-
message: e.message,
|
|
45
|
-
timestamp: e.timestamp,
|
|
46
|
-
...e.metadata
|
|
47
|
-
}) : this.writeToConsole(e);
|
|
48
|
-
}
|
|
49
|
-
createChild() {
|
|
50
|
-
return new n(this.config);
|
|
51
|
-
}
|
|
52
|
-
writeToConsole(n) {
|
|
53
|
-
let r = n.timestamp.toISOString(), i = t[n.level].toLowerCase(), a = n.metadata ? ` ${e(n.metadata)}` : "", o = `[${r}] ${i.toUpperCase()}: ${n.message}${a}`;
|
|
54
|
-
switch (n.level) {
|
|
55
|
-
case t.DEBUG:
|
|
56
|
-
console.debug(o);
|
|
57
|
-
break;
|
|
58
|
-
case t.INFO:
|
|
59
|
-
console.info(o);
|
|
60
|
-
break;
|
|
61
|
-
case t.WARN:
|
|
62
|
-
console.warn(o);
|
|
63
|
-
break;
|
|
64
|
-
case t.ERROR: console.error(o);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
getWinstonLevel(e) {
|
|
68
|
-
switch (e) {
|
|
69
|
-
case t.DEBUG: return "debug";
|
|
70
|
-
case t.INFO: return "info";
|
|
71
|
-
case t.WARN: return "warn";
|
|
72
|
-
case t.ERROR: return "error";
|
|
73
|
-
default: return "info";
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
setLevel(e) {
|
|
77
|
-
super.setLevel(e), this.winston && (this.winston.level = this.getWinstonLevel(e));
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
function h(e) {
|
|
81
|
-
return { write: (t) => {
|
|
82
|
-
e.info(t.trim());
|
|
83
|
-
} };
|
|
84
|
-
}
|
|
85
|
-
//#endregion
|
|
86
|
-
//#region src/utils/config.ts
|
|
87
|
-
function g() {
|
|
88
|
-
let e = n();
|
|
89
|
-
return {
|
|
90
|
-
level: t.INFO,
|
|
91
|
-
format: "text",
|
|
92
|
-
timestamp: !0,
|
|
93
|
-
colorize: e.capabilities.colorSupport,
|
|
94
|
-
metadata: {},
|
|
95
|
-
transports: [{
|
|
96
|
-
type: "console",
|
|
97
|
-
options: {}
|
|
98
|
-
}]
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
function _() {
|
|
102
|
-
let e = {};
|
|
103
|
-
if (typeof process < "u" && process.env) {
|
|
104
|
-
let t = process.env;
|
|
105
|
-
t.LOG_LEVEL && (e.level = S(t.LOG_LEVEL)), t.LOG_FORMAT && ["json", "text"].includes(t.LOG_FORMAT) && (e.format = t.LOG_FORMAT), t.LOG_TIMESTAMP && (e.timestamp = t.LOG_TIMESTAMP.toLowerCase() === "true"), t.LOG_COLOR && (e.colorize = t.LOG_COLOR.toLowerCase() === "true");
|
|
106
|
-
}
|
|
107
|
-
return e;
|
|
108
|
-
}
|
|
109
|
-
async function v(e) {
|
|
110
|
-
let t = n();
|
|
111
|
-
if (!t.capabilities.fileSystem) return {};
|
|
112
|
-
let r = e ? [e] : [
|
|
113
|
-
"logan.config.json",
|
|
114
|
-
"logan.config.js",
|
|
115
|
-
".loganrc",
|
|
116
|
-
"package.json"
|
|
117
|
-
];
|
|
118
|
-
for (let e of r) try {
|
|
119
|
-
if (t.name === "node") return await y(e);
|
|
120
|
-
if (t.name === "deno") return await b(e);
|
|
121
|
-
if (t.name === "bun") return await x(e);
|
|
122
|
-
} catch {}
|
|
123
|
-
return {};
|
|
124
|
-
}
|
|
125
|
-
async function y(e) {
|
|
126
|
-
try {
|
|
127
|
-
let t = await import("./__vite-browser-external-BgoQtmXf.mjs").then((e) => /* @__PURE__ */ p(e.default)), n = await import("./__vite-browser-external-BgoQtmXf.mjs").then((e) => /* @__PURE__ */ p(e.default));
|
|
128
|
-
if (e.endsWith(".json")) {
|
|
129
|
-
let n = await t.readFile(e, "utf-8"), r = JSON.parse(n);
|
|
130
|
-
return e === "package.json" ? r.logan || {} : r;
|
|
131
|
-
}
|
|
132
|
-
if (e.endsWith(".js")) {
|
|
133
|
-
let t = await import(
|
|
134
|
-
/* @vite-ignore */
|
|
135
|
-
`file://${n.resolve(e)}`
|
|
136
|
-
);
|
|
137
|
-
return t.default || t;
|
|
138
|
-
}
|
|
139
|
-
} catch {}
|
|
140
|
-
return {};
|
|
141
|
-
}
|
|
142
|
-
async function b(e) {
|
|
143
|
-
try {
|
|
144
|
-
if (e.endsWith(".json")) {
|
|
145
|
-
let t = await globalThis.Deno.readTextFile(e), n = JSON.parse(t);
|
|
146
|
-
return e === "package.json" ? n.logan || {} : n;
|
|
147
|
-
}
|
|
148
|
-
if (e.endsWith(".js")) {
|
|
149
|
-
let t = await import(
|
|
150
|
-
/* @vite-ignore */
|
|
151
|
-
`./${e}`
|
|
152
|
-
);
|
|
153
|
-
return t.default || t;
|
|
154
|
-
}
|
|
155
|
-
} catch {}
|
|
156
|
-
return {};
|
|
157
|
-
}
|
|
158
|
-
async function x(e) {
|
|
159
|
-
return y(e);
|
|
160
|
-
}
|
|
161
|
-
function S(e) {
|
|
162
|
-
switch (e.toLowerCase()) {
|
|
163
|
-
case "debug": return t.DEBUG;
|
|
164
|
-
case "info": return t.INFO;
|
|
165
|
-
case "warn":
|
|
166
|
-
case "warning": return t.WARN;
|
|
167
|
-
case "error": return t.ERROR;
|
|
168
|
-
case "silent":
|
|
169
|
-
case "none": return t.SILENT;
|
|
170
|
-
default: return t.INFO;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
function C(...e) {
|
|
174
|
-
let t = g();
|
|
175
|
-
return e.reduce((e, t) => ({
|
|
176
|
-
...e,
|
|
177
|
-
...t,
|
|
178
|
-
metadata: {
|
|
179
|
-
...e.metadata,
|
|
180
|
-
...t.metadata
|
|
181
|
-
},
|
|
182
|
-
transports: t.transports || e.transports
|
|
183
|
-
}), t);
|
|
184
|
-
}
|
|
185
|
-
//#endregion
|
|
186
|
-
//#region src/core/factory.ts
|
|
187
|
-
var w = class e {
|
|
188
|
-
static create(t = {}) {
|
|
189
|
-
let r = n(), a = e.mergeConfig(t);
|
|
190
|
-
switch (r.name) {
|
|
191
|
-
case "node": return new m(a);
|
|
192
|
-
case "deno": return new i(a);
|
|
193
|
-
case "bun": return new m(a);
|
|
194
|
-
case "browser":
|
|
195
|
-
case "webworker": return new i(a);
|
|
196
|
-
default: return new i(a);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
static createChild(e, t) {
|
|
200
|
-
return e.child(t);
|
|
201
|
-
}
|
|
202
|
-
static mergeConfig(e) {
|
|
203
|
-
let t = g();
|
|
204
|
-
return {
|
|
205
|
-
...t,
|
|
206
|
-
...e,
|
|
207
|
-
metadata: {
|
|
208
|
-
...t.metadata,
|
|
209
|
-
...e.metadata
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
function T(e) {
|
|
215
|
-
return w.create(e);
|
|
216
|
-
}
|
|
217
|
-
function E() {
|
|
218
|
-
let e = D();
|
|
219
|
-
return T({
|
|
220
|
-
level: O(e),
|
|
221
|
-
colorize: e !== "production",
|
|
222
|
-
timestamp: !0,
|
|
223
|
-
format: e === "production" ? "json" : "text"
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
function D() {
|
|
227
|
-
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";
|
|
228
|
-
}
|
|
229
|
-
function O(e) {
|
|
230
|
-
switch (e) {
|
|
231
|
-
case "production": return t.ERROR;
|
|
232
|
-
case "staging":
|
|
233
|
-
case "test": return t.WARN;
|
|
234
|
-
case "development":
|
|
235
|
-
case "dev": return t.DEBUG;
|
|
236
|
-
default: return t.INFO;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
function k(e) {
|
|
240
|
-
switch (e.toLowerCase()) {
|
|
241
|
-
case "debug": return t.DEBUG;
|
|
242
|
-
case "info": return t.INFO;
|
|
243
|
-
case "warn":
|
|
244
|
-
case "warning": return t.WARN;
|
|
245
|
-
case "error": return t.ERROR;
|
|
246
|
-
case "silent":
|
|
247
|
-
case "none": return t.SILENT;
|
|
248
|
-
default: return t.INFO;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
function A(e) {
|
|
252
|
-
switch (e) {
|
|
253
|
-
case t.DEBUG: return "debug";
|
|
254
|
-
case t.INFO: return "info";
|
|
255
|
-
case t.WARN: return "warn";
|
|
256
|
-
case t.ERROR: return "error";
|
|
257
|
-
case t.SILENT: return "silent";
|
|
258
|
-
default: return "info";
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
//#endregion
|
|
262
|
-
export { k as a, v as c, h as d, d as f, A as i, C as l, T as n, g as o, E as r, _ as s, w as t, m as u };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));const l=require("./browser-Bq67gUmd.cjs");var u=class e extends l.s{constructor(e={}){super(e),this.initializeWinston()}async initializeWinston(){try{let e=await import(`winston`);this.winston=this.createWinstonLogger(e)}catch(e){console.warn(`[logan-logger] Winston not found, falling back to console logging:`,e)}}createWinstonLogger(e){let t=e.format.combine(e.format.timestamp({format:`YYYY-MM-DD HH:mm:ss`}),e.format.errors({stack:!0}),e.format.json(),e.format.prettyPrint()),n=e.format.combine(e.format.colorize(),e.format.timestamp({format:`HH:mm:ss`}),e.format.printf(({timestamp:e,level:t,message:n,...r})=>`${e} [${t}]: ${n} ${Object.keys(r).length?JSON.stringify(r,null,2):``}`)),r=e.createLogger({level:this.getWinstonLevel(this.level),format:t,transports:[new e.transports.Console({format:process.env.NODE_ENV===`production`?t:n})]});return process.env.NODE_ENV===`production`&&(r.add(new e.transports.File({filename:`logs/error.log`,level:`error`,maxsize:5242880,maxFiles:5})),r.add(new e.transports.File({filename:`logs/combined.log`,maxsize:5242880,maxFiles:10}))),r}writeLog(e){this.winston?this.winston.log({level:this.getWinstonLevel(e.level),message:e.message,timestamp:e.timestamp,...e.metadata}):this.writeToConsole(e)}createChild(){return new e(this.config)}writeToConsole(e){let t=e.timestamp.toISOString(),n=l.c[e.level].toLowerCase(),r=e.metadata?` ${l.a(e.metadata)}`:``,i=`[${t}] ${n.toUpperCase()}: ${e.message}${r}`;switch(e.level){case l.c.DEBUG:console.debug(i);break;case l.c.INFO:console.info(i);break;case l.c.WARN:console.warn(i);break;case l.c.ERROR:console.error(i)}}getWinstonLevel(e){switch(e){case l.c.DEBUG:return`debug`;case l.c.INFO:return`info`;case l.c.WARN:return`warn`;case l.c.ERROR:return`error`;default:return`info`}}setLevel(e){super.setLevel(e),this.winston&&(this.winston.level=this.getWinstonLevel(e))}};function d(e){return{write:t=>{e.info(t.trim())}}}function f(){let e=l.l();return{level:l.c.INFO,format:`text`,timestamp:!0,colorize:e.capabilities.colorSupport,metadata:{},transports:[{type:`console`,options:{}}]}}function p(){let e={};if(typeof process<`u`&&process.env){let t=process.env;t.LOG_LEVEL&&(e.level=v(t.LOG_LEVEL)),t.LOG_FORMAT&&[`json`,`text`].includes(t.LOG_FORMAT)&&(e.format=t.LOG_FORMAT),t.LOG_TIMESTAMP&&(e.timestamp=t.LOG_TIMESTAMP.toLowerCase()===`true`),t.LOG_COLOR&&(e.colorize=t.LOG_COLOR.toLowerCase()===`true`)}return e}async function m(e){let t=l.l();if(!t.capabilities.fileSystem)return{};let n=e?[e]:[`logan.config.json`,`logan.config.js`,`.loganrc`,`package.json`];for(let e of n)try{if(t.name===`node`)return await h(e);if(t.name===`deno`)return await g(e);if(t.name===`bun`)return await _(e)}catch{}return{}}async function h(e){try{let t=await Promise.resolve().then(()=>c(require("./__vite-browser-external-Bjj3r6ML.cjs").default)),n=await Promise.resolve().then(()=>c(require("./__vite-browser-external-Bjj3r6ML.cjs").default));if(e.endsWith(`.json`)){let n=await t.readFile(e,`utf-8`),r=JSON.parse(n);return e===`package.json`?r.logan||{}:r}if(e.endsWith(`.js`)){let t=await import(`file://${n.resolve(e)}`);return t.default||t}}catch{}return{}}async function g(e){try{if(e.endsWith(`.json`)){let t=await globalThis.Deno.readTextFile(e),n=JSON.parse(t);return e===`package.json`?n.logan||{}:n}if(e.endsWith(`.js`)){let t=await import(`./${e}`);return t.default||t}}catch{}return{}}async function _(e){return h(e)}function v(e){switch(e.toLowerCase()){case`debug`:return l.c.DEBUG;case`info`:return l.c.INFO;case`warn`:case`warning`:return l.c.WARN;case`error`:return l.c.ERROR;case`silent`:case`none`:return l.c.SILENT;default:return l.c.INFO}}function y(...e){let t=f();return e.reduce((e,t)=>({...e,...t,metadata:{...e.metadata,...t.metadata},transports:t.transports||e.transports}),t)}var b=class e{static create(t={}){let n=l.l(),r=e.mergeConfig(t);switch(n.name){case`node`:return new u(r);case`deno`:return new l.t(r);case`bun`:return new u(r);case`browser`:case`webworker`:return new l.t(r);default:return new l.t(r)}}static createChild(e,t){return e.child(t)}static mergeConfig(e){let t=f();return{...t,...e,metadata:{...t.metadata,...e.metadata}}}};function x(e){return b.create(e)}function S(){let e=C();return x({level:w(e),colorize:e!==`production`,timestamp:!0,format:e===`production`?`json`:`text`})}function C(){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 w(e){switch(e){case`production`:return l.c.ERROR;case`staging`:case`test`:return l.c.WARN;case`development`:case`dev`:return l.c.DEBUG;default:return l.c.INFO}}function T(e){switch(e.toLowerCase()){case`debug`:return l.c.DEBUG;case`info`:return l.c.INFO;case`warn`:case`warning`:return l.c.WARN;case`error`:return l.c.ERROR;case`silent`:case`none`:return l.c.SILENT;default:return l.c.INFO}}function E(e){switch(e){case l.c.DEBUG:return`debug`;case l.c.INFO:return`info`;case l.c.WARN:return`warn`;case l.c.ERROR:return`error`;case l.c.SILENT:return`silent`;default:return`info`}}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return u}});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { a as e, c as t } from "./browser-D5QY2oJb.mjs";
|
|
2
|
-
//#region src/utils/formatting.ts
|
|
3
|
-
function n(n, r = "text") {
|
|
4
|
-
if (r === "json") {
|
|
5
|
-
let r = {
|
|
6
|
-
timestamp: n.timestamp.toISOString(),
|
|
7
|
-
level: t[n.level].toLowerCase(),
|
|
8
|
-
message: n.message,
|
|
9
|
-
runtime: n.runtime
|
|
10
|
-
};
|
|
11
|
-
return n.metadata !== void 0 && (r.metadata = n.metadata), e(r);
|
|
12
|
-
}
|
|
13
|
-
let i = n.timestamp.toISOString(), a = t[n.level].toUpperCase(), o = n.metadata ? ` ${e(n.metadata)}` : "";
|
|
14
|
-
return `[${i}] ${a}: ${n.message}${o}`;
|
|
15
|
-
}
|
|
16
|
-
function r(e, n = !1) {
|
|
17
|
-
let r = t[e].toUpperCase();
|
|
18
|
-
if (!n) return r;
|
|
19
|
-
let i = {
|
|
20
|
-
[t.DEBUG]: "\x1B[36m",
|
|
21
|
-
[t.INFO]: "\x1B[32m",
|
|
22
|
-
[t.WARN]: "\x1B[33m",
|
|
23
|
-
[t.ERROR]: "\x1B[31m",
|
|
24
|
-
[t.SILENT]: "\x1B[37m"
|
|
25
|
-
};
|
|
26
|
-
return `${i[e] || i[t.INFO]}${r}[0m`;
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
|
-
export { n, r as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./browser-Bq67gUmd.cjs");function t(t,n=`text`){if(n===`json`){let n={timestamp:t.timestamp.toISOString(),level:e.c[t.level].toLowerCase(),message:t.message,runtime:t.runtime};return t.metadata!==void 0&&(n.metadata=t.metadata),e.a(n)}let r=t.timestamp.toISOString(),i=e.c[t.level].toUpperCase(),a=t.metadata?` ${e.a(t.metadata)}`:``;return`[${r}] ${i}: ${t.message}${a}`}function n(t,n=!1){let r=e.c[t].toUpperCase();if(!n)return r;let i={[e.c.DEBUG]:`\x1B[36m`,[e.c.INFO]:`\x1B[32m`,[e.c.WARN]:`\x1B[33m`,[e.c.ERROR]:`\x1B[31m`,[e.c.SILENT]:`\x1B[37m`};return`${i[t]||i[e.c.INFO]}${r}[0m`}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
|