@vielzeug/logit 1.1.1 → 1.1.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/README.md CHANGED
@@ -565,7 +565,7 @@ Logit.error('Payment failed:', error); // Errors
565
565
  - Lazy evaluation of timestamp and environment
566
566
  - Async remote logging (Promise-based, non-blocking)
567
567
  - Zero dependencies
568
- - ~3KB gzipped
568
+ - ~2.7KB gzipped
569
569
 
570
570
  ## Browser Support
571
571
 
@@ -576,7 +576,7 @@ Logit.error('Payment failed:', error); // Errors
576
576
 
577
577
  ## License
578
578
 
579
- MIT © [Helmuth Duarte](https://github.com/helmuthdu)
579
+ MIT © [Helmuth Saatkamp](https://github.com/helmuthdu)
580
580
 
581
581
  ## Links
582
582
 
package/dist/index.d.ts CHANGED
@@ -1,170 +1,162 @@
1
+ export declare type ColorType = Exclude<LogType, 'table'> | 'group' | 'ns';
2
+
1
3
  export declare const Logit: {
2
4
  /**
3
- * Asserts a condition and logs an error if it's false.
5
+ * Asserts a condition and logs if false.
6
+ */
7
+ assert: (condition: boolean, message: string, context?: Record<string, unknown>) => void;
8
+ /**
9
+ * Logs a debug message.
10
+ */
11
+ debug: (...args: unknown[]) => void;
12
+ /**
13
+ * Logs an error message.
4
14
  */
5
- assert: (valid: boolean, message: string, context: Record<string, any>) => void;
6
- debug: (...args: any[]) => void;
7
- error: (...args: any[]) => void;
15
+ error: (...args: unknown[]) => void;
8
16
  /**
9
- * Gets whether the environment indicator is shown.
17
+ * Gets environment indicator visibility.
10
18
  */
11
19
  getEnvironment: () => boolean;
12
20
  /**
13
21
  * Gets the current log level.
14
22
  */
15
- getLevel: () => LogitLevel;
23
+ getLevel: () => LogLevel;
16
24
  /**
17
- * Gets the current namespace prefix.
25
+ * Gets the current namespace.
18
26
  */
19
27
  getPrefix: () => string;
20
28
  /**
21
- * Gets whether timestamps are shown.
29
+ * Gets timestamp visibility.
22
30
  */
23
31
  getTimestamp: () => boolean;
24
32
  /**
25
- * Gets the current display variant.
33
+ * Gets the current variant.
26
34
  */
27
- getVariant: () => "text" | "symbol" | "icon";
35
+ getVariant: () => Variant;
28
36
  /**
29
- * Creates a collapsed group in the console.
37
+ * Creates a collapsed console group.
30
38
  */
31
- groupCollapsed: (text: string, label?: string, time?: number) => void;
39
+ groupCollapsed: (text: string, label?: string, startTime?: number) => void;
32
40
  /**
33
41
  * Ends the current console group.
34
42
  */
35
43
  groupEnd: () => void;
36
- info: (...args: any[]) => void;
37
44
  /**
38
- * Creates a scoped logger with a namespaced prefix.
39
- * Does not mutate global state - returns an isolated logger instance.
40
- *
41
- * @param namespace - The namespace to prepend to all log messages
42
- * @returns A scoped logger with all logging methods
45
+ * Logs an info message.
46
+ */
47
+ info: (...args: unknown[]) => void;
48
+ /**
49
+ * Creates a scoped logger with a namespace.
43
50
  *
44
51
  * @example
45
52
  * ```ts
46
53
  * const apiLogger = Logit.scope('api');
47
- * apiLogger.info('Request received'); // [API] Request received
48
- *
49
- * const dbLogger = Logit.scope('database');
50
- * dbLogger.error('Connection failed'); // [DATABASE] Connection failed
54
+ * apiLogger.info('Request received'); // [api] Request received
51
55
  * ```
52
56
  */
53
57
  scope: (namespace: string) => ScopedLogger;
54
58
  /**
55
- * Sets the minimum log level to display.
59
+ * Sets the minimum log level.
56
60
  */
57
- setLogLevel: (level: LogitLevel) => void;
61
+ setLogLevel: (level: LogLevel) => void;
58
62
  /**
59
- * Sets the namespace prefix for all logs.
63
+ * Sets the global namespace prefix.
60
64
  */
61
65
  setPrefix: (namespace: string) => void;
62
66
  /**
63
- * Configures remote logging options.
67
+ * Sets the remote logging options.
64
68
  */
65
- setRemote: (remote: LogitRemoteOptions) => void;
69
+ setRemote: (remote: RemoteOptions) => void;
66
70
  /**
67
- * Sets the log level for remote logging.
71
+ * Sets the remote log level.
68
72
  */
69
- setRemoteLogLevel: (level: LogitLevel) => void;
73
+ setRemoteLogLevel: (level: LogLevel) => void;
70
74
  /**
71
- * Configures Logit with custom options.
75
+ * Configures Logit with options.
72
76
  *
73
- * Note: The remote option will be merged with existing remote config,
74
- * not replaced entirely. To clear a remote handler, set remote.handler to undefined.
77
+ * @example
78
+ * ```ts
79
+ * Logit.setup({
80
+ * logLevel: 'info',
81
+ * variant: 'text',
82
+ * timestamp: false
83
+ * });
84
+ * ```
75
85
  */
76
86
  setup: (options: LogitOptions) => void;
77
87
  /**
78
- * Sets the display variant (text, icon, or symbol).
88
+ * Sets the display variant.
79
89
  */
80
- setVariant: (variant: "text" | "icon" | "symbol") => void;
81
- success: (...args: any[]) => void;
90
+ setVariant: (variant: Variant) => void;
91
+ /**
92
+ * Logs a success message.
93
+ */
94
+ success: (...args: unknown[]) => void;
82
95
  /**
83
96
  * Displays data in a table format.
84
97
  */
85
- table: (...args: any[]) => void;
98
+ table: (...args: unknown[]) => void;
86
99
  /**
87
- * Starts a timer with the given label.
100
+ * Starts a timer.
88
101
  */
89
102
  time: (label: string) => void;
90
103
  /**
91
- * Ends a timer with the given label.
104
+ * Ends a timer.
92
105
  */
93
106
  timeEnd: (label: string) => void;
94
107
  /**
95
- * Toggles or sets the environment indicator visibility.
96
- * When called without arguments, toggles the current state.
97
- *
98
- * @param value - Optional boolean to explicitly set the state
99
- *
100
- * @example
101
- * ```ts
102
- * Logit.toggleEnvironment(); // Toggles current state
103
- * Logit.toggleEnvironment(true); // Shows environment indicator
104
- * Logit.toggleEnvironment(false); // Hides environment indicator
105
- * ```
108
+ * Toggles or sets environment indicator visibility.
106
109
  */
107
110
  toggleEnvironment: (value?: boolean) => void;
108
111
  /**
109
- * Toggles or sets timestamp visibility in logs.
110
- * When called without arguments, toggles the current state.
111
- *
112
- * @param value - Optional boolean to explicitly set the state
113
- *
114
- * @example
115
- * ```ts
116
- * Logit.toggleTimestamp(); // Toggles current state
117
- * Logit.toggleTimestamp(true); // Shows timestamps
118
- * Logit.toggleTimestamp(false); // Hides timestamps
119
- * ```
112
+ * Toggles or sets timestamp visibility.
120
113
  */
121
114
  toggleTimestamp: (value?: boolean) => void;
122
- trace: (...args: any[]) => void;
123
- warn: (...args: any[]) => void;
115
+ /**
116
+ * Logs a trace message.
117
+ */
118
+ trace: (...args: unknown[]) => void;
119
+ /**
120
+ * Logs a warning message.
121
+ */
122
+ warn: (...args: unknown[]) => void;
124
123
  };
125
124
 
126
- export declare type LogitColors = Exclude<LogitType, 'table'> | 'group' | 'ns';
127
-
128
- /** biome-ignore-all lint/suspicious/noAssignInExpressions: - */
129
- /** biome-ignore-all lint/suspicious/noExplicitAny: - */
130
- export declare type LogitInstance = typeof Logit;
131
-
132
- export declare type LogitLevel = LogitType | 'off';
133
-
134
125
  export declare type LogitOptions = {
135
126
  environment?: boolean;
136
- variant?: 'text' | 'symbol' | 'icon';
137
- logLevel?: LogitLevel;
127
+ variant?: Variant;
128
+ logLevel?: LogLevel;
138
129
  namespace?: string;
139
- remote?: LogitRemoteOptions;
130
+ remote?: RemoteOptions;
140
131
  timestamp?: boolean;
141
132
  };
142
133
 
143
- export declare type LogitRemoteOptions = {
144
- handler?: (...args: any[]) => void;
145
- logLevel: LogitLevel;
146
- };
134
+ /** biome-ignore-all lint/suspicious/noExplicitAny: - */
135
+ export declare type LogLevel = 'debug' | 'trace' | 'time' | 'table' | 'info' | 'success' | 'warn' | 'error' | 'off';
147
136
 
148
- export declare type LogitTheme = {
149
- color: string;
150
- bg: string;
151
- border: string;
152
- icon?: string;
153
- symbol?: string;
137
+ export declare type LogType = Exclude<LogLevel, 'off'>;
138
+
139
+ export declare type RemoteLogData = {
140
+ args: unknown[];
141
+ environment: 'production' | 'development';
142
+ namespace?: string;
143
+ timestamp?: string;
154
144
  };
155
145
 
156
- export declare type LogitType = 'debug' | 'trace' | 'time' | 'table' | 'info' | 'success' | 'warn' | 'error';
146
+ export declare type RemoteOptions = {
147
+ handler?: (type: LogType, data: RemoteLogData) => void;
148
+ logLevel?: LogLevel;
149
+ };
157
150
 
158
- /**
159
- * Scoped logger interface with namespaced logging methods.
160
- */
161
151
  export declare type ScopedLogger = {
162
- debug: (...args: any[]) => void;
163
- error: (...args: any[]) => void;
164
- info: (...args: any[]) => void;
165
- success: (...args: any[]) => void;
166
- trace: (...args: any[]) => void;
167
- warn: (...args: any[]) => void;
152
+ debug: (...args: unknown[]) => void;
153
+ error: (...args: unknown[]) => void;
154
+ info: (...args: unknown[]) => void;
155
+ success: (...args: unknown[]) => void;
156
+ trace: (...args: unknown[]) => void;
157
+ warn: (...args: unknown[]) => void;
168
158
  };
169
159
 
160
+ export declare type Variant = 'text' | 'symbol' | 'icon';
161
+
170
162
  export { }
package/dist/logit.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h={},$="🄿",E="🄳",w={debug:"log",success:"log"},L=()=>typeof window<"u"&&h?.NODE_ENV?!1:typeof process<"u"&&process.env?.NODE_ENV?process.env.NODE_ENV==="production":!1,g=L(),_=typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches,u={debug:{bg:"#616161",border:"#424242",color:"#fff",icon:"☕",symbol:"🅳"},error:{bg:"#d32f2f",border:"#c62828",color:"#fff",icon:"✘",symbol:"🅴"},group:{bg:"#546e7a",border:"#455a64",color:"#fff",icon:"⚭",symbol:"🅶"},info:{bg:"#1976d2",border:"#1565c0",color:"#fff",icon:"ℹ",symbol:"🅸"},ns:_?{bg:"#fafafa",border:"#c7c7c7",color:"#000"}:{bg:"#424242",border:"#212121",color:"#fff"},success:{bg:"#689f38",border:"#558b2f",color:"#fff",icon:"✔",symbol:"🆂"},time:{bg:"#0097a7",border:"#00838f",color:"#fff",icon:"⏲",symbol:"🆃"},trace:{bg:"#d81b60",border:"#c2185b",color:"#fff",icon:"⛢",symbol:"🆃"},warn:{bg:"#ffb300",border:"#ffa000",color:"#fff",icon:"⚠",symbol:"🆆"}},m={debug:0,trace:1,time:2,table:3,info:4,success:5,warn:6,error:7,off:8},o={environment:!0,logLevel:"debug",namespace:"",remote:{handler:void 0,logLevel:"off"},timestamp:!0,variant:"symbol"},i=e=>m[o.logLevel]<=m[e],d=()=>new Date().toISOString().slice(11,23),p=()=>g?$:E,x=(e,n)=>{o.remote.handler&&m[o.remote.logLevel]<=m[e]&&Promise.resolve().then(()=>{o.remote.handler?.(e,{args:n,environment:g?"production":"development",namespace:o.namespace||void 0,timestamp:o.timestamp?d():void 0})})},f=e=>w[e]||e,y="border: 1px solid",D="border-radius: 4px",b="border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter; padding: 0 4px;",l=(e,n="")=>{const{bg:r,color:s,border:t}=u[e],c=`${y} ${t}; ${D}`;switch(o.variant){case"symbol":return`color: ${r}; ${c}; padding: 1px 1px 0${n}`;case"icon":return`color: ${r}; ${c}; padding: 0 3px${n}`;default:return`background: ${r}; color: ${s}; ${c}; font-weight: bold; padding: 0 3px${n}`}},v=e=>{const n=u[e],{variant:r}=o;return r==="text"||!n||!n[r]?e.toUpperCase():n[r]};function O(e){const{namespace:n,timestamp:r,environment:s}=o;let t=`%c${v(e)}%c`;const c=[l(e),""];return n&&(t+=` %c${n}%c`,c.push(l("ns",`; ${b}`),"")),s&&(t+=` %c${p()}%c`,c.push("color: darkgray","")),r&&(t+=` %c${d()}%c`,c.push("color: gray","")),{format:t,parts:c}}const a=(e,...n)=>{if(typeof window>"u"){const c=console[f(e)];c(`${v(e)} | ${p()} |`,...n);return}if(!i(e))return;const{format:r,parts:s}=O(e),t=console[f(e)];t(r,...s,...n),x(e,n)},S=e=>{const n=Math.floor(Date.now()-e);return n?`${n}ms`:""},N={assert:(e,n,r)=>console.assert(e,n,r),debug:(...e)=>a("debug",...e),error:(...e)=>a("error",...e),getEnvironment:()=>o.environment,getLevel:()=>o.logLevel,getPrefix:()=>o.namespace,getTimestamp:()=>o.timestamp,getVariant:()=>o.variant,groupCollapsed:(e,n="GROUP",r=Date.now())=>{if(!i("success"))return;const s=S(r),t=p(),c=o.timestamp?d():"";console.groupCollapsed(`%c${n}%c${o.namespace}%c${t}%c${c}%c${s}%c${e}`,l("group","; margin-right: 6px; padding: 1px 3px 0"),l("ns",`; ${b}; margin-right: 6px`),"color: darkgray; margin-right: 6px","color: gray; font-weight: lighter; margin-right: 6px","color: gray; font-weight: lighter; margin-right: 6px","color: inherit; font-weight: lighter")},groupEnd:()=>{i("success")&&console.groupEnd()},info:(...e)=>a("info",...e),scope:e=>{const n=o.namespace,r=n?`${n}.${e}`:e;return{debug:(...s)=>{const t=o.namespace;o.namespace=r,a("debug",...s),o.namespace=t},error:(...s)=>{const t=o.namespace;o.namespace=r,a("error",...s),o.namespace=t},info:(...s)=>{const t=o.namespace;o.namespace=r,a("info",...s),o.namespace=t},success:(...s)=>{const t=o.namespace;o.namespace=r,a("success",...s),o.namespace=t},trace:(...s)=>{const t=o.namespace;o.namespace=r,a("trace",...s),o.namespace=t},warn:(...s)=>{const t=o.namespace;o.namespace=r,a("warn",...s),o.namespace=t}}},setLogLevel:e=>{o.logLevel=e},setPrefix:e=>{o.namespace=e},setRemote:e=>{o.remote=e},setRemoteLogLevel:e=>{o.remote.logLevel=e},setup:e=>{e.remote&&(o.remote={...o.remote,...e.remote},delete e.remote),Object.assign(o,e)},setVariant:e=>{o.variant=e},success:(...e)=>a("success",...e),table:(...e)=>{i("table")&&console.table(...e)},time:e=>{i("time")&&console.time(e)},timeEnd:e=>{i("time")&&console.timeEnd(e)},toggleEnvironment:e=>{o.environment=e??!o.environment},toggleTimestamp:e=>{o.timestamp=e??!o.timestamp},trace:(...e)=>a("trace",...e),warn:(...e)=>a("warn",...e)};exports.Logit=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $={},w="🅿",E="🅳",L={debug:"log",success:"log"},l={debug:0,trace:1,time:2,table:3,info:4,success:5,warn:6,error:7,off:8},_=typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches,p={debug:{bg:"#616161",border:"#424242",color:"#fff",icon:"☕",symbol:"🅳"},error:{bg:"#d32f2f",border:"#c62828",color:"#fff",icon:"✘",symbol:"🅴"},group:{bg:"#546e7a",border:"#455a64",color:"#fff",icon:"⚭",symbol:"🅶"},info:{bg:"#1976d2",border:"#1565c0",color:"#fff",icon:"ℹ",symbol:"🅸"},ns:_?{bg:"#fafafa",border:"#c7c7c7",color:"#000"}:{bg:"#424242",border:"#212121",color:"#fff"},success:{bg:"#689f38",border:"#558b2f",color:"#fff",icon:"✔",symbol:"🆂"},time:{bg:"#0097a7",border:"#00838f",color:"#fff",icon:"⏲",symbol:"🆃"},trace:{bg:"#d81b60",border:"#c2185b",color:"#fff",icon:"⛢",symbol:"🆃"},warn:{bg:"#ffb300",border:"#ffa000",color:"#fff",icon:"⚠",symbol:"🆆"}},b="border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter; padding: 0 4px;";function x(){return typeof window<"u"&&$?.NODE_ENV==="production"?!0:typeof process<"u"&&process.env?.NODE_ENV==="production"}const v=x(),o={environment:!0,logLevel:"debug",namespace:"",remote:{handler:void 0,logLevel:"off"},timestamp:!0,variant:"symbol"};function a(e){return l[o.logLevel]<=l[e]}function g(){return new Date().toISOString().slice(11,23)}function d(){return v?w:E}function O(e,t){const{handler:r,logLevel:n}=o.remote;r&&l[n]<=l[e]&&Promise.resolve().then(()=>{r(e,{args:t,environment:v?"production":"development",namespace:o.namespace||void 0,timestamp:o.timestamp?g():void 0})})}function u(e){return L[e]||e}function f(e,t=""){const{bg:r,color:n,border:s}=p[e],c=`border: 1px solid ${s}; border-radius: 4px`;switch(o.variant){case"symbol":case"icon":return`color: ${r}; ${c}; padding: 0 3px${t}`;default:return`background: ${r}; color: ${n}; ${c}; font-weight: bold; padding: 0 3px${t}`}}function h(e){if(e==="table")return e.toUpperCase();const t=p[e],{variant:r}=o;return r==="text"||!t[r]?e.toUpperCase():t[r]}function y(e){const{namespace:t,timestamp:r,environment:n}=o;let s=`%c${h(e)}%c`;const c=[f(e),""];return t&&(s+=` %c${t}%c`,c.push(f("ns",`; ${b}`),"")),n&&(s+=` %c${d()}%c`,c.push("color: darkgray","")),r&&(s+=` %c${g()}%c`,c.push("color: gray","")),{format:s,parts:c}}function i(e,...t){if(typeof window>"u"){const c=console[u(e)];c(`${h(e)} | ${d()} |`,...t);return}if(!a(e))return;const{format:r,parts:n}=y(e),s=console[u(e)];s(r,...n,...t),O(e,t)}function P(e){const t=o.namespace,r=t?`${t}.${e}`:e,n=s=>(...c)=>{const m=o.namespace;o.namespace=r,i(s,...c),o.namespace=m};return{debug:n("debug"),error:n("error"),info:n("info"),success:n("success"),trace:n("trace"),warn:n("warn")}}const S={assert:(e,t,r)=>{console.assert(e,t,r)},debug:(...e)=>i("debug",...e),error:(...e)=>i("error",...e),getEnvironment:()=>o.environment,getLevel:()=>o.logLevel,getPrefix:()=>o.namespace,getTimestamp:()=>o.timestamp,getVariant:()=>o.variant,groupCollapsed:(e,t="GROUP",r=Date.now())=>{if(!a("success"))return;const n=Date.now()-r,s=n?`${n}ms`:"",c=d(),m=o.timestamp?g():"";console.groupCollapsed(`%c${t}%c${o.namespace}%c${c}%c${m}%c${s}%c${e}`,f("group","; margin-right: 6px; padding: 1px 3px 0"),f("ns",`; ${b}; margin-right: 6px`),"color: darkgray; margin-right: 6px","color: gray; font-weight: lighter; margin-right: 6px","color: gray; font-weight: lighter; margin-right: 6px","color: inherit; font-weight: lighter")},groupEnd:()=>{a("success")&&console.groupEnd()},info:(...e)=>i("info",...e),scope:e=>P(e),setLogLevel:e=>{o.logLevel=e},setPrefix:e=>{o.namespace=e},setRemote:e=>{o.remote={...o.remote,...e}},setRemoteLogLevel:e=>{o.remote.logLevel=e},setup:e=>{if(e.remote){o.remote={...o.remote,...e.remote};const{remote:t,...r}=e;Object.assign(o,r)}else Object.assign(o,e)},setVariant:e=>{o.variant=e},success:(...e)=>i("success",...e),table:(...e)=>{a("table")&&console.table(...e)},time:e=>{a("time")&&console.time(e)},timeEnd:e=>{a("time")&&console.timeEnd(e)},toggleEnvironment:e=>{o.environment=e??!o.environment},toggleTimestamp:e=>{o.timestamp=e??!o.timestamp},trace:(...e)=>i("trace",...e),warn:(...e)=>i("warn",...e)};exports.Logit=S;
2
2
  //# sourceMappingURL=logit.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"logit.cjs","sources":["../src/logit.ts"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noAssignInExpressions: - */\n/** biome-ignore-all lint/suspicious/noExplicitAny: - */\n\n/**\n * Environment indicator symbols.\n */\nconst ENV_PROD = '\\uD83C\\uDD3F'; // 🅿\nconst ENV_DEV = '\\uD83C\\uDD33'; // 🅳\n\n/**\n * Console method mappings for log types.\n */\nconst CONSOLE_METHOD_MAP: Record<string, keyof Console> = {\n debug: 'log',\n success: 'log',\n} as const;\n\n/**\n * Checks if the current environment is production.\n * Cached for performance - evaluated once at a module load.\n *\n * Note: import.meta.env is available in Vite/Bundlers but may be undefined in some environments.\n * Using 'any' cast is necessary for cross-environment compatibility.\n */\nconst isProduction = (): boolean => {\n // Browser environment (Vite, Webpack, etc.)\n // import.meta.env may be undefined in some bundlers - safe check with optional chaining\n if (typeof window !== 'undefined' && (import.meta as any)?.env?.NODE_ENV) {\n return (import.meta as any).env.NODE_ENV === 'production';\n }\n\n // Node.js environment\n // @ts-expect-error - process.env exists in Node.js but not in browser\n if (typeof process !== 'undefined' && (process as any).env?.NODE_ENV) {\n // @ts-expect-error - process.env exists in Node.js\n return (process as any).env.NODE_ENV === 'production';\n }\n\n return false;\n};\n\n// Cache the result to avoid repeated checks\nconst IS_PROD = isProduction();\n\nexport type LogitInstance = typeof Logit;\nexport type LogitType = 'debug' | 'trace' | 'time' | 'table' | 'info' | 'success' | 'warn' | 'error';\nexport type LogitColors = Exclude<LogitType, 'table'> | 'group' | 'ns';\nexport type LogitLevel = LogitType | 'off';\nexport type LogitRemoteOptions = {\n handler?: (...args: any[]) => void;\n logLevel: LogitLevel;\n};\nexport type LogitOptions = {\n environment?: boolean;\n variant?: 'text' | 'symbol' | 'icon';\n logLevel?: LogitLevel;\n namespace?: string;\n remote?: LogitRemoteOptions;\n timestamp?: boolean;\n};\nexport type LogitTheme = { color: string; bg: string; border: string; icon?: string; symbol?: string };\n\n/**\n * Scoped logger interface with namespaced logging methods.\n */\nexport type ScopedLogger = {\n debug: (...args: any[]) => void;\n error: (...args: any[]) => void;\n info: (...args: any[]) => void;\n success: (...args: any[]) => void;\n trace: (...args: any[]) => void;\n warn: (...args: any[]) => void;\n};\n\n/**\n * Detects dark mode preference at module load time.\n * Note: This is intentionally static and won't update if the user changes their theme.\n */\nconst isDark = typeof window !== 'undefined' && window.matchMedia?.('(prefers-color-scheme: dark)').matches;\n\nconst Theme: Readonly<Record<LogitColors, LogitTheme>> = {\n debug: { bg: '#616161', border: '#424242', color: '#fff', icon: '\\u2615', symbol: '\\uD83C\\uDD73' },\n error: { bg: '#d32f2f', border: '#c62828', color: '#fff', icon: '\\u2718', symbol: '\\uD83C\\uDD74' },\n group: { bg: '#546e7a', border: '#455a64', color: '#fff', icon: '\\u26AD', symbol: '\\uD83C\\uDD76' },\n info: { bg: '#1976d2', border: '#1565c0', color: '#fff', icon: '\\u2139', symbol: '\\uD83C\\uDD78' },\n ns: isDark\n ? { bg: '#fafafa', border: '#c7c7c7', color: '#000' }\n : { bg: '#424242', border: '#212121', color: '#fff' },\n success: { bg: '#689f38', border: '#558b2f', color: '#fff', icon: '\\u2714', symbol: '\\uD83C\\uDD82' },\n time: { bg: '#0097a7', border: '#00838f', color: '#fff', icon: '\\u23F2', symbol: '\\uD83C\\uDD83' },\n trace: { bg: '#d81b60', border: '#c2185b', color: '#fff', icon: '\\u26e2', symbol: '\\uD83C\\uDD83' },\n warn: { bg: '#ffb300', border: '#ffa000', color: '#fff', icon: '\\u26a0', symbol: '\\uD83C\\uDD86' },\n};\n\n// biome-ignore assist/source/useSortedKeys: -\nconst logLevel: Readonly<Record<LogitLevel, number>> = {\n debug: 0,\n trace: 1,\n time: 2,\n table: 3,\n info: 4,\n success: 5,\n warn: 6,\n error: 7,\n off: 8,\n};\n\nconst state: Required<LogitOptions> = {\n environment: true,\n logLevel: 'debug',\n namespace: '',\n remote: { handler: undefined, logLevel: 'off' },\n timestamp: true,\n variant: 'symbol',\n};\n\n/**\n * Determines if a log message should be shown based on the current log level.\n */\nconst shouldLog = (type: LogitType): boolean => logLevel[state.logLevel] <= logLevel[type];\n\n/**\n * Gets the current timestamp in ISO format (HH:MM:SS.mmm).\n */\nconst getCurrentTimestamp = (): string => new Date().toISOString().slice(11, 23);\n\n/**\n * Gets the environment indicator symbol.\n */\nconst getEnvIndicator = (): string => (IS_PROD ? ENV_PROD : ENV_DEV);\n\n/**\n * Sends log data to a remote handler if configured.\n */\nconst sendRemoteLog = (type: LogitType, args: any[]): void => {\n if (state.remote.handler && logLevel[state.remote.logLevel] <= logLevel[type]) {\n Promise.resolve().then(() => {\n state.remote.handler?.(type, {\n args,\n environment: IS_PROD ? 'production' : 'development',\n namespace: state.namespace || undefined,\n timestamp: state.timestamp ? getCurrentTimestamp() : undefined,\n });\n });\n }\n};\n\n/**\n * Gets the console method for a given log type.\n */\nconst getConsoleMethod = (type: LogitType): keyof Console => {\n return (CONSOLE_METHOD_MAP[type] || type) as keyof Console;\n};\n\n/**\n * CSS style constants for consistent formatting.\n */\nconst BASE_BORDER_STYLE = 'border: 1px solid';\nconst BASE_BORDER_RADIUS = 'border-radius: 4px';\nconst NAMESPACE_STYLE = 'border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter; padding: 0 4px;';\n\n/**\n * Generates CSS styles for log messages based on theme and variant.\n *\n * @param type - Log type color scheme\n * @param extra - Additional CSS to append (should include leading semicolon if needed)\n */\nconst style = (type: LogitColors, extra = ''): string => {\n const { bg, color, border } = Theme[type];\n const baseStyle = `${BASE_BORDER_STYLE} ${border}; ${BASE_BORDER_RADIUS}`;\n\n switch (state.variant) {\n case 'symbol':\n // Symbol variant: colored text on a transparent background\n return `color: ${bg}; ${baseStyle}; padding: 1px 1px 0${extra}`;\n case 'icon':\n // Icon variant: colored text on a transparent background\n return `color: ${bg}; ${baseStyle}; padding: 0 3px${extra}`;\n default:\n // Text variant: white text on a colored background\n return `background: ${bg}; color: ${color}; ${baseStyle}; font-weight: bold; padding: 0 3px${extra}`;\n }\n};\n\n/**\n * Gets the display value for a log type based on the current variant.\n */\nconst getDisplayValue = (type: LogitType): string => {\n const theme = Theme[type as LogitColors];\n const { variant } = state;\n\n // For 'text' variant or if the variant property doesn't exist in theme, use uppercase type\n if (variant === 'text' || !theme || !theme[variant]) {\n return type.toUpperCase();\n }\n\n return theme[variant] as string;\n};\n\n/**\n * Builds the format string and style parts for browser console logging.\n */\nfunction buildBrowserLogParts(type: LogitType): { format: string; parts: string[] } {\n const { namespace, timestamp, environment } = state;\n\n let format = `%c${getDisplayValue(type)}%c`;\n const parts: string[] = [style(type as LogitColors), ''];\n\n if (namespace) {\n format += ` %c${namespace}%c`;\n parts.push(style('ns', `; ${NAMESPACE_STYLE}`), '');\n }\n\n if (environment) {\n format += ` %c${getEnvIndicator()}%c`;\n parts.push('color: darkgray', '');\n }\n\n if (timestamp) {\n format += ` %c${getCurrentTimestamp()}%c`;\n parts.push('color: gray', '');\n }\n\n return { format, parts };\n}\n\n/**\n * Logs messages to the console with styling and metadata.\n */\nconst log = (type: LogitType, ...args: any[]): void => {\n // Server-side logging (Node.js)\n if (typeof window === 'undefined') {\n const consoleMethod = console[getConsoleMethod(type)] as (...a: any[]) => void;\n consoleMethod(`${getDisplayValue(type)} | ${getEnvIndicator()} |`, ...args);\n return;\n }\n\n // Check the log level\n if (!shouldLog(type)) return;\n\n // Browser-side logging with styling\n const { format, parts } = buildBrowserLogParts(type);\n const consoleMethod = console[getConsoleMethod(type)] as (...a: any[]) => void;\n\n consoleMethod(format, ...parts, ...args);\n sendRemoteLog(type, args);\n};\n\n/**\n * Formats the elapsed time for display.\n */\nconst formatElapsedTime = (startTime: number): string => {\n const elapsed = Math.floor(Date.now() - startTime);\n return elapsed ? `${elapsed}ms` : '';\n};\n\nexport const Logit = {\n /**\n * Asserts a condition and logs an error if it's false.\n */\n assert: (valid: boolean, message: string, context: Record<string, any>): void =>\n console.assert(valid, message, context),\n\n debug: (...args: any[]): void => log('debug', ...args),\n error: (...args: any[]): void => log('error', ...args),\n\n /**\n * Gets whether the environment indicator is shown.\n */\n getEnvironment: (): boolean => state.environment,\n\n /**\n * Gets the current log level.\n */\n getLevel: (): LogitLevel => state.logLevel,\n\n /**\n * Gets the current namespace prefix.\n */\n getPrefix: (): string => state.namespace,\n\n /**\n * Gets whether timestamps are shown.\n */\n getTimestamp: (): boolean => state.timestamp,\n\n /**\n * Gets the current display variant.\n */\n getVariant: (): 'text' | 'symbol' | 'icon' => state.variant,\n\n /**\n * Creates a collapsed group in the console.\n */\n groupCollapsed: (text: string, label = 'GROUP', time = Date.now()): void => {\n if (!shouldLog('success')) return;\n\n const elapsed = formatElapsedTime(time);\n const env = getEnvIndicator();\n const timestamp = state.timestamp ? getCurrentTimestamp() : '';\n\n console.groupCollapsed(\n `%c${label}%c${state.namespace}%c${env}%c${timestamp}%c${elapsed}%c${text}`,\n style('group', '; margin-right: 6px; padding: 1px 3px 0'),\n style('ns', `; ${NAMESPACE_STYLE}; margin-right: 6px`),\n 'color: darkgray; margin-right: 6px',\n 'color: gray; font-weight: lighter; margin-right: 6px',\n 'color: gray; font-weight: lighter; margin-right: 6px',\n 'color: inherit; font-weight: lighter',\n );\n },\n\n /**\n * Ends the current console group.\n */\n groupEnd: (): void => {\n if (shouldLog('success')) console.groupEnd();\n },\n\n info: (...args: any[]): void => log('info', ...args),\n\n /**\n * Creates a scoped logger with a namespaced prefix.\n * Does not mutate global state - returns an isolated logger instance.\n *\n * @param namespace - The namespace to prepend to all log messages\n * @returns A scoped logger with all logging methods\n *\n * @example\n * ```ts\n * const apiLogger = Logit.scope('api');\n * apiLogger.info('Request received'); // [API] Request received\n *\n * const dbLogger = Logit.scope('database');\n * dbLogger.error('Connection failed'); // [DATABASE] Connection failed\n * ```\n */\n scope: (namespace: string): ScopedLogger => {\n const originalNamespace = state.namespace;\n const scopedNamespace = originalNamespace ? `${originalNamespace}.${namespace}` : namespace;\n\n return {\n debug: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('debug', ...args);\n state.namespace = prev;\n },\n error: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('error', ...args);\n state.namespace = prev;\n },\n info: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('info', ...args);\n state.namespace = prev;\n },\n success: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('success', ...args);\n state.namespace = prev;\n },\n trace: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('trace', ...args);\n state.namespace = prev;\n },\n warn: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('warn', ...args);\n state.namespace = prev;\n },\n };\n },\n\n /**\n * Sets the minimum log level to display.\n */\n setLogLevel: (level: LogitLevel): void => {\n state.logLevel = level;\n },\n\n /**\n * Sets the namespace prefix for all logs.\n */\n setPrefix: (namespace: string): void => {\n state.namespace = namespace;\n },\n\n /**\n * Configures remote logging options.\n */\n setRemote: (remote: LogitRemoteOptions): void => {\n state.remote = remote;\n },\n\n /**\n * Sets the log level for remote logging.\n */\n setRemoteLogLevel: (level: LogitLevel): void => {\n state.remote.logLevel = level;\n },\n\n /**\n * Configures Logit with custom options.\n *\n * Note: The remote option will be merged with existing remote config,\n * not replaced entirely. To clear a remote handler, set remote.handler to undefined.\n */\n setup: (options: LogitOptions): void => {\n if (options.remote) {\n state.remote = { ...state.remote, ...options.remote };\n delete (options as any).remote; // Remove to avoid Object.assign overwrite\n }\n Object.assign(state, options);\n },\n\n /**\n * Sets the display variant (text, icon, or symbol).\n */\n setVariant: (variant: 'text' | 'icon' | 'symbol'): void => {\n state.variant = variant;\n },\n\n success: (...args: any[]): void => log('success', ...args),\n\n /**\n * Displays data in a table format.\n */\n table: (...args: any[]): void => {\n if (shouldLog('table')) console.table(...args);\n },\n\n /**\n * Starts a timer with the given label.\n */\n time: (label: string): void => {\n if (shouldLog('time')) console.time(label);\n },\n\n /**\n * Ends a timer with the given label.\n */\n timeEnd: (label: string): void => {\n if (shouldLog('time')) console.timeEnd(label);\n },\n\n /**\n * Toggles or sets the environment indicator visibility.\n * When called without arguments, toggles the current state.\n *\n * @param value - Optional boolean to explicitly set the state\n *\n * @example\n * ```ts\n * Logit.toggleEnvironment(); // Toggles current state\n * Logit.toggleEnvironment(true); // Shows environment indicator\n * Logit.toggleEnvironment(false); // Hides environment indicator\n * ```\n */\n toggleEnvironment: (value?: boolean): void => {\n state.environment = value ?? !state.environment;\n },\n\n /**\n * Toggles or sets timestamp visibility in logs.\n * When called without arguments, toggles the current state.\n *\n * @param value - Optional boolean to explicitly set the state\n *\n * @example\n * ```ts\n * Logit.toggleTimestamp(); // Toggles current state\n * Logit.toggleTimestamp(true); // Shows timestamps\n * Logit.toggleTimestamp(false); // Hides timestamps\n * ```\n */\n toggleTimestamp: (value?: boolean): void => {\n state.timestamp = value ?? !state.timestamp;\n },\n\n trace: (...args: any[]): void => log('trace', ...args),\n warn: (...args: any[]): void => log('warn', ...args),\n};\n"],"names":["ENV_PROD","ENV_DEV","CONSOLE_METHOD_MAP","isProduction","__vite_import_meta_env__","IS_PROD","isDark","Theme","logLevel","state","shouldLog","type","getCurrentTimestamp","getEnvIndicator","sendRemoteLog","args","getConsoleMethod","BASE_BORDER_STYLE","BASE_BORDER_RADIUS","NAMESPACE_STYLE","style","extra","bg","color","border","baseStyle","getDisplayValue","theme","variant","buildBrowserLogParts","namespace","timestamp","environment","format","parts","log","consoleMethod","formatElapsedTime","startTime","elapsed","Logit","valid","message","context","text","label","time","env","originalNamespace","scopedNamespace","prev","level","remote","options","value"],"mappings":"2FAMMA,EAAW,KACXC,EAAU,KAKVC,EAAoD,CACxD,MAAO,MACP,QAAS,KACX,EASMC,EAAe,IAGf,OAAO,OAAW,KAAgBC,GAA0B,SACtD,GAKN,OAAO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QAAS,GAAGpB,CAAI,EACrD,KAAM,IAAIA,IAAsBoB,EAAI,OAAQ,GAAGpB,CAAI,CACrD"}
1
+ {"version":3,"file":"logit.cjs","sources":["../src/logit.ts"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noExplicitAny: - */\n\n/* -------------------- Core Types -------------------- */\n\nexport type LogLevel = 'debug' | 'trace' | 'time' | 'table' | 'info' | 'success' | 'warn' | 'error' | 'off';\nexport type LogType = Exclude<LogLevel, 'off'>;\nexport type ColorType = Exclude<LogType, 'table'> | 'group' | 'ns';\nexport type Variant = 'text' | 'symbol' | 'icon';\n\nexport type RemoteOptions = {\n handler?: (type: LogType, data: RemoteLogData) => void;\n logLevel?: LogLevel;\n};\n\nexport type RemoteLogData = {\n args: unknown[];\n environment: 'production' | 'development';\n namespace?: string;\n timestamp?: string;\n};\n\nexport type LogitOptions = {\n environment?: boolean;\n variant?: Variant;\n logLevel?: LogLevel;\n namespace?: string;\n remote?: RemoteOptions;\n timestamp?: boolean;\n};\n\nexport type ScopedLogger = {\n debug: (...args: unknown[]) => void;\n error: (...args: unknown[]) => void;\n info: (...args: unknown[]) => void;\n success: (...args: unknown[]) => void;\n trace: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n};\n\n/* -------------------- Constants -------------------- */\n\nconst ENV_PROD = '🅿';\nconst ENV_DEV = '🅳';\n\nconst CONSOLE_METHOD_MAP: Partial<Record<LogType, keyof Console>> = {\n debug: 'log',\n success: 'log',\n};\n\n// biome-ignore assist/source/useSortedKeys: -\nconst LOG_LEVEL_PRIORITY: Record<LogLevel, number> = {\n debug: 0,\n trace: 1,\n time: 2,\n table: 3,\n info: 4,\n success: 5,\n warn: 6,\n error: 7,\n off: 8,\n};\n\n/* -------------------- Theme & Styles -------------------- */\n\ntype Theme = {\n color: string;\n bg: string;\n border: string;\n icon?: string;\n symbol?: string;\n};\n\nconst isDarkMode = typeof window !== 'undefined' && window.matchMedia?.('(prefers-color-scheme: dark)').matches;\n\nconst THEME: Record<ColorType, Theme> = {\n debug: { bg: '#616161', border: '#424242', color: '#fff', icon: '☕', symbol: '🅳' },\n error: { bg: '#d32f2f', border: '#c62828', color: '#fff', icon: '✘', symbol: '🅴' },\n group: { bg: '#546e7a', border: '#455a64', color: '#fff', icon: '⚭', symbol: '🅶' },\n info: { bg: '#1976d2', border: '#1565c0', color: '#fff', icon: 'ℹ', symbol: '🅸' },\n ns: isDarkMode\n ? { bg: '#fafafa', border: '#c7c7c7', color: '#000' }\n : { bg: '#424242', border: '#212121', color: '#fff' },\n success: { bg: '#689f38', border: '#558b2f', color: '#fff', icon: '✔', symbol: '🆂' },\n time: { bg: '#0097a7', border: '#00838f', color: '#fff', icon: '⏲', symbol: '🆃' },\n trace: { bg: '#d81b60', border: '#c2185b', color: '#fff', icon: '⛢', symbol: '🆃' },\n warn: { bg: '#ffb300', border: '#ffa000', color: '#fff', icon: '⚠', symbol: '🆆' },\n};\n\nconst NAMESPACE_STYLE = 'border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter; padding: 0 4px;';\n\n/* -------------------- Environment Detection -------------------- */\n\n/**\n * Detects if running in a production environment.\n * Checks both browser (import.meta.env) and Node.js (process.env).\n */\nfunction isProduction(): boolean {\n // Browser environment (Vite, Webpack, etc.)\n if (typeof window !== 'undefined' && (import.meta as any)?.env?.NODE_ENV === 'production') {\n return true;\n }\n\n // @ts-expect-error - process.env exists in Node.js but not in a browser\n return typeof process !== 'undefined' && (process as any).env?.NODE_ENV === 'production';\n}\n\nconst IS_PROD = isProduction();\n\n/* -------------------- State -------------------- */\n\nconst state: Required<LogitOptions> & { remote: Required<RemoteOptions> } = {\n environment: true,\n logLevel: 'debug',\n namespace: '',\n remote: { handler: undefined as any, logLevel: 'off' },\n timestamp: true,\n variant: 'symbol',\n};\n\n/* -------------------- Helper Functions -------------------- */\n\n/**\n * Checks if a log should be displayed based on the current log level.\n */\nfunction shouldLog(type: LogType): boolean {\n return LOG_LEVEL_PRIORITY[state.logLevel] <= LOG_LEVEL_PRIORITY[type];\n}\n\n/**\n * Gets the current timestamp in HH:MM:SS.mmm format.\n */\nfunction getTimestamp(): string {\n return new Date().toISOString().slice(11, 23);\n}\n\n/**\n * Gets environment indicator emoji.\n */\nfunction getEnvIndicator(): string {\n return IS_PROD ? ENV_PROD : ENV_DEV;\n}\n\n/**\n * Sends log to remote handler if configured.\n */\nfunction sendRemote(type: LogType, args: unknown[]): void {\n const { handler, logLevel } = state.remote;\n\n if (handler && LOG_LEVEL_PRIORITY[logLevel] <= LOG_LEVEL_PRIORITY[type]) {\n // Use microtask to make async without setTimeout overhead\n Promise.resolve().then(() => {\n handler(type, {\n args,\n environment: IS_PROD ? 'production' : 'development',\n namespace: state.namespace || undefined,\n timestamp: state.timestamp ? getTimestamp() : undefined,\n });\n });\n }\n}\n\n/**\n * Gets the console method for a log type.\n */\nfunction getConsoleMethod(type: LogType): keyof Console {\n return (CONSOLE_METHOD_MAP[type] || type) as keyof Console;\n}\n\n/**\n * Generates CSS style for a log type.\n */\nfunction getStyle(type: ColorType, extra = ''): string {\n const { bg, color, border } = THEME[type];\n const baseStyle = `border: 1px solid ${border}; border-radius: 4px`;\n\n switch (state.variant) {\n case 'symbol':\n case 'icon':\n return `color: ${bg}; ${baseStyle}; padding: 0 3px${extra}`;\n default:\n return `background: ${bg}; color: ${color}; ${baseStyle}; font-weight: bold; padding: 0 3px${extra}`;\n }\n}\n\n/**\n * Gets display value for a log type based on variant.\n */\nfunction getDisplayValue(type: LogType): string {\n // Table doesn't have a theme, return uppercase\n if (type === 'table') {\n return type.toUpperCase();\n }\n\n const theme = THEME[type as ColorType];\n const { variant } = state;\n\n if (variant === 'text' || !theme[variant]) {\n return type.toUpperCase();\n }\n\n return theme[variant]!;\n}\n\n/**\n * Builds browser console format string and style parts.\n */\nfunction buildLogParts(type: LogType): { format: string; parts: string[] } {\n const { namespace, timestamp, environment } = state;\n\n let format = `%c${getDisplayValue(type)}%c`;\n // Table doesn't have styling, but this is only called for types that do\n const parts: string[] = [getStyle(type as ColorType), ''];\n\n if (namespace) {\n format += ` %c${namespace}%c`;\n parts.push(getStyle('ns', `; ${NAMESPACE_STYLE}`), '');\n }\n\n if (environment) {\n format += ` %c${getEnvIndicator()}%c`;\n parts.push('color: darkgray', '');\n }\n\n if (timestamp) {\n format += ` %c${getTimestamp()}%c`;\n parts.push('color: gray', '');\n }\n\n return { format, parts };\n}\n\n/**\n * Core logging function.\n */\nfunction log(type: LogType, ...args: unknown[]): void {\n // Node.js logging (simplified)\n if (typeof window === 'undefined') {\n const method = console[getConsoleMethod(type)] as (...a: unknown[]) => void;\n method(`${getDisplayValue(type)} | ${getEnvIndicator()} |`, ...args);\n return;\n }\n\n // Check the log level\n if (!shouldLog(type)) return;\n\n // Browser logging with styles\n const { format, parts } = buildLogParts(type);\n const method = console[getConsoleMethod(type)] as (...a: unknown[]) => void;\n\n method(format, ...parts, ...args);\n sendRemote(type, args);\n}\n\n/**\n * Creates a scoped logger without mutating global state.\n */\nfunction createScopedLogger(scopeName: string): ScopedLogger {\n const originalNamespace = state.namespace;\n const fullNamespace = originalNamespace ? `${originalNamespace}.${scopeName}` : scopeName;\n\n const createMethod = (type: LogType) => {\n return (...args: unknown[]) => {\n const prev = state.namespace;\n state.namespace = fullNamespace;\n log(type, ...args);\n state.namespace = prev;\n };\n };\n\n return {\n debug: createMethod('debug'),\n error: createMethod('error'),\n info: createMethod('info'),\n success: createMethod('success'),\n trace: createMethod('trace'),\n warn: createMethod('warn'),\n };\n}\n\n/* -------------------- Public API -------------------- */\n\nexport const Logit = {\n /**\n * Asserts a condition and logs if false.\n */\n assert: (condition: boolean, message: string, context?: Record<string, unknown>): void => {\n console.assert(condition, message, context);\n },\n /**\n * Logs a debug message.\n */\n debug: (...args: unknown[]): void => log('debug', ...args),\n\n /**\n * Logs an error message.\n */\n error: (...args: unknown[]): void => log('error', ...args),\n\n /**\n * Gets environment indicator visibility.\n */\n getEnvironment: (): boolean => state.environment,\n\n /**\n * Gets the current log level.\n */\n getLevel: (): LogLevel => state.logLevel,\n\n /**\n * Gets the current namespace.\n */\n getPrefix: (): string => state.namespace,\n\n /**\n * Gets timestamp visibility.\n */\n getTimestamp: (): boolean => state.timestamp,\n\n /**\n * Gets the current variant.\n */\n getVariant: (): Variant => state.variant,\n\n /**\n * Creates a collapsed console group.\n */\n groupCollapsed: (text: string, label = 'GROUP', startTime = Date.now()): void => {\n if (!shouldLog('success')) return;\n\n const elapsed = Date.now() - startTime;\n const elapsedStr = elapsed ? `${elapsed}ms` : '';\n const env = getEnvIndicator();\n const timestamp = state.timestamp ? getTimestamp() : '';\n\n console.groupCollapsed(\n `%c${label}%c${state.namespace}%c${env}%c${timestamp}%c${elapsedStr}%c${text}`,\n getStyle('group', '; margin-right: 6px; padding: 1px 3px 0'),\n getStyle('ns', `; ${NAMESPACE_STYLE}; margin-right: 6px`),\n 'color: darkgray; margin-right: 6px',\n 'color: gray; font-weight: lighter; margin-right: 6px',\n 'color: gray; font-weight: lighter; margin-right: 6px',\n 'color: inherit; font-weight: lighter',\n );\n },\n\n /**\n * Ends the current console group.\n */\n groupEnd: (): void => {\n if (shouldLog('success')) console.groupEnd();\n },\n\n /**\n * Logs an info message.\n */\n info: (...args: unknown[]): void => log('info', ...args),\n\n /**\n * Creates a scoped logger with a namespace.\n *\n * @example\n * ```ts\n * const apiLogger = Logit.scope('api');\n * apiLogger.info('Request received'); // [api] Request received\n * ```\n */\n scope: (namespace: string): ScopedLogger => createScopedLogger(namespace),\n\n /**\n * Sets the minimum log level.\n */\n setLogLevel: (level: LogLevel): void => {\n state.logLevel = level;\n },\n\n /**\n * Sets the global namespace prefix.\n */\n setPrefix: (namespace: string): void => {\n state.namespace = namespace;\n },\n\n /**\n * Sets the remote logging options.\n */\n setRemote: (remote: RemoteOptions): void => {\n state.remote = { ...state.remote, ...remote };\n },\n\n /**\n * Sets the remote log level.\n */\n setRemoteLogLevel: (level: LogLevel): void => {\n state.remote.logLevel = level;\n },\n\n /**\n * Configures Logit with options.\n *\n * @example\n * ```ts\n * Logit.setup({\n * logLevel: 'info',\n * variant: 'text',\n * timestamp: false\n * });\n * ```\n */\n setup: (options: LogitOptions): void => {\n if (options.remote) {\n state.remote = { ...state.remote, ...options.remote };\n const { remote, ...rest } = options;\n Object.assign(state, rest);\n } else {\n Object.assign(state, options);\n }\n },\n\n /**\n * Sets the display variant.\n */\n setVariant: (variant: Variant): void => {\n state.variant = variant;\n },\n\n /**\n * Logs a success message.\n */\n success: (...args: unknown[]): void => log('success', ...args),\n\n /**\n * Displays data in a table format.\n */\n table: (...args: unknown[]): void => {\n if (shouldLog('table')) console.table(...args);\n },\n\n /**\n * Starts a timer.\n */\n time: (label: string): void => {\n if (shouldLog('time')) console.time(label);\n },\n\n /**\n * Ends a timer.\n */\n timeEnd: (label: string): void => {\n if (shouldLog('time')) console.timeEnd(label);\n },\n\n /**\n * Toggles or sets environment indicator visibility.\n */\n toggleEnvironment: (value?: boolean): void => {\n state.environment = value ?? !state.environment;\n },\n\n /**\n * Toggles or sets timestamp visibility.\n */\n toggleTimestamp: (value?: boolean): void => {\n state.timestamp = value ?? !state.timestamp;\n },\n\n /**\n * Logs a trace message.\n */\n trace: (...args: unknown[]): void => log('trace', ...args),\n\n /**\n * Logs a warning message.\n */\n warn: (...args: unknown[]): void => log('warn', ...args),\n};\n"],"names":["ENV_PROD","ENV_DEV","CONSOLE_METHOD_MAP","LOG_LEVEL_PRIORITY","isDarkMode","THEME","NAMESPACE_STYLE","isProduction","__vite_import_meta_env__","IS_PROD","state","shouldLog","type","getTimestamp","getEnvIndicator","sendRemote","args","handler","logLevel","getConsoleMethod","getStyle","extra","bg","color","border","baseStyle","getDisplayValue","theme","variant","buildLogParts","namespace","timestamp","environment","format","parts","log","method","createScopedLogger","scopeName","originalNamespace","fullNamespace","createMethod","prev","Logit","condition","message","context","text","label","startTime","elapsed","elapsedStr","env","level","remote","options","rest","value"],"mappings":"2FAyCMA,EAAW,KACXC,EAAU,KAEVC,EAA8D,CAClE,MAAO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AgC,CAC1C5C,EAAM,OAAS,CAAE,GAAGA,EAAM,OAAQ,GAAG4C,CAAA,CACvC,EAKA,kBAAoBD,GAA0B,CAC5C3C,EAAM,OAAO,SAAW2C,CAC1B,EAcA,MAAQE,GAAgC,CACtC,GAAIA,EAAQ,OAAQ,CAClB7C,EAAM,OAAS,CAAE,GAAGA,EAAM,OAAQ,GAAG6C,EAAQ,MAAA,EAC7C,KAAM,CAAE,OAAAD,EAAQ,GAAGE,CAAA,EAASD,EAC5B,OAAO,OAAO7C,EAAO8C,CAAI,CAC3B,MACE,OAAO,OAAO9C,EAAO6C,CAAO,CAEhC,EAKA,WAAa3B,GAA2B,CACtClB,EAAM,QAAUkB,CAClB,EAKA,QAAS,IAAIZ,IAA0BmB,EAAI,UAAW,GAAGnB,CAAI,EAK7D,MAAO,IAAIA,IAA0B,CAC/BL,EAAU,OAAO,GAAG,QAAQ,MAAM,GAAGK,CAAI,CAC/C,EAKA,KAAOgC,GAAwB,CACzBrC,EAAU,MAAM,GAAG,QAAQ,KAAKqC,CAAK,CAC3C,EAKA,QAAUA,GAAwB,CAC5BrC,EAAU,MAAM,GAAG,QAAQ,QAAQqC,CAAK,CAC9C,EAKA,kBAAoBS,GAA0B,CAC5C/C,EAAM,YAAc+C,GAAS,CAAC/C,EAAM,WACtC,EAKA,gBAAkB+C,GAA0B,CAC1C/C,EAAM,UAAY+C,GAAS,CAAC/C,EAAM,SACpC,EAKA,MAAO,IAAIM,IAA0BmB,EAAI,QAAS,GAAGnB,CAAI,EAKzD,KAAM,IAAIA,IAA0BmB,EAAI,OAAQ,GAAGnB,CAAI,CACzD"}
package/dist/logit.js CHANGED
@@ -1,18 +1,8 @@
1
- const h = {};
2
- const E = {
1
+ const E = {};
2
+ const $ = {
3
3
  debug: "log",
4
4
  success: "log"
5
- }, $ = () => typeof window < "u" && h?.NODE_ENV ? !1 : typeof process < "u" && process.env?.NODE_ENV ? process.env.NODE_ENV === "production" : !1, g = $(), w = typeof window < "u" && window.matchMedia?.("(prefers-color-scheme: dark)").matches, u = {
6
- debug: { bg: "#616161", border: "#424242", color: "#fff", icon: "☕", symbol: "🅳" },
7
- error: { bg: "#d32f2f", border: "#c62828", color: "#fff", icon: "✘", symbol: "🅴" },
8
- group: { bg: "#546e7a", border: "#455a64", color: "#fff", icon: "⚭", symbol: "🅶" },
9
- info: { bg: "#1976d2", border: "#1565c0", color: "#fff", icon: "ℹ", symbol: "🅸" },
10
- ns: w ? { bg: "#fafafa", border: "#c7c7c7", color: "#000" } : { bg: "#424242", border: "#212121", color: "#fff" },
11
- success: { bg: "#689f38", border: "#558b2f", color: "#fff", icon: "✔", symbol: "🆂" },
12
- time: { bg: "#0097a7", border: "#00838f", color: "#fff", icon: "⏲", symbol: "🆃" },
13
- trace: { bg: "#d81b60", border: "#c2185b", color: "#fff", icon: "⛢", symbol: "🆃" },
14
- warn: { bg: "#ffb300", border: "#ffa000", color: "#fff", icon: "⚠", symbol: "🆆" }
15
- }, m = {
5
+ }, l = {
16
6
  debug: 0,
17
7
  trace: 1,
18
8
  time: 2,
@@ -22,63 +12,114 @@ const E = {
22
12
  warn: 6,
23
13
  error: 7,
24
14
  off: 8
25
- }, o = {
15
+ }, w = typeof window < "u" && window.matchMedia?.("(prefers-color-scheme: dark)").matches, p = {
16
+ debug: { bg: "#616161", border: "#424242", color: "#fff", icon: "☕", symbol: "🅳" },
17
+ error: { bg: "#d32f2f", border: "#c62828", color: "#fff", icon: "✘", symbol: "🅴" },
18
+ group: { bg: "#546e7a", border: "#455a64", color: "#fff", icon: "⚭", symbol: "🅶" },
19
+ info: { bg: "#1976d2", border: "#1565c0", color: "#fff", icon: "ℹ", symbol: "🅸" },
20
+ ns: w ? { bg: "#fafafa", border: "#c7c7c7", color: "#000" } : { bg: "#424242", border: "#212121", color: "#fff" },
21
+ success: { bg: "#689f38", border: "#558b2f", color: "#fff", icon: "✔", symbol: "🆂" },
22
+ time: { bg: "#0097a7", border: "#00838f", color: "#fff", icon: "⏲", symbol: "🆃" },
23
+ trace: { bg: "#d81b60", border: "#c2185b", color: "#fff", icon: "⛢", symbol: "🆃" },
24
+ warn: { bg: "#ffb300", border: "#ffa000", color: "#fff", icon: "⚠", symbol: "🆆" }
25
+ }, b = "border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter; padding: 0 4px;";
26
+ function L() {
27
+ return typeof window < "u" && E?.NODE_ENV === "production" ? !0 : typeof process < "u" && process.env?.NODE_ENV === "production";
28
+ }
29
+ const v = L(), o = {
26
30
  environment: !0,
27
31
  logLevel: "debug",
28
32
  namespace: "",
29
33
  remote: { handler: void 0, logLevel: "off" },
30
34
  timestamp: !0,
31
35
  variant: "symbol"
32
- }, i = (e) => m[o.logLevel] <= m[e], p = () => (/* @__PURE__ */ new Date()).toISOString().slice(11, 23), d = () => g ? "🄿" : "🄳", _ = (e, n) => {
33
- o.remote.handler && m[o.remote.logLevel] <= m[e] && Promise.resolve().then(() => {
34
- o.remote.handler?.(e, {
35
- args: n,
36
- environment: g ? "production" : "development",
36
+ };
37
+ function a(e) {
38
+ return l[o.logLevel] <= l[e];
39
+ }
40
+ function g() {
41
+ return (/* @__PURE__ */ new Date()).toISOString().slice(11, 23);
42
+ }
43
+ function d() {
44
+ return v ? "🅿" : "🅳";
45
+ }
46
+ function _(e, t) {
47
+ const { handler: r, logLevel: n } = o.remote;
48
+ r && l[n] <= l[e] && Promise.resolve().then(() => {
49
+ r(e, {
50
+ args: t,
51
+ environment: v ? "production" : "development",
37
52
  namespace: o.namespace || void 0,
38
- timestamp: o.timestamp ? p() : void 0
53
+ timestamp: o.timestamp ? g() : void 0
39
54
  });
40
55
  });
41
- }, f = (e) => E[e] || e, L = "border: 1px solid", x = "border-radius: 4px", b = "border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter; padding: 0 4px;", l = (e, n = "") => {
42
- const { bg: r, color: s, border: t } = u[e], c = `${L} ${t}; ${x}`;
56
+ }
57
+ function u(e) {
58
+ return $[e] || e;
59
+ }
60
+ function f(e, t = "") {
61
+ const { bg: r, color: n, border: s } = p[e], c = `border: 1px solid ${s}; border-radius: 4px`;
43
62
  switch (o.variant) {
44
63
  case "symbol":
45
- return `color: ${r}; ${c}; padding: 1px 1px 0${n}`;
46
64
  case "icon":
47
- return `color: ${r}; ${c}; padding: 0 3px${n}`;
65
+ return `color: ${r}; ${c}; padding: 0 3px${t}`;
48
66
  default:
49
- return `background: ${r}; color: ${s}; ${c}; font-weight: bold; padding: 0 3px${n}`;
67
+ return `background: ${r}; color: ${n}; ${c}; font-weight: bold; padding: 0 3px${t}`;
50
68
  }
51
- }, v = (e) => {
52
- const n = u[e], { variant: r } = o;
53
- return r === "text" || !n || !n[r] ? e.toUpperCase() : n[r];
54
- };
55
- function D(e) {
56
- const { namespace: n, timestamp: r, environment: s } = o;
57
- let t = `%c${v(e)}%c`;
58
- const c = [l(e), ""];
59
- return n && (t += ` %c${n}%c`, c.push(l("ns", `; ${b}`), "")), s && (t += ` %c${d()}%c`, c.push("color: darkgray", "")), r && (t += ` %c${p()}%c`, c.push("color: gray", "")), { format: t, parts: c };
60
69
  }
61
- const a = (e, ...n) => {
70
+ function h(e) {
71
+ if (e === "table")
72
+ return e.toUpperCase();
73
+ const t = p[e], { variant: r } = o;
74
+ return r === "text" || !t[r] ? e.toUpperCase() : t[r];
75
+ }
76
+ function x(e) {
77
+ const { namespace: t, timestamp: r, environment: n } = o;
78
+ let s = `%c${h(e)}%c`;
79
+ const c = [f(e), ""];
80
+ return t && (s += ` %c${t}%c`, c.push(f("ns", `; ${b}`), "")), n && (s += ` %c${d()}%c`, c.push("color: darkgray", "")), r && (s += ` %c${g()}%c`, c.push("color: gray", "")), { format: s, parts: c };
81
+ }
82
+ function i(e, ...t) {
62
83
  if (typeof window > "u") {
63
- const c = console[f(e)];
64
- c(`${v(e)} | ${d()} |`, ...n);
84
+ const c = console[u(e)];
85
+ c(`${h(e)} | ${d()} |`, ...t);
65
86
  return;
66
87
  }
67
- if (!i(e)) return;
68
- const { format: r, parts: s } = D(e), t = console[f(e)];
69
- t(r, ...s, ...n), _(e, n);
70
- }, N = (e) => {
71
- const n = Math.floor(Date.now() - e);
72
- return n ? `${n}ms` : "";
73
- }, O = {
88
+ if (!a(e)) return;
89
+ const { format: r, parts: n } = x(e), s = console[u(e)];
90
+ s(r, ...n, ...t), _(e, t);
91
+ }
92
+ function O(e) {
93
+ const t = o.namespace, r = t ? `${t}.${e}` : e, n = (s) => (...c) => {
94
+ const m = o.namespace;
95
+ o.namespace = r, i(s, ...c), o.namespace = m;
96
+ };
97
+ return {
98
+ debug: n("debug"),
99
+ error: n("error"),
100
+ info: n("info"),
101
+ success: n("success"),
102
+ trace: n("trace"),
103
+ warn: n("warn")
104
+ };
105
+ }
106
+ const D = {
74
107
  /**
75
- * Asserts a condition and logs an error if it's false.
108
+ * Asserts a condition and logs if false.
76
109
  */
77
- assert: (e, n, r) => console.assert(e, n, r),
78
- debug: (...e) => a("debug", ...e),
79
- error: (...e) => a("error", ...e),
110
+ assert: (e, t, r) => {
111
+ console.assert(e, t, r);
112
+ },
113
+ /**
114
+ * Logs a debug message.
115
+ */
116
+ debug: (...e) => i("debug", ...e),
117
+ /**
118
+ * Logs an error message.
119
+ */
120
+ error: (...e) => i("error", ...e),
80
121
  /**
81
- * Gets whether the environment indicator is shown.
122
+ * Gets environment indicator visibility.
82
123
  */
83
124
  getEnvironment: () => o.environment,
84
125
  /**
@@ -86,27 +127,27 @@ const a = (e, ...n) => {
86
127
  */
87
128
  getLevel: () => o.logLevel,
88
129
  /**
89
- * Gets the current namespace prefix.
130
+ * Gets the current namespace.
90
131
  */
91
132
  getPrefix: () => o.namespace,
92
133
  /**
93
- * Gets whether timestamps are shown.
134
+ * Gets timestamp visibility.
94
135
  */
95
136
  getTimestamp: () => o.timestamp,
96
137
  /**
97
- * Gets the current display variant.
138
+ * Gets the current variant.
98
139
  */
99
140
  getVariant: () => o.variant,
100
141
  /**
101
- * Creates a collapsed group in the console.
142
+ * Creates a collapsed console group.
102
143
  */
103
- groupCollapsed: (e, n = "GROUP", r = Date.now()) => {
104
- if (!i("success")) return;
105
- const s = N(r), t = d(), c = o.timestamp ? p() : "";
144
+ groupCollapsed: (e, t = "GROUP", r = Date.now()) => {
145
+ if (!a("success")) return;
146
+ const n = Date.now() - r, s = n ? `${n}ms` : "", c = d(), m = o.timestamp ? g() : "";
106
147
  console.groupCollapsed(
107
- `%c${n}%c${o.namespace}%c${t}%c${c}%c${s}%c${e}`,
108
- l("group", "; margin-right: 6px; padding: 1px 3px 0"),
109
- l("ns", `; ${b}; margin-right: 6px`),
148
+ `%c${t}%c${o.namespace}%c${c}%c${m}%c${s}%c${e}`,
149
+ f("group", "; margin-right: 6px; padding: 1px 3px 0"),
150
+ f("ns", `; ${b}; margin-right: 6px`),
110
151
  "color: darkgray; margin-right: 6px",
111
152
  "color: gray; font-weight: lighter; margin-right: 6px",
112
153
  "color: gray; font-weight: lighter; margin-right: 6px",
@@ -117,148 +158,116 @@ const a = (e, ...n) => {
117
158
  * Ends the current console group.
118
159
  */
119
160
  groupEnd: () => {
120
- i("success") && console.groupEnd();
161
+ a("success") && console.groupEnd();
121
162
  },
122
- info: (...e) => a("info", ...e),
123
163
  /**
124
- * Creates a scoped logger with a namespaced prefix.
125
- * Does not mutate global state - returns an isolated logger instance.
126
- *
127
- * @param namespace - The namespace to prepend to all log messages
128
- * @returns A scoped logger with all logging methods
164
+ * Logs an info message.
165
+ */
166
+ info: (...e) => i("info", ...e),
167
+ /**
168
+ * Creates a scoped logger with a namespace.
129
169
  *
130
170
  * @example
131
171
  * ```ts
132
172
  * const apiLogger = Logit.scope('api');
133
- * apiLogger.info('Request received'); // [API] Request received
134
- *
135
- * const dbLogger = Logit.scope('database');
136
- * dbLogger.error('Connection failed'); // [DATABASE] Connection failed
173
+ * apiLogger.info('Request received'); // [api] Request received
137
174
  * ```
138
175
  */
139
- scope: (e) => {
140
- const n = o.namespace, r = n ? `${n}.${e}` : e;
141
- return {
142
- debug: (...s) => {
143
- const t = o.namespace;
144
- o.namespace = r, a("debug", ...s), o.namespace = t;
145
- },
146
- error: (...s) => {
147
- const t = o.namespace;
148
- o.namespace = r, a("error", ...s), o.namespace = t;
149
- },
150
- info: (...s) => {
151
- const t = o.namespace;
152
- o.namespace = r, a("info", ...s), o.namespace = t;
153
- },
154
- success: (...s) => {
155
- const t = o.namespace;
156
- o.namespace = r, a("success", ...s), o.namespace = t;
157
- },
158
- trace: (...s) => {
159
- const t = o.namespace;
160
- o.namespace = r, a("trace", ...s), o.namespace = t;
161
- },
162
- warn: (...s) => {
163
- const t = o.namespace;
164
- o.namespace = r, a("warn", ...s), o.namespace = t;
165
- }
166
- };
167
- },
176
+ scope: (e) => O(e),
168
177
  /**
169
- * Sets the minimum log level to display.
178
+ * Sets the minimum log level.
170
179
  */
171
180
  setLogLevel: (e) => {
172
181
  o.logLevel = e;
173
182
  },
174
183
  /**
175
- * Sets the namespace prefix for all logs.
184
+ * Sets the global namespace prefix.
176
185
  */
177
186
  setPrefix: (e) => {
178
187
  o.namespace = e;
179
188
  },
180
189
  /**
181
- * Configures remote logging options.
190
+ * Sets the remote logging options.
182
191
  */
183
192
  setRemote: (e) => {
184
- o.remote = e;
193
+ o.remote = { ...o.remote, ...e };
185
194
  },
186
195
  /**
187
- * Sets the log level for remote logging.
196
+ * Sets the remote log level.
188
197
  */
189
198
  setRemoteLogLevel: (e) => {
190
199
  o.remote.logLevel = e;
191
200
  },
192
201
  /**
193
- * Configures Logit with custom options.
202
+ * Configures Logit with options.
194
203
  *
195
- * Note: The remote option will be merged with existing remote config,
196
- * not replaced entirely. To clear a remote handler, set remote.handler to undefined.
204
+ * @example
205
+ * ```ts
206
+ * Logit.setup({
207
+ * logLevel: 'info',
208
+ * variant: 'text',
209
+ * timestamp: false
210
+ * });
211
+ * ```
197
212
  */
198
213
  setup: (e) => {
199
- e.remote && (o.remote = { ...o.remote, ...e.remote }, delete e.remote), Object.assign(o, e);
214
+ if (e.remote) {
215
+ o.remote = { ...o.remote, ...e.remote };
216
+ const { remote: t, ...r } = e;
217
+ Object.assign(o, r);
218
+ } else
219
+ Object.assign(o, e);
200
220
  },
201
221
  /**
202
- * Sets the display variant (text, icon, or symbol).
222
+ * Sets the display variant.
203
223
  */
204
224
  setVariant: (e) => {
205
225
  o.variant = e;
206
226
  },
207
- success: (...e) => a("success", ...e),
227
+ /**
228
+ * Logs a success message.
229
+ */
230
+ success: (...e) => i("success", ...e),
208
231
  /**
209
232
  * Displays data in a table format.
210
233
  */
211
234
  table: (...e) => {
212
- i("table") && console.table(...e);
235
+ a("table") && console.table(...e);
213
236
  },
214
237
  /**
215
- * Starts a timer with the given label.
238
+ * Starts a timer.
216
239
  */
217
240
  time: (e) => {
218
- i("time") && console.time(e);
241
+ a("time") && console.time(e);
219
242
  },
220
243
  /**
221
- * Ends a timer with the given label.
244
+ * Ends a timer.
222
245
  */
223
246
  timeEnd: (e) => {
224
- i("time") && console.timeEnd(e);
247
+ a("time") && console.timeEnd(e);
225
248
  },
226
249
  /**
227
- * Toggles or sets the environment indicator visibility.
228
- * When called without arguments, toggles the current state.
229
- *
230
- * @param value - Optional boolean to explicitly set the state
231
- *
232
- * @example
233
- * ```ts
234
- * Logit.toggleEnvironment(); // Toggles current state
235
- * Logit.toggleEnvironment(true); // Shows environment indicator
236
- * Logit.toggleEnvironment(false); // Hides environment indicator
237
- * ```
250
+ * Toggles or sets environment indicator visibility.
238
251
  */
239
252
  toggleEnvironment: (e) => {
240
253
  o.environment = e ?? !o.environment;
241
254
  },
242
255
  /**
243
- * Toggles or sets timestamp visibility in logs.
244
- * When called without arguments, toggles the current state.
245
- *
246
- * @param value - Optional boolean to explicitly set the state
247
- *
248
- * @example
249
- * ```ts
250
- * Logit.toggleTimestamp(); // Toggles current state
251
- * Logit.toggleTimestamp(true); // Shows timestamps
252
- * Logit.toggleTimestamp(false); // Hides timestamps
253
- * ```
256
+ * Toggles or sets timestamp visibility.
254
257
  */
255
258
  toggleTimestamp: (e) => {
256
259
  o.timestamp = e ?? !o.timestamp;
257
260
  },
258
- trace: (...e) => a("trace", ...e),
259
- warn: (...e) => a("warn", ...e)
261
+ /**
262
+ * Logs a trace message.
263
+ */
264
+ trace: (...e) => i("trace", ...e),
265
+ /**
266
+ * Logs a warning message.
267
+ */
268
+ warn: (...e) => i("warn", ...e)
260
269
  };
261
270
  export {
262
- O as Logit
271
+ D as Logit
263
272
  };
264
273
  //# sourceMappingURL=logit.js.map
package/dist/logit.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"logit.js","sources":["../src/logit.ts"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noAssignInExpressions: - */\n/** biome-ignore-all lint/suspicious/noExplicitAny: - */\n\n/**\n * Environment indicator symbols.\n */\nconst ENV_PROD = '\\uD83C\\uDD3F'; // 🅿\nconst ENV_DEV = '\\uD83C\\uDD33'; // 🅳\n\n/**\n * Console method mappings for log types.\n */\nconst CONSOLE_METHOD_MAP: Record<string, keyof Console> = {\n debug: 'log',\n success: 'log',\n} as const;\n\n/**\n * Checks if the current environment is production.\n * Cached for performance - evaluated once at a module load.\n *\n * Note: import.meta.env is available in Vite/Bundlers but may be undefined in some environments.\n * Using 'any' cast is necessary for cross-environment compatibility.\n */\nconst isProduction = (): boolean => {\n // Browser environment (Vite, Webpack, etc.)\n // import.meta.env may be undefined in some bundlers - safe check with optional chaining\n if (typeof window !== 'undefined' && (import.meta as any)?.env?.NODE_ENV) {\n return (import.meta as any).env.NODE_ENV === 'production';\n }\n\n // Node.js environment\n // @ts-expect-error - process.env exists in Node.js but not in browser\n if (typeof process !== 'undefined' && (process as any).env?.NODE_ENV) {\n // @ts-expect-error - process.env exists in Node.js\n return (process as any).env.NODE_ENV === 'production';\n }\n\n return false;\n};\n\n// Cache the result to avoid repeated checks\nconst IS_PROD = isProduction();\n\nexport type LogitInstance = typeof Logit;\nexport type LogitType = 'debug' | 'trace' | 'time' | 'table' | 'info' | 'success' | 'warn' | 'error';\nexport type LogitColors = Exclude<LogitType, 'table'> | 'group' | 'ns';\nexport type LogitLevel = LogitType | 'off';\nexport type LogitRemoteOptions = {\n handler?: (...args: any[]) => void;\n logLevel: LogitLevel;\n};\nexport type LogitOptions = {\n environment?: boolean;\n variant?: 'text' | 'symbol' | 'icon';\n logLevel?: LogitLevel;\n namespace?: string;\n remote?: LogitRemoteOptions;\n timestamp?: boolean;\n};\nexport type LogitTheme = { color: string; bg: string; border: string; icon?: string; symbol?: string };\n\n/**\n * Scoped logger interface with namespaced logging methods.\n */\nexport type ScopedLogger = {\n debug: (...args: any[]) => void;\n error: (...args: any[]) => void;\n info: (...args: any[]) => void;\n success: (...args: any[]) => void;\n trace: (...args: any[]) => void;\n warn: (...args: any[]) => void;\n};\n\n/**\n * Detects dark mode preference at module load time.\n * Note: This is intentionally static and won't update if the user changes their theme.\n */\nconst isDark = typeof window !== 'undefined' && window.matchMedia?.('(prefers-color-scheme: dark)').matches;\n\nconst Theme: Readonly<Record<LogitColors, LogitTheme>> = {\n debug: { bg: '#616161', border: '#424242', color: '#fff', icon: '\\u2615', symbol: '\\uD83C\\uDD73' },\n error: { bg: '#d32f2f', border: '#c62828', color: '#fff', icon: '\\u2718', symbol: '\\uD83C\\uDD74' },\n group: { bg: '#546e7a', border: '#455a64', color: '#fff', icon: '\\u26AD', symbol: '\\uD83C\\uDD76' },\n info: { bg: '#1976d2', border: '#1565c0', color: '#fff', icon: '\\u2139', symbol: '\\uD83C\\uDD78' },\n ns: isDark\n ? { bg: '#fafafa', border: '#c7c7c7', color: '#000' }\n : { bg: '#424242', border: '#212121', color: '#fff' },\n success: { bg: '#689f38', border: '#558b2f', color: '#fff', icon: '\\u2714', symbol: '\\uD83C\\uDD82' },\n time: { bg: '#0097a7', border: '#00838f', color: '#fff', icon: '\\u23F2', symbol: '\\uD83C\\uDD83' },\n trace: { bg: '#d81b60', border: '#c2185b', color: '#fff', icon: '\\u26e2', symbol: '\\uD83C\\uDD83' },\n warn: { bg: '#ffb300', border: '#ffa000', color: '#fff', icon: '\\u26a0', symbol: '\\uD83C\\uDD86' },\n};\n\n// biome-ignore assist/source/useSortedKeys: -\nconst logLevel: Readonly<Record<LogitLevel, number>> = {\n debug: 0,\n trace: 1,\n time: 2,\n table: 3,\n info: 4,\n success: 5,\n warn: 6,\n error: 7,\n off: 8,\n};\n\nconst state: Required<LogitOptions> = {\n environment: true,\n logLevel: 'debug',\n namespace: '',\n remote: { handler: undefined, logLevel: 'off' },\n timestamp: true,\n variant: 'symbol',\n};\n\n/**\n * Determines if a log message should be shown based on the current log level.\n */\nconst shouldLog = (type: LogitType): boolean => logLevel[state.logLevel] <= logLevel[type];\n\n/**\n * Gets the current timestamp in ISO format (HH:MM:SS.mmm).\n */\nconst getCurrentTimestamp = (): string => new Date().toISOString().slice(11, 23);\n\n/**\n * Gets the environment indicator symbol.\n */\nconst getEnvIndicator = (): string => (IS_PROD ? ENV_PROD : ENV_DEV);\n\n/**\n * Sends log data to a remote handler if configured.\n */\nconst sendRemoteLog = (type: LogitType, args: any[]): void => {\n if (state.remote.handler && logLevel[state.remote.logLevel] <= logLevel[type]) {\n Promise.resolve().then(() => {\n state.remote.handler?.(type, {\n args,\n environment: IS_PROD ? 'production' : 'development',\n namespace: state.namespace || undefined,\n timestamp: state.timestamp ? getCurrentTimestamp() : undefined,\n });\n });\n }\n};\n\n/**\n * Gets the console method for a given log type.\n */\nconst getConsoleMethod = (type: LogitType): keyof Console => {\n return (CONSOLE_METHOD_MAP[type] || type) as keyof Console;\n};\n\n/**\n * CSS style constants for consistent formatting.\n */\nconst BASE_BORDER_STYLE = 'border: 1px solid';\nconst BASE_BORDER_RADIUS = 'border-radius: 4px';\nconst NAMESPACE_STYLE = 'border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter; padding: 0 4px;';\n\n/**\n * Generates CSS styles for log messages based on theme and variant.\n *\n * @param type - Log type color scheme\n * @param extra - Additional CSS to append (should include leading semicolon if needed)\n */\nconst style = (type: LogitColors, extra = ''): string => {\n const { bg, color, border } = Theme[type];\n const baseStyle = `${BASE_BORDER_STYLE} ${border}; ${BASE_BORDER_RADIUS}`;\n\n switch (state.variant) {\n case 'symbol':\n // Symbol variant: colored text on a transparent background\n return `color: ${bg}; ${baseStyle}; padding: 1px 1px 0${extra}`;\n case 'icon':\n // Icon variant: colored text on a transparent background\n return `color: ${bg}; ${baseStyle}; padding: 0 3px${extra}`;\n default:\n // Text variant: white text on a colored background\n return `background: ${bg}; color: ${color}; ${baseStyle}; font-weight: bold; padding: 0 3px${extra}`;\n }\n};\n\n/**\n * Gets the display value for a log type based on the current variant.\n */\nconst getDisplayValue = (type: LogitType): string => {\n const theme = Theme[type as LogitColors];\n const { variant } = state;\n\n // For 'text' variant or if the variant property doesn't exist in theme, use uppercase type\n if (variant === 'text' || !theme || !theme[variant]) {\n return type.toUpperCase();\n }\n\n return theme[variant] as string;\n};\n\n/**\n * Builds the format string and style parts for browser console logging.\n */\nfunction buildBrowserLogParts(type: LogitType): { format: string; parts: string[] } {\n const { namespace, timestamp, environment } = state;\n\n let format = `%c${getDisplayValue(type)}%c`;\n const parts: string[] = [style(type as LogitColors), ''];\n\n if (namespace) {\n format += ` %c${namespace}%c`;\n parts.push(style('ns', `; ${NAMESPACE_STYLE}`), '');\n }\n\n if (environment) {\n format += ` %c${getEnvIndicator()}%c`;\n parts.push('color: darkgray', '');\n }\n\n if (timestamp) {\n format += ` %c${getCurrentTimestamp()}%c`;\n parts.push('color: gray', '');\n }\n\n return { format, parts };\n}\n\n/**\n * Logs messages to the console with styling and metadata.\n */\nconst log = (type: LogitType, ...args: any[]): void => {\n // Server-side logging (Node.js)\n if (typeof window === 'undefined') {\n const consoleMethod = console[getConsoleMethod(type)] as (...a: any[]) => void;\n consoleMethod(`${getDisplayValue(type)} | ${getEnvIndicator()} |`, ...args);\n return;\n }\n\n // Check the log level\n if (!shouldLog(type)) return;\n\n // Browser-side logging with styling\n const { format, parts } = buildBrowserLogParts(type);\n const consoleMethod = console[getConsoleMethod(type)] as (...a: any[]) => void;\n\n consoleMethod(format, ...parts, ...args);\n sendRemoteLog(type, args);\n};\n\n/**\n * Formats the elapsed time for display.\n */\nconst formatElapsedTime = (startTime: number): string => {\n const elapsed = Math.floor(Date.now() - startTime);\n return elapsed ? `${elapsed}ms` : '';\n};\n\nexport const Logit = {\n /**\n * Asserts a condition and logs an error if it's false.\n */\n assert: (valid: boolean, message: string, context: Record<string, any>): void =>\n console.assert(valid, message, context),\n\n debug: (...args: any[]): void => log('debug', ...args),\n error: (...args: any[]): void => log('error', ...args),\n\n /**\n * Gets whether the environment indicator is shown.\n */\n getEnvironment: (): boolean => state.environment,\n\n /**\n * Gets the current log level.\n */\n getLevel: (): LogitLevel => state.logLevel,\n\n /**\n * Gets the current namespace prefix.\n */\n getPrefix: (): string => state.namespace,\n\n /**\n * Gets whether timestamps are shown.\n */\n getTimestamp: (): boolean => state.timestamp,\n\n /**\n * Gets the current display variant.\n */\n getVariant: (): 'text' | 'symbol' | 'icon' => state.variant,\n\n /**\n * Creates a collapsed group in the console.\n */\n groupCollapsed: (text: string, label = 'GROUP', time = Date.now()): void => {\n if (!shouldLog('success')) return;\n\n const elapsed = formatElapsedTime(time);\n const env = getEnvIndicator();\n const timestamp = state.timestamp ? getCurrentTimestamp() : '';\n\n console.groupCollapsed(\n `%c${label}%c${state.namespace}%c${env}%c${timestamp}%c${elapsed}%c${text}`,\n style('group', '; margin-right: 6px; padding: 1px 3px 0'),\n style('ns', `; ${NAMESPACE_STYLE}; margin-right: 6px`),\n 'color: darkgray; margin-right: 6px',\n 'color: gray; font-weight: lighter; margin-right: 6px',\n 'color: gray; font-weight: lighter; margin-right: 6px',\n 'color: inherit; font-weight: lighter',\n );\n },\n\n /**\n * Ends the current console group.\n */\n groupEnd: (): void => {\n if (shouldLog('success')) console.groupEnd();\n },\n\n info: (...args: any[]): void => log('info', ...args),\n\n /**\n * Creates a scoped logger with a namespaced prefix.\n * Does not mutate global state - returns an isolated logger instance.\n *\n * @param namespace - The namespace to prepend to all log messages\n * @returns A scoped logger with all logging methods\n *\n * @example\n * ```ts\n * const apiLogger = Logit.scope('api');\n * apiLogger.info('Request received'); // [API] Request received\n *\n * const dbLogger = Logit.scope('database');\n * dbLogger.error('Connection failed'); // [DATABASE] Connection failed\n * ```\n */\n scope: (namespace: string): ScopedLogger => {\n const originalNamespace = state.namespace;\n const scopedNamespace = originalNamespace ? `${originalNamespace}.${namespace}` : namespace;\n\n return {\n debug: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('debug', ...args);\n state.namespace = prev;\n },\n error: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('error', ...args);\n state.namespace = prev;\n },\n info: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('info', ...args);\n state.namespace = prev;\n },\n success: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('success', ...args);\n state.namespace = prev;\n },\n trace: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('trace', ...args);\n state.namespace = prev;\n },\n warn: (...args: any[]) => {\n const prev = state.namespace;\n state.namespace = scopedNamespace;\n log('warn', ...args);\n state.namespace = prev;\n },\n };\n },\n\n /**\n * Sets the minimum log level to display.\n */\n setLogLevel: (level: LogitLevel): void => {\n state.logLevel = level;\n },\n\n /**\n * Sets the namespace prefix for all logs.\n */\n setPrefix: (namespace: string): void => {\n state.namespace = namespace;\n },\n\n /**\n * Configures remote logging options.\n */\n setRemote: (remote: LogitRemoteOptions): void => {\n state.remote = remote;\n },\n\n /**\n * Sets the log level for remote logging.\n */\n setRemoteLogLevel: (level: LogitLevel): void => {\n state.remote.logLevel = level;\n },\n\n /**\n * Configures Logit with custom options.\n *\n * Note: The remote option will be merged with existing remote config,\n * not replaced entirely. To clear a remote handler, set remote.handler to undefined.\n */\n setup: (options: LogitOptions): void => {\n if (options.remote) {\n state.remote = { ...state.remote, ...options.remote };\n delete (options as any).remote; // Remove to avoid Object.assign overwrite\n }\n Object.assign(state, options);\n },\n\n /**\n * Sets the display variant (text, icon, or symbol).\n */\n setVariant: (variant: 'text' | 'icon' | 'symbol'): void => {\n state.variant = variant;\n },\n\n success: (...args: any[]): void => log('success', ...args),\n\n /**\n * Displays data in a table format.\n */\n table: (...args: any[]): void => {\n if (shouldLog('table')) console.table(...args);\n },\n\n /**\n * Starts a timer with the given label.\n */\n time: (label: string): void => {\n if (shouldLog('time')) console.time(label);\n },\n\n /**\n * Ends a timer with the given label.\n */\n timeEnd: (label: string): void => {\n if (shouldLog('time')) console.timeEnd(label);\n },\n\n /**\n * Toggles or sets the environment indicator visibility.\n * When called without arguments, toggles the current state.\n *\n * @param value - Optional boolean to explicitly set the state\n *\n * @example\n * ```ts\n * Logit.toggleEnvironment(); // Toggles current state\n * Logit.toggleEnvironment(true); // Shows environment indicator\n * Logit.toggleEnvironment(false); // Hides environment indicator\n * ```\n */\n toggleEnvironment: (value?: boolean): void => {\n state.environment = value ?? !state.environment;\n },\n\n /**\n * Toggles or sets timestamp visibility in logs.\n * When called without arguments, toggles the current state.\n *\n * @param value - Optional boolean to explicitly set the state\n *\n * @example\n * ```ts\n * Logit.toggleTimestamp(); // Toggles current state\n * Logit.toggleTimestamp(true); // Shows timestamps\n * Logit.toggleTimestamp(false); // Hides timestamps\n * ```\n */\n toggleTimestamp: (value?: boolean): void => {\n state.timestamp = value ?? !state.timestamp;\n },\n\n trace: (...args: any[]): void => log('trace', ...args),\n warn: (...args: any[]): void => log('warn', ...args),\n};\n"],"names":["CONSOLE_METHOD_MAP","isProduction","__vite_import_meta_env__","IS_PROD","isDark","Theme","logLevel","state","shouldLog","type","getCurrentTimestamp","getEnvIndicator","sendRemoteLog","args","getConsoleMethod","BASE_BORDER_STYLE","BASE_BORDER_RADIUS","NAMESPACE_STYLE","style","extra","bg","color","border","baseStyle","getDisplayValue","theme","variant","buildBrowserLogParts","namespace","timestamp","environment","format","parts","log","consoleMethod","formatElapsedTime","startTime","elapsed","Logit","valid","message","context","text","label","time","env","origin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B;AAC5C,IAAA7C,EAAM,cAAc6C,KAAS,CAAC7C,EAAM;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,iBAAiB,CAAC6C,MAA0B;AAC1C,IAAA7C,EAAM,YAAY6C,KAAS,CAAC7C,EAAM;AAAA,EACpC;AAAA,EAEA,OAAO,IAAIM,MAAsBoB,EAAI,SAAS,GAAGpB,CAAI;AAAA,EACrD,MAAM,IAAIA,MAAsBoB,EAAI,QAAQ,GAAGpB,CAAI;AACrD;"}
1
+ {"version":3,"file":"logit.js","sources":["../src/logit.ts"],"sourcesContent":["/** biome-ignore-all lint/suspicious/noExplicitAny: - */\n\n/* -------------------- Core Types -------------------- */\n\nexport type LogLevel = 'debug' | 'trace' | 'time' | 'table' | 'info' | 'success' | 'warn' | 'error' | 'off';\nexport type LogType = Exclude<LogLevel, 'off'>;\nexport type ColorType = Exclude<LogType, 'table'> | 'group' | 'ns';\nexport type Variant = 'text' | 'symbol' | 'icon';\n\nexport type RemoteOptions = {\n handler?: (type: LogType, data: RemoteLogData) => void;\n logLevel?: LogLevel;\n};\n\nexport type RemoteLogData = {\n args: unknown[];\n environment: 'production' | 'development';\n namespace?: string;\n timestamp?: string;\n};\n\nexport type LogitOptions = {\n environment?: boolean;\n variant?: Variant;\n logLevel?: LogLevel;\n namespace?: string;\n remote?: RemoteOptions;\n timestamp?: boolean;\n};\n\nexport type ScopedLogger = {\n debug: (...args: unknown[]) => void;\n error: (...args: unknown[]) => void;\n info: (...args: unknown[]) => void;\n success: (...args: unknown[]) => void;\n trace: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n};\n\n/* -------------------- Constants -------------------- */\n\nconst ENV_PROD = '🅿';\nconst ENV_DEV = '🅳';\n\nconst CONSOLE_METHOD_MAP: Partial<Record<LogType, keyof Console>> = {\n debug: 'log',\n success: 'log',\n};\n\n// biome-ignore assist/source/useSortedKeys: -\nconst LOG_LEVEL_PRIORITY: Record<LogLevel, number> = {\n debug: 0,\n trace: 1,\n time: 2,\n table: 3,\n info: 4,\n success: 5,\n warn: 6,\n error: 7,\n off: 8,\n};\n\n/* -------------------- Theme & Styles -------------------- */\n\ntype Theme = {\n color: string;\n bg: string;\n border: string;\n icon?: string;\n symbol?: string;\n};\n\nconst isDarkMode = typeof window !== 'undefined' && window.matchMedia?.('(prefers-color-scheme: dark)').matches;\n\nconst THEME: Record<ColorType, Theme> = {\n debug: { bg: '#616161', border: '#424242', color: '#fff', icon: '☕', symbol: '🅳' },\n error: { bg: '#d32f2f', border: '#c62828', color: '#fff', icon: '✘', symbol: '🅴' },\n group: { bg: '#546e7a', border: '#455a64', color: '#fff', icon: '⚭', symbol: '🅶' },\n info: { bg: '#1976d2', border: '#1565c0', color: '#fff', icon: 'ℹ', symbol: '🅸' },\n ns: isDarkMode\n ? { bg: '#fafafa', border: '#c7c7c7', color: '#000' }\n : { bg: '#424242', border: '#212121', color: '#fff' },\n success: { bg: '#689f38', border: '#558b2f', color: '#fff', icon: '✔', symbol: '🆂' },\n time: { bg: '#0097a7', border: '#00838f', color: '#fff', icon: '⏲', symbol: '🆃' },\n trace: { bg: '#d81b60', border: '#c2185b', color: '#fff', icon: '⛢', symbol: '🆃' },\n warn: { bg: '#ffb300', border: '#ffa000', color: '#fff', icon: '⚠', symbol: '🆆' },\n};\n\nconst NAMESPACE_STYLE = 'border-radius: 8px; font: italic small-caps bold 12px; font-weight: lighter; padding: 0 4px;';\n\n/* -------------------- Environment Detection -------------------- */\n\n/**\n * Detects if running in a production environment.\n * Checks both browser (import.meta.env) and Node.js (process.env).\n */\nfunction isProduction(): boolean {\n // Browser environment (Vite, Webpack, etc.)\n if (typeof window !== 'undefined' && (import.meta as any)?.env?.NODE_ENV === 'production') {\n return true;\n }\n\n // @ts-expect-error - process.env exists in Node.js but not in a browser\n return typeof process !== 'undefined' && (process as any).env?.NODE_ENV === 'production';\n}\n\nconst IS_PROD = isProduction();\n\n/* -------------------- State -------------------- */\n\nconst state: Required<LogitOptions> & { remote: Required<RemoteOptions> } = {\n environment: true,\n logLevel: 'debug',\n namespace: '',\n remote: { handler: undefined as any, logLevel: 'off' },\n timestamp: true,\n variant: 'symbol',\n};\n\n/* -------------------- Helper Functions -------------------- */\n\n/**\n * Checks if a log should be displayed based on the current log level.\n */\nfunction shouldLog(type: LogType): boolean {\n return LOG_LEVEL_PRIORITY[state.logLevel] <= LOG_LEVEL_PRIORITY[type];\n}\n\n/**\n * Gets the current timestamp in HH:MM:SS.mmm format.\n */\nfunction getTimestamp(): string {\n return new Date().toISOString().slice(11, 23);\n}\n\n/**\n * Gets environment indicator emoji.\n */\nfunction getEnvIndicator(): string {\n return IS_PROD ? ENV_PROD : ENV_DEV;\n}\n\n/**\n * Sends log to remote handler if configured.\n */\nfunction sendRemote(type: LogType, args: unknown[]): void {\n const { handler, logLevel } = state.remote;\n\n if (handler && LOG_LEVEL_PRIORITY[logLevel] <= LOG_LEVEL_PRIORITY[type]) {\n // Use microtask to make async without setTimeout overhead\n Promise.resolve().then(() => {\n handler(type, {\n args,\n environment: IS_PROD ? 'production' : 'development',\n namespace: state.namespace || undefined,\n timestamp: state.timestamp ? getTimestamp() : undefined,\n });\n });\n }\n}\n\n/**\n * Gets the console method for a log type.\n */\nfunction getConsoleMethod(type: LogType): keyof Console {\n return (CONSOLE_METHOD_MAP[type] || type) as keyof Console;\n}\n\n/**\n * Generates CSS style for a log type.\n */\nfunction getStyle(type: ColorType, extra = ''): string {\n const { bg, color, border } = THEME[type];\n const baseStyle = `border: 1px solid ${border}; border-radius: 4px`;\n\n switch (state.variant) {\n case 'symbol':\n case 'icon':\n return `color: ${bg}; ${baseStyle}; padding: 0 3px${extra}`;\n default:\n return `background: ${bg}; color: ${color}; ${baseStyle}; font-weight: bold; padding: 0 3px${extra}`;\n }\n}\n\n/**\n * Gets display value for a log type based on variant.\n */\nfunction getDisplayValue(type: LogType): string {\n // Table doesn't have a theme, return uppercase\n if (type === 'table') {\n return type.toUpperCase();\n }\n\n const theme = THEME[type as ColorType];\n const { variant } = state;\n\n if (variant === 'text' || !theme[variant]) {\n return type.toUpperCase();\n }\n\n return theme[variant]!;\n}\n\n/**\n * Builds browser console format string and style parts.\n */\nfunction buildLogParts(type: LogType): { format: string; parts: string[] } {\n const { namespace, timestamp, environment } = state;\n\n let format = `%c${getDisplayValue(type)}%c`;\n // Table doesn't have styling, but this is only called for types that do\n const parts: string[] = [getStyle(type as ColorType), ''];\n\n if (namespace) {\n format += ` %c${namespace}%c`;\n parts.push(getStyle('ns', `; ${NAMESPACE_STYLE}`), '');\n }\n\n if (environment) {\n format += ` %c${getEnvIndicator()}%c`;\n parts.push('color: darkgray', '');\n }\n\n if (timestamp) {\n format += ` %c${getTimestamp()}%c`;\n parts.push('color: gray', '');\n }\n\n return { format, parts };\n}\n\n/**\n * Core logging function.\n */\nfunction log(type: LogType, ...args: unknown[]): void {\n // Node.js logging (simplified)\n if (typeof window === 'undefined') {\n const method = console[getConsoleMethod(type)] as (...a: unknown[]) => void;\n method(`${getDisplayValue(type)} | ${getEnvIndicator()} |`, ...args);\n return;\n }\n\n // Check the log level\n if (!shouldLog(type)) return;\n\n // Browser logging with styles\n const { format, parts } = buildLogParts(type);\n const method = console[getConsoleMethod(type)] as (...a: unknown[]) => void;\n\n method(format, ...parts, ...args);\n sendRemote(type, args);\n}\n\n/**\n * Creates a scoped logger without mutating global state.\n */\nfunction createScopedLogger(scopeName: string): ScopedLogger {\n const originalNamespace = state.namespace;\n const fullNamespace = originalNamespace ? `${originalNamespace}.${scopeName}` : scopeName;\n\n const createMethod = (type: LogType) => {\n return (...args: unknown[]) => {\n const prev = state.namespace;\n state.namespace = fullNamespace;\n log(type, ...args);\n state.namespace = prev;\n };\n };\n\n return {\n debug: createMethod('debug'),\n error: createMethod('error'),\n info: createMethod('info'),\n success: createMethod('success'),\n trace: createMethod('trace'),\n warn: createMethod('warn'),\n };\n}\n\n/* -------------------- Public API -------------------- */\n\nexport const Logit = {\n /**\n * Asserts a condition and logs if false.\n */\n assert: (condition: boolean, message: string, context?: Record<string, unknown>): void => {\n console.assert(condition, message, context);\n },\n /**\n * Logs a debug message.\n */\n debug: (...args: unknown[]): void => log('debug', ...args),\n\n /**\n * Logs an error message.\n */\n error: (...args: unknown[]): void => log('error', ...args),\n\n /**\n * Gets environment indicator visibility.\n */\n getEnvironment: (): boolean => state.environment,\n\n /**\n * Gets the current log level.\n */\n getLevel: (): LogLevel => state.logLevel,\n\n /**\n * Gets the current namespace.\n */\n getPrefix: (): string => state.namespace,\n\n /**\n * Gets timestamp visibility.\n */\n getTimestamp: (): boolean => state.timestamp,\n\n /**\n * Gets the current variant.\n */\n getVariant: (): Variant => state.variant,\n\n /**\n * Creates a collapsed console group.\n */\n groupCollapsed: (text: string, label = 'GROUP', startTime = Date.now()): void => {\n if (!shouldLog('success')) return;\n\n const elapsed = Date.now() - startTime;\n const elapsedStr = elapsed ? `${elapsed}ms` : '';\n const env = getEnvIndicator();\n const timestamp = state.timestamp ? getTimestamp() : '';\n\n console.groupCollapsed(\n `%c${label}%c${state.namespace}%c${env}%c${timestamp}%c${elapsedStr}%c${text}`,\n getStyle('group', '; margin-right: 6px; padding: 1px 3px 0'),\n getStyle('ns', `; ${NAMESPACE_STYLE}; margin-right: 6px`),\n 'color: darkgray; margin-right: 6px',\n 'color: gray; font-weight: lighter; margin-right: 6px',\n 'color: gray; font-weight: lighter; margin-right: 6px',\n 'color: inherit; font-weight: lighter',\n );\n },\n\n /**\n * Ends the current console group.\n */\n groupEnd: (): void => {\n if (shouldLog('success')) console.groupEnd();\n },\n\n /**\n * Logs an info message.\n */\n info: (...args: unknown[]): void => log('info', ...args),\n\n /**\n * Creates a scoped logger with a namespace.\n *\n * @example\n * ```ts\n * const apiLogger = Logit.scope('api');\n * apiLogger.info('Request received'); // [api] Request received\n * ```\n */\n scope: (namespace: string): ScopedLogger => createScopedLogger(namespace),\n\n /**\n * Sets the minimum log level.\n */\n setLogLevel: (level: LogLevel): void => {\n state.logLevel = level;\n },\n\n /**\n * Sets the global namespace prefix.\n */\n setPrefix: (namespace: string): void => {\n state.namespace = namespace;\n },\n\n /**\n * Sets the remote logging options.\n */\n setRemote: (remote: RemoteOptions): void => {\n state.remote = { ...state.remote, ...remote };\n },\n\n /**\n * Sets the remote log level.\n */\n setRemoteLogLevel: (level: LogLevel): void => {\n state.remote.logLevel = level;\n },\n\n /**\n * Configures Logit with options.\n *\n * @example\n * ```ts\n * Logit.setup({\n * logLevel: 'info',\n * variant: 'text',\n * timestamp: false\n * });\n * ```\n */\n setup: (options: LogitOptions): void => {\n if (options.remote) {\n state.remote = { ...state.remote, ...options.remote };\n const { remote, ...rest } = options;\n Object.assign(state, rest);\n } else {\n Object.assign(state, options);\n }\n },\n\n /**\n * Sets the display variant.\n */\n setVariant: (variant: Variant): void => {\n state.variant = variant;\n },\n\n /**\n * Logs a success message.\n */\n success: (...args: unknown[]): void => log('success', ...args),\n\n /**\n * Displays data in a table format.\n */\n table: (...args: unknown[]): void => {\n if (shouldLog('table')) console.table(...args);\n },\n\n /**\n * Starts a timer.\n */\n time: (label: string): void => {\n if (shouldLog('time')) console.time(label);\n },\n\n /**\n * Ends a timer.\n */\n timeEnd: (label: string): void => {\n if (shouldLog('time')) console.timeEnd(label);\n },\n\n /**\n * Toggles or sets environment indicator visibility.\n */\n toggleEnvironment: (value?: boolean): void => {\n state.environment = value ?? !state.environment;\n },\n\n /**\n * Toggles or sets timestamp visibility.\n */\n toggleTimestamp: (value?: boolean): void => {\n state.timestamp = value ?? !state.timestamp;\n },\n\n /**\n * Logs a trace message.\n */\n trace: (...args: unknown[]): void => log('trace', ...args),\n\n /**\n * Logs a warning message.\n */\n warn: (...args: unknown[]): void => log('warn', ...args),\n};\n"],"names":["CONSOLE_METHOD_MAP","LOG_LEVEL_PRIORITY","isDarkMode","THEME","NAMESPACE_STYLE","isProduction","__vite_import_meta_env__","IS_PROD","state","shouldLog","type","getTimestamp","getEnvIndicator","sendRemote","args","handler","logLevel","getConsoleMethod","getStyle","extra","bg","color","border","baseStyle","getDisplayValue","theme","variant","buildLogParts","namespace","timestamp","environment","format","parts","log","method","createScopedLogger","scopeName","originalNamespace","fullNamespace","createMethod","prev","Logit","condition","message","context","text","label","startTime","elapsed","elapsedStr","env","level","remote","options","rest","value"],"mappings":";AA4CA,MAAMA,IAA8D;AAAA,EAClE,OAAO;AAAA,EACP,SAAS;AACX,GAGMC,IAA+C;AAAA,EACnD,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AAAA,EACP,KAAK;AACP,GAYMC,IAAa,OAAO,SAAW,OAAe,OAAO,aAAa,8BAA8B,EAAE,SAElGC,IAAkC;AAAA,EACtC,OAAO,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAK,QAAQ,KAAA;AAAA,EAC7E,OAAO,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAK,QAAQ,KAAA;AAAA,EAC7E,OAAO,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAK,QAAQ,KAAA;AAAA,EAC7E,MAAM,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAK,QAAQ,KAAA;AAAA,EAC5E,IAAID,IACA,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,OAAA,IAC3C,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,OAAA;AAAA,EAC/C,SAAS,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAK,QAAQ,KAAA;AAAA,EAC/E,MAAM,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAAQ,MAAM,KAAK,QAAQ,KAAA;AAAA,EAC5E,OAAO,EAAE,IAAI,WAAW,QAAQ,WAAW,OAAO,QAA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