devink 1.0.1 → 1.0.3

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
@@ -1,148 +1,161 @@
1
- <h1 align="center">
2
- <br>
3
- <br>
4
- <img width="320" src="media/Devink.png" alt="devink">
5
- <br>
6
- <br>
7
- <br>
8
- </h1>
1
+ ![devink - Fast, zero-dependency Node.js Logger](media/cover.png)
9
2
 
10
- > Fast, lightweight, professional terminal logger. Zero dependencies.
3
+ # devink
11
4
 
12
- [![npm version](https://badgen.net/npm/v/devink)](https://npmjs.com/package/devink)
13
- [![license](https://badgen.net/github/license/user/devink)](https://github.com/user/devink/blob/main/LICENSE)
14
- [![types](https://badgen.net/npm/types/devink)](https://www.npmjs.com/package/devink)
15
- [![dependencies](https://badgen.net/bundlephobia/dependency-count/devink)](https://bundlephobia.com/result?p=devink)
5
+ > A fast, lightweight, and professional **TypeScript logger** with zero dependencies. Keep your terminal cool, soothing, and strictly structured.
16
6
 
17
- **Devink** is a production-grade, zero-dependency Node.js logging library featuring custom transports, graceful JSON serialization, a deep-merging theme system, and automatic ANSI color detection.
7
+ [![npm version](https://img.shields.io/npm/v/devink.svg)](https://npmjs.org/package/devink)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
18
9
 
19
- Designed specifically built for high-performance CLI tools, servers, and modern development environments. 🚀
10
+ `devink` is a zero-dependency **Node.js logger** designed for developers who need high performance, beautiful **CLI output**, and structured **JSON logging**. With full **ANSI color support**, dynamic terminal capability detection, and customizable transports, it's the perfect production-ready logger for modern TS/JS environments.
20
11
 
21
- ## Highlights
12
+ ---
22
13
 
23
- - **Zero Dependencies**: Pure, self-contained raw ANSI escape engine (`NO_COLOR`, `FORCE_COLOR`, `TERM`, `isTTY` support).
24
- - **Graceful Error Handling**: Bulletproof object stringification gracefully handles Circular JSON crashes.
25
- - **Custom Transports**: Redirect logs to files, external services, or any custom stream easily.
26
- - **Deep Theme System**: Merge your own styles tightly without overriding whole config structures.
27
- - **Lightweight & Fast**: Extremely fast execution.
28
- - **Modern Module Setup**: Full TypeScript compatibility, exporting ESM (`import`) and CommonJS (`require`).
14
+ ## 🚀 Features
29
15
 
30
- ## Installation
16
+ - **Zero Dependencies**: Lightweight and ultra-fast. No bloated `node_modules`.
17
+ - **Full ANSI & 256/RGB Color Support**: Beautiful, soothing UI themes for the terminal. No harsh contrast.
18
+ - **Structured JSON Logging**: Instantly switch to JSON mode for seamless integration with Datadog, ELK, AWS CloudWatch, and parsing tools.
19
+ - **Log Levels & Priority Filtering**: Granular control via `trace`, `debug`, `info`, `warn`, `error`, and `fatal`.
20
+ - **Custom Transports**: Route logs to files, external APIs, or custom formatting engines.
21
+ - **Terminal Capability Detection**: Automatically detects `process.stdout.isTTY`, `FORCE_COLOR`, `NO_COLOR`, and `CI` environments.
22
+ - **Boxed Output**: Help crucial information stand out with Unicode-boxed messages.
23
+ - **TypeScript native**: Built with TS, exporting standard typings out-of-the-box.
24
+
25
+ ---
26
+
27
+ ## 📦 Installation
31
28
 
32
29
  ```bash
33
30
  npm install devink
34
31
  ```
35
32
 
36
- ## Quick Start
37
-
38
- ```typescript
39
- import { createLogger } from 'devink';
40
-
41
- const logger = createLogger({ timestamps: true });
33
+ ```bash
34
+ yarn add devink
35
+ ```
42
36
 
43
- logger.success('Database connection established');
44
- logger.info('Listening on port 3000');
45
- logger.warn('Memory usage above 80%');
46
- logger.error('Request failed', { status: 500 });
37
+ ```bash
38
+ pnpm add devink
47
39
  ```
48
40
 
49
- ## Advanced Usage
41
+ ---
50
42
 
51
- ### Custom Transports
43
+ ## 💻 Usage
52
44
 
53
- Devink allows you to intercept output and route it to your own methods. No more hardcoded `console.log`.
45
+ ### Basic CLI Logger
54
46
 
55
- ```typescript
56
- import { createLogger } from 'devink';
57
- import fs from 'fs';
47
+ Create a beautiful terminal logger with timestamps and the modern theme out of the box:
58
48
 
59
- const fileStream = fs.createWriteStream('./app.log', { flags: 'a' });
49
+ ```ts
50
+ import { createLogger } from 'devink';
60
51
 
61
52
  const logger = createLogger({
62
- transport: {
63
- // Override log execution logic
64
- success: (...args) => fileStream.write(`[PASS] ${args.join(' ')}\n`),
65
- error: (...args) => {
66
- console.error(...args); // Keep console logging
67
- fileStream.write(`[CRITICAL] ${args.join(' ')}\n`);
68
- },
69
- },
53
+ timestamps: true,
54
+ level: 'info',
70
55
  });
71
56
 
72
- logger.success('User registered!'); // Goes straight to app.log
57
+ logger.info('Server started on port 3000');
58
+ logger.success('Database connected successfully');
59
+ logger.warn('Rate limit approaching');
60
+ logger.error(new Error('Connection timeout'));
73
61
  ```
74
62
 
75
- ### Color Control
63
+ ### Structured JSON Logging
64
+
65
+ Perfect for production environments where log aggregation is crucial:
76
66
 
77
- For environments where strict text formatting is required, Devink lets you disable ANSI explicitly.
67
+ ```ts
68
+ import { createLogger } from 'devink';
78
69
 
79
- ```typescript
80
70
  const logger = createLogger({
81
- colors: false, // Instantly strips all ANSI escape codes
71
+ mode: 'json',
72
+ level: 'trace',
82
73
  });
83
74
 
84
- logger.info('This will definitely be plain text.');
75
+ logger.info('Processing payment', { userId: 123, amount: 49.99 });
76
+ // Output: {"level":"info","time":"2023-10-25T14:30:00.000Z","message":["Processing payment",{"userId":123,"amount":49.99}]}
85
77
  ```
86
78
 
87
- ### Deep Theming
88
-
89
- Deep-merge your theme overrides seamlessly.
79
+ ### Beautiful Boxed Output
90
80
 
91
- ```typescript
92
- import { createLogger, ansi } from 'devink';
81
+ Make important startup messages or critical alerts pop in the console:
93
82
 
94
- const customLogger = createLogger({
95
- theme: {
96
- // Colors text differently
97
- warn: (msg) => ansi.magenta(ansi.bold(msg)),
98
- prefix: {
99
- // Overrides ONLY the success icon, preserving defaults for others
100
- success: ansi.green('🚀 SUCCESS'),
101
- },
102
- },
103
- });
83
+ ```ts
84
+ const logger = createLogger();
104
85
 
105
- customLogger.success('Payload deployed!');
106
- customLogger.warn('Custom colored warning.');
86
+ logger.box(
87
+ 'System Ready',
88
+ 'All microservices have booted successfully.\nListening on http://localhost:8080',
89
+ );
107
90
  ```
108
91
 
109
- ### Safe Serialization
92
+ ---
110
93
 
111
- No more logging crashes from deep object introspection or circular references.
94
+ ## ⚙️ Configuration
112
95
 
113
- ```typescript
114
- const logger = createLogger();
96
+ The `createLogger` function accepts an optional `LoggerOptions` object:
97
+
98
+ | Property | Type | Default | Description |
99
+ | ------------ | ------------------ | -------------------- | -------------------------------------------------------------------------------------- |
100
+ | `level` | `LogLevelName` | `'trace'` | Minimum log level to output (`trace` < `debug` < `info` < `warn` < `error` < `fatal`). |
101
+ | `mode` | `'text' \| 'json'` | `'text'` | Output mode. Text formats for the console, JSON formats for log aggregators. |
102
+ | `colors` | `boolean` | `true` | Whether to use ANSI colors. Automatically disabled if terminal doesn't support it. |
103
+ | `timestamps` | `boolean` | `false` | Prepend a timestamp to text outputs (`[HH:MM:SS]`). |
104
+ | `theme` | `Partial<Theme>` | `modernTheme` | Customize the prefix, success, error, warn, and info styling. |
105
+ | `transports` | `Transport[]` | `[ConsoleTransport]` | Target output locations hooks (e.g., standard out, file streams). |
106
+
107
+ ### Theme Presets
108
+
109
+ `devink` ships with several UI/UX optimized presets, designed for accessibility and developer comfort:
115
110
 
116
- const circularObj: any = {};
117
- circularObj.self = circularObj;
111
+ - `modernTheme` (Default): Soft, cool hex colors (`#10b981`, `#f43f5e`, `#38bdf8`) with dim text to prevent eye strain.
112
+ - `classicTheme`: Standard ANSI colors (Red, Green, Yellow, Cyan).
113
+ - `minimalTheme`: Prefix icons only, without extra text like "success" or "error".
118
114
 
119
- // Doesn't throw! Gently recovers to '[Unserializable Object]'
120
- logger.error('Error snapshot:', circularObj);
115
+ ```ts
116
+ import { createLogger, classicTheme } from 'devink';
117
+
118
+ const logger = createLogger({
119
+ theme: classicTheme,
120
+ });
121
121
  ```
122
122
 
123
- ## API Reference
123
+ ### Custom Transports
124
124
 
125
- ### `createLogger(options?: LoggerOptions)`
125
+ You can easily route logs anywhere by providing objects that implement the `Transport` interface (which requires a `write(ctx: TransportContext)` method).
126
126
 
127
- Creates a new `Logger` instance.
127
+ ```ts
128
+ import { createLogger, Transport, TransportContext } from 'devink';
129
+ import fs from 'node:fs';
128
130
 
129
- #### `LoggerOptions`
131
+ class FileTransport implements Transport {
132
+ write(ctx: TransportContext) {
133
+ fs.appendFileSync('app.log', ctx.raw + '\n');
134
+ }
135
+ }
130
136
 
131
- | Option | Type | Default | Description |
132
- | :----------- | :------------------- | :------------------ | :------------------------------------------------------- |
133
- | `timestamps` | `boolean` | `false` | Prepends `[HH:MM:SS]` timestamp to every message. |
134
- | `colors` | `boolean` | `true` | When `false`, all output will be stripped of ANSI codes. |
135
- | `theme` | `Partial<Theme>` | `{}` | Deep partial override of color structures and prefixes. |
136
- | `transport` | `Partial<Transport>` | `console.*` methods | Custom output handler for standard log layers. |
137
+ const logger = createLogger({
138
+ transports: [new FileTransport()], // Now writes to app.log instead of console
139
+ });
140
+ ```
141
+
142
+ ---
137
143
 
138
- ## Runtime Compatibility
144
+ ## 🎨 ANSI Capabilities
139
145
 
140
- - Node.js `^18.0.0` or newer
141
- - Fully compatible with ESM & CommonJS
146
+ If you want to build your own CLI tools, `devink` exports its high-performance, zero-dependency ANSI utilities:
147
+
148
+ ```ts
149
+ import { ansi } from 'devink';
150
+
151
+ console.log(ansi.rgb(255, 100, 50, 'True RGB text!'));
152
+ console.log(ansi.hex('#34d399', 'Hex coded text!'));
153
+ console.log(ansi.color256(128, '256 color terminal support!'));
154
+ console.log(ansi.dim('Low contrast subtitle.'));
155
+ ```
142
156
 
143
- Built with ❤️ by **[Harry Mate](https://github.com/harrymate22)**.
144
- 🌟 If you find this library helpful, consider dropping a **Star** on GitHub and **[following me (@harrymate22)](https://github.com/harrymate22)** for more open-source tools!
157
+ ---
145
158
 
146
- ## License
159
+ ## 📄 License
147
160
 
148
161
  MIT © [harrymate22](https://github.com/harrymate22)
package/dist/index.d.mts CHANGED
@@ -10,40 +10,75 @@ interface Theme {
10
10
  info: string;
11
11
  };
12
12
  }
13
+ declare const modernTheme: Theme;
14
+ declare const minimalTheme: Theme;
15
+ declare const classicTheme: Theme;
13
16
  declare const defaultTheme: Theme;
14
17
 
18
+ declare enum LogLevel {
19
+ trace = 10,
20
+ debug = 20,
21
+ info = 30,
22
+ success = 35,
23
+ warn = 40,
24
+ error = 50,
25
+ fatal = 60,
26
+ none = 100
27
+ }
28
+ type LogLevelName = keyof typeof LogLevel;
29
+ interface TransportContext {
30
+ level: LogLevelName;
31
+ levelValue: number;
32
+ message: unknown[];
33
+ formatted: string;
34
+ raw: string;
35
+ timestamp: string;
36
+ }
15
37
  interface Transport {
16
- success: (...args: unknown[]) => void;
17
- error: (...args: unknown[]) => void;
18
- warn: (...args: unknown[]) => void;
19
- info: (...args: unknown[]) => void;
38
+ write(ctx: TransportContext): void;
20
39
  }
21
40
  interface LoggerOptions {
22
41
  theme?: Partial<Theme>;
23
42
  timestamps?: boolean;
24
43
  colors?: boolean;
25
- transport?: Partial<Transport>;
44
+ level?: LogLevelName;
45
+ mode?: 'text' | 'json';
46
+ transports?: Transport[];
47
+ }
48
+ declare class ConsoleTransport implements Transport {
49
+ write(ctx: TransportContext): void;
26
50
  }
27
51
  declare class Logger {
28
52
  private theme;
29
53
  private timestamps;
30
54
  private colors;
31
- private transport;
55
+ private level;
56
+ private mode;
57
+ private transports;
58
+ private timeCache;
32
59
  constructor(options?: LoggerOptions);
60
+ private shouldLog;
33
61
  private getTimestamp;
62
+ private safeStringify;
63
+ private highlightJson;
34
64
  private formatMessage;
35
- private stripAnsi;
36
- private output;
65
+ private emit;
66
+ private dispatch;
37
67
  success(...message: unknown[]): void;
38
68
  error(...message: unknown[]): void;
39
69
  warn(...message: unknown[]): void;
40
70
  info(...message: unknown[]): void;
71
+ trace(...message: unknown[]): void;
72
+ debug(...message: unknown[]): void;
73
+ fatal(...message: unknown[]): void;
74
+ box(title: string, message: string): void;
41
75
  }
42
76
  declare const createLogger: (options?: LoggerOptions) => Logger;
43
77
 
44
78
  declare const isColorSupported: string | boolean;
45
79
  declare const format: (code: number, text: string) => string;
46
80
  declare const reset: (text: string) => string;
81
+ declare const black: (text: string) => string;
47
82
  declare const red: (text: string) => string;
48
83
  declare const green: (text: string) => string;
49
84
  declare const yellow: (text: string) => string;
@@ -52,28 +87,61 @@ declare const magenta: (text: string) => string;
52
87
  declare const cyan: (text: string) => string;
53
88
  declare const white: (text: string) => string;
54
89
  declare const gray: (text: string) => string;
90
+ declare const bgBlack: (text: string) => string;
91
+ declare const bgRed: (text: string) => string;
92
+ declare const bgGreen: (text: string) => string;
93
+ declare const bgYellow: (text: string) => string;
94
+ declare const bgBlue: (text: string) => string;
95
+ declare const bgMagenta: (text: string) => string;
96
+ declare const bgCyan: (text: string) => string;
97
+ declare const bgWhite: (text: string) => string;
55
98
  declare const bold: (text: string) => string;
56
99
  declare const dim: (text: string) => string;
57
100
  declare const italic: (text: string) => string;
58
101
  declare const underline: (text: string) => string;
102
+ declare const inverse: (text: string) => string;
103
+ declare const rgb: (r: number, g: number, b: number, text: string) => string;
104
+ declare const bgRgb: (r: number, g: number, b: number, text: string) => string;
105
+ declare const hex: (hexCode: string, text: string) => string;
106
+ declare const bgHex: (hexCode: string, text: string) => string;
107
+ declare const color256: (code: number, text: string) => string;
108
+ declare const bgColor256: (code: number, text: string) => string;
109
+ declare const stripAnsi: (text: string) => string;
59
110
 
111
+ declare const ansi_bgBlack: typeof bgBlack;
112
+ declare const ansi_bgBlue: typeof bgBlue;
113
+ declare const ansi_bgColor256: typeof bgColor256;
114
+ declare const ansi_bgCyan: typeof bgCyan;
115
+ declare const ansi_bgGreen: typeof bgGreen;
116
+ declare const ansi_bgHex: typeof bgHex;
117
+ declare const ansi_bgMagenta: typeof bgMagenta;
118
+ declare const ansi_bgRed: typeof bgRed;
119
+ declare const ansi_bgRgb: typeof bgRgb;
120
+ declare const ansi_bgWhite: typeof bgWhite;
121
+ declare const ansi_bgYellow: typeof bgYellow;
122
+ declare const ansi_black: typeof black;
60
123
  declare const ansi_blue: typeof blue;
61
124
  declare const ansi_bold: typeof bold;
125
+ declare const ansi_color256: typeof color256;
62
126
  declare const ansi_cyan: typeof cyan;
63
127
  declare const ansi_dim: typeof dim;
64
128
  declare const ansi_format: typeof format;
65
129
  declare const ansi_gray: typeof gray;
66
130
  declare const ansi_green: typeof green;
131
+ declare const ansi_hex: typeof hex;
132
+ declare const ansi_inverse: typeof inverse;
67
133
  declare const ansi_isColorSupported: typeof isColorSupported;
68
134
  declare const ansi_italic: typeof italic;
69
135
  declare const ansi_magenta: typeof magenta;
70
136
  declare const ansi_red: typeof red;
71
137
  declare const ansi_reset: typeof reset;
138
+ declare const ansi_rgb: typeof rgb;
139
+ declare const ansi_stripAnsi: typeof stripAnsi;
72
140
  declare const ansi_underline: typeof underline;
73
141
  declare const ansi_white: typeof white;
74
142
  declare const ansi_yellow: typeof yellow;
75
143
  declare namespace ansi {
76
- export { ansi_blue as blue, ansi_bold as bold, ansi_cyan as cyan, ansi_dim as dim, ansi_format as format, ansi_gray as gray, ansi_green as green, ansi_isColorSupported as isColorSupported, ansi_italic as italic, ansi_magenta as magenta, ansi_red as red, ansi_reset as reset, ansi_underline as underline, ansi_white as white, ansi_yellow as yellow };
144
+ export { ansi_bgBlack as bgBlack, ansi_bgBlue as bgBlue, ansi_bgColor256 as bgColor256, ansi_bgCyan as bgCyan, ansi_bgGreen as bgGreen, ansi_bgHex as bgHex, ansi_bgMagenta as bgMagenta, ansi_bgRed as bgRed, ansi_bgRgb as bgRgb, ansi_bgWhite as bgWhite, ansi_bgYellow as bgYellow, ansi_black as black, ansi_blue as blue, ansi_bold as bold, ansi_color256 as color256, ansi_cyan as cyan, ansi_dim as dim, ansi_format as format, ansi_gray as gray, ansi_green as green, ansi_hex as hex, ansi_inverse as inverse, ansi_isColorSupported as isColorSupported, ansi_italic as italic, ansi_magenta as magenta, ansi_red as red, ansi_reset as reset, ansi_rgb as rgb, ansi_stripAnsi as stripAnsi, ansi_underline as underline, ansi_white as white, ansi_yellow as yellow };
77
145
  }
78
146
 
79
- export { Logger, type LoggerOptions, type Theme, ansi, createLogger, defaultTheme };
147
+ export { ConsoleTransport, LogLevel, type LogLevelName, Logger, type LoggerOptions, type Theme, type Transport, type TransportContext, ansi, classicTheme, createLogger, defaultTheme, minimalTheme, modernTheme };
package/dist/index.d.ts CHANGED
@@ -10,40 +10,75 @@ interface Theme {
10
10
  info: string;
11
11
  };
12
12
  }
13
+ declare const modernTheme: Theme;
14
+ declare const minimalTheme: Theme;
15
+ declare const classicTheme: Theme;
13
16
  declare const defaultTheme: Theme;
14
17
 
18
+ declare enum LogLevel {
19
+ trace = 10,
20
+ debug = 20,
21
+ info = 30,
22
+ success = 35,
23
+ warn = 40,
24
+ error = 50,
25
+ fatal = 60,
26
+ none = 100
27
+ }
28
+ type LogLevelName = keyof typeof LogLevel;
29
+ interface TransportContext {
30
+ level: LogLevelName;
31
+ levelValue: number;
32
+ message: unknown[];
33
+ formatted: string;
34
+ raw: string;
35
+ timestamp: string;
36
+ }
15
37
  interface Transport {
16
- success: (...args: unknown[]) => void;
17
- error: (...args: unknown[]) => void;
18
- warn: (...args: unknown[]) => void;
19
- info: (...args: unknown[]) => void;
38
+ write(ctx: TransportContext): void;
20
39
  }
21
40
  interface LoggerOptions {
22
41
  theme?: Partial<Theme>;
23
42
  timestamps?: boolean;
24
43
  colors?: boolean;
25
- transport?: Partial<Transport>;
44
+ level?: LogLevelName;
45
+ mode?: 'text' | 'json';
46
+ transports?: Transport[];
47
+ }
48
+ declare class ConsoleTransport implements Transport {
49
+ write(ctx: TransportContext): void;
26
50
  }
27
51
  declare class Logger {
28
52
  private theme;
29
53
  private timestamps;
30
54
  private colors;
31
- private transport;
55
+ private level;
56
+ private mode;
57
+ private transports;
58
+ private timeCache;
32
59
  constructor(options?: LoggerOptions);
60
+ private shouldLog;
33
61
  private getTimestamp;
62
+ private safeStringify;
63
+ private highlightJson;
34
64
  private formatMessage;
35
- private stripAnsi;
36
- private output;
65
+ private emit;
66
+ private dispatch;
37
67
  success(...message: unknown[]): void;
38
68
  error(...message: unknown[]): void;
39
69
  warn(...message: unknown[]): void;
40
70
  info(...message: unknown[]): void;
71
+ trace(...message: unknown[]): void;
72
+ debug(...message: unknown[]): void;
73
+ fatal(...message: unknown[]): void;
74
+ box(title: string, message: string): void;
41
75
  }
42
76
  declare const createLogger: (options?: LoggerOptions) => Logger;
43
77
 
44
78
  declare const isColorSupported: string | boolean;
45
79
  declare const format: (code: number, text: string) => string;
46
80
  declare const reset: (text: string) => string;
81
+ declare const black: (text: string) => string;
47
82
  declare const red: (text: string) => string;
48
83
  declare const green: (text: string) => string;
49
84
  declare const yellow: (text: string) => string;
@@ -52,28 +87,61 @@ declare const magenta: (text: string) => string;
52
87
  declare const cyan: (text: string) => string;
53
88
  declare const white: (text: string) => string;
54
89
  declare const gray: (text: string) => string;
90
+ declare const bgBlack: (text: string) => string;
91
+ declare const bgRed: (text: string) => string;
92
+ declare const bgGreen: (text: string) => string;
93
+ declare const bgYellow: (text: string) => string;
94
+ declare const bgBlue: (text: string) => string;
95
+ declare const bgMagenta: (text: string) => string;
96
+ declare const bgCyan: (text: string) => string;
97
+ declare const bgWhite: (text: string) => string;
55
98
  declare const bold: (text: string) => string;
56
99
  declare const dim: (text: string) => string;
57
100
  declare const italic: (text: string) => string;
58
101
  declare const underline: (text: string) => string;
102
+ declare const inverse: (text: string) => string;
103
+ declare const rgb: (r: number, g: number, b: number, text: string) => string;
104
+ declare const bgRgb: (r: number, g: number, b: number, text: string) => string;
105
+ declare const hex: (hexCode: string, text: string) => string;
106
+ declare const bgHex: (hexCode: string, text: string) => string;
107
+ declare const color256: (code: number, text: string) => string;
108
+ declare const bgColor256: (code: number, text: string) => string;
109
+ declare const stripAnsi: (text: string) => string;
59
110
 
111
+ declare const ansi_bgBlack: typeof bgBlack;
112
+ declare const ansi_bgBlue: typeof bgBlue;
113
+ declare const ansi_bgColor256: typeof bgColor256;
114
+ declare const ansi_bgCyan: typeof bgCyan;
115
+ declare const ansi_bgGreen: typeof bgGreen;
116
+ declare const ansi_bgHex: typeof bgHex;
117
+ declare const ansi_bgMagenta: typeof bgMagenta;
118
+ declare const ansi_bgRed: typeof bgRed;
119
+ declare const ansi_bgRgb: typeof bgRgb;
120
+ declare const ansi_bgWhite: typeof bgWhite;
121
+ declare const ansi_bgYellow: typeof bgYellow;
122
+ declare const ansi_black: typeof black;
60
123
  declare const ansi_blue: typeof blue;
61
124
  declare const ansi_bold: typeof bold;
125
+ declare const ansi_color256: typeof color256;
62
126
  declare const ansi_cyan: typeof cyan;
63
127
  declare const ansi_dim: typeof dim;
64
128
  declare const ansi_format: typeof format;
65
129
  declare const ansi_gray: typeof gray;
66
130
  declare const ansi_green: typeof green;
131
+ declare const ansi_hex: typeof hex;
132
+ declare const ansi_inverse: typeof inverse;
67
133
  declare const ansi_isColorSupported: typeof isColorSupported;
68
134
  declare const ansi_italic: typeof italic;
69
135
  declare const ansi_magenta: typeof magenta;
70
136
  declare const ansi_red: typeof red;
71
137
  declare const ansi_reset: typeof reset;
138
+ declare const ansi_rgb: typeof rgb;
139
+ declare const ansi_stripAnsi: typeof stripAnsi;
72
140
  declare const ansi_underline: typeof underline;
73
141
  declare const ansi_white: typeof white;
74
142
  declare const ansi_yellow: typeof yellow;
75
143
  declare namespace ansi {
76
- export { ansi_blue as blue, ansi_bold as bold, ansi_cyan as cyan, ansi_dim as dim, ansi_format as format, ansi_gray as gray, ansi_green as green, ansi_isColorSupported as isColorSupported, ansi_italic as italic, ansi_magenta as magenta, ansi_red as red, ansi_reset as reset, ansi_underline as underline, ansi_white as white, ansi_yellow as yellow };
144
+ export { ansi_bgBlack as bgBlack, ansi_bgBlue as bgBlue, ansi_bgColor256 as bgColor256, ansi_bgCyan as bgCyan, ansi_bgGreen as bgGreen, ansi_bgHex as bgHex, ansi_bgMagenta as bgMagenta, ansi_bgRed as bgRed, ansi_bgRgb as bgRgb, ansi_bgWhite as bgWhite, ansi_bgYellow as bgYellow, ansi_black as black, ansi_blue as blue, ansi_bold as bold, ansi_color256 as color256, ansi_cyan as cyan, ansi_dim as dim, ansi_format as format, ansi_gray as gray, ansi_green as green, ansi_hex as hex, ansi_inverse as inverse, ansi_isColorSupported as isColorSupported, ansi_italic as italic, ansi_magenta as magenta, ansi_red as red, ansi_reset as reset, ansi_rgb as rgb, ansi_stripAnsi as stripAnsi, ansi_underline as underline, ansi_white as white, ansi_yellow as yellow };
77
145
  }
78
146
 
79
- export { Logger, type LoggerOptions, type Theme, ansi, createLogger, defaultTheme };
147
+ export { ConsoleTransport, LogLevel, type LogLevelName, Logger, type LoggerOptions, type Theme, type Transport, type TransportContext, ansi, classicTheme, createLogger, defaultTheme, minimalTheme, modernTheme };
package/dist/index.js CHANGED
@@ -1 +1,4 @@
1
- 'use strict';var l=Object.defineProperty;var x=(t,r)=>{for(var s in r)l(t,s,{get:r[s],enumerable:true});};var h={};x(h,{blue:()=>g,bold:()=>m,cyan:()=>d,dim:()=>b,format:()=>e,gray:()=>c,green:()=>o,isColorSupported:()=>u,italic:()=>$,magenta:()=>T,red:()=>n,reset:()=>w,underline:()=>y,white:()=>v,yellow:()=>i});var u=!process.env.NO_COLOR&&(process.env.FORCE_COLOR||process.stdout?.isTTY||process.env.TERM==="xterm-256color"),e=(t,r)=>u?`\x1B[${t}m${r}\x1B[0m`:r,w=t=>e(0,t),n=t=>e(31,t),o=t=>e(32,t),i=t=>e(33,t),g=t=>e(34,t),T=t=>e(35,t),d=t=>e(36,t),v=t=>e(37,t),c=t=>e(90,t),m=t=>e(1,t),b=t=>e(2,t),$=t=>e(3,t),y=t=>e(4,t);var p={success:t=>o(t),error:t=>n(m(t)),warn:t=>i(t),info:t=>g(t),prefix:{success:o("\u2714"),error:n("\u2716"),warn:i("\u26A0"),info:g("\u2139")}};var O={success:console.log,error:console.error,warn:console.warn,info:console.info},a=class{theme;timestamps;colors;transport;constructor(r={}){this.theme={...p,...r.theme,prefix:{...p.prefix,...r.theme?.prefix}},this.timestamps=r.timestamps??false,this.colors=r.colors??true,this.transport={...O,...r.transport};}getTimestamp(){if(!this.timestamps)return "";let s=new Date().toISOString().split("T")[1]?.split(".")[0];return c(`[${s}] `)}formatMessage(r){return r.map(s=>{if(typeof s=="string")return s;try{return JSON.stringify(s,null,2)}catch{return "[Unserializable Object]"}}).join(" ")}stripAnsi(r){return r.replace(/\x1b\[[0-9;]*m/g,"")}output(r,s){let f=this.colors?s:this.stripAnsi(s);this.transport[r](f);}success(...r){let s=this.formatMessage(r);this.output("success",`${this.getTimestamp()}${this.theme.prefix.success} ${this.theme.success(s)}`);}error(...r){let s=this.formatMessage(r);this.output("error",`${this.getTimestamp()}${this.theme.prefix.error} ${this.theme.error(s)}`);}warn(...r){let s=this.formatMessage(r);this.output("warn",`${this.getTimestamp()}${this.theme.prefix.warn} ${this.theme.warn(s)}`);}info(...r){let s=this.formatMessage(r);this.output("info",`${this.getTimestamp()}${this.theme.prefix.info} ${this.theme.info(s)}`);}},k=t=>new a(t);exports.Logger=a;exports.ansi=h;exports.createLogger=k;exports.defaultTheme=p;
1
+ 'use strict';var M=Object.defineProperty;var A=(t,r)=>{for(var e in r)M(t,e,{get:r[e],enumerable:true});};var I={};A(I,{bgBlack:()=>F,bgBlue:()=>Y,bgColor256:()=>tt,bgCyan:()=>G,bgGreen:()=>U,bgHex:()=>Q,bgMagenta:()=>D,bgRed:()=>L,bgRgb:()=>R,bgWhite:()=>H,bgYellow:()=>W,black:()=>B,blue:()=>J,bold:()=>P,color256:()=>X,cyan:()=>v,dim:()=>h,format:()=>i,gray:()=>b,green:()=>w,hex:()=>s,inverse:()=>K,isColorSupported:()=>p,italic:()=>Z,magenta:()=>_,red:()=>d,reset:()=>V,rgb:()=>S,stripAnsi:()=>u,underline:()=>q,white:()=>z,yellow:()=>T});var x=process.env,p=!x.NO_COLOR&&(x.FORCE_COLOR||process.stdout&&process.stdout.isTTY||x.TERM==="xterm-256color"||x.CI==="true"),i=(t,r)=>p?`\x1B[${t}m${r}\x1B[0m`:r,V=t=>i(0,t),B=t=>i(30,t),d=t=>i(31,t),w=t=>i(32,t),T=t=>i(33,t),J=t=>i(34,t),_=t=>i(35,t),v=t=>i(36,t),z=t=>i(37,t),b=t=>i(90,t),F=t=>i(40,t),L=t=>i(41,t),U=t=>i(42,t),W=t=>i(43,t),Y=t=>i(44,t),D=t=>i(45,t),G=t=>i(46,t),H=t=>i(47,t),P=t=>i(1,t),h=t=>i(2,t),Z=t=>i(3,t),q=t=>i(4,t),K=t=>i(7,t),S=(t,r,e,o)=>p?`\x1B[38;2;${t};${r};${e}m${o}\x1B[0m`:o,R=(t,r,e,o)=>p?`\x1B[48;2;${t};${r};${e}m${o}\x1B[0m`:o,s=(t,r)=>{if(!p)return r;let e=t.replace(/^#/,"");return e.length!==6?r:S(parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16),r)},Q=(t,r)=>{if(!p)return r;let e=t.replace(/^#/,"");return e.length!==6?r:R(parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16),r)},X=(t,r)=>p?`\x1B[38;5;${t}m${r}\x1B[0m`:r,tt=(t,r)=>p?`\x1B[48;5;${t}m${r}\x1B[0m`:r,u=t=>t.replace(/\x1b\[[0-9;]*m/g,"");var N={success:t=>s("#10b981",t),error:t=>s("#f43f5e",t),warn:t=>s("#f59e0b",t),info:t=>s("#38bdf8",t),prefix:{success:s("#10b981","\u2714")+" "+s("#34d399",h("success")),error:s("#f43f5e","\u2716")+" "+s("#fb7185",h("error")),warn:s("#f59e0b","\u26A0")+" "+s("#fbbf24",h("warn")),info:s("#38bdf8","\u2139")+" "+s("#7dd3fc",h("info"))}},rt={success:t=>t,error:t=>t,warn:t=>t,info:t=>t,prefix:{success:s("#10b981","\u2714"),error:s("#f43f5e","\u2716"),warn:s("#f59e0b","\u26A0"),info:s("#38bdf8","\u2139")}},et={success:t=>w(t),error:t=>d(t),warn:t=>T(t),info:t=>v(t),prefix:{success:w("SUCCESS"),error:d("ERROR"),warn:T("WARN"),info:v("INFO")}},$=N;var y=(n=>(n[n.trace=10]="trace",n[n.debug=20]="debug",n[n.info=30]="info",n[n.success=35]="success",n[n.warn=40]="warn",n[n.error=50]="error",n[n.fatal=60]="fatal",n[n.none=100]="none",n))(y||{}),C=class{write(r){(r.levelValue>=50?console.error:console.log)(r.formatted);}},k=class{theme;timestamps;colors;level;mode;transports;timeCache={time:"",str:""};constructor(r={}){this.theme={...$,...r.theme,prefix:{...$.prefix,...r.theme?.prefix}},this.timestamps=r.timestamps??false,this.colors=r.colors??!!p,this.level=y[r.level??"trace"],this.mode=r.mode??"text",this.transports=r.transports??[new C];}shouldLog(r){return r>=this.level}getTimestamp(){if(!this.timestamps)return {iso:"",formatted:""};let e=new Date().toISOString(),o=e.split("T")[1]?.split(".")[0]||"";if(this.timeCache.time===o)return {iso:e,formatted:this.timeCache.str};let g=b(`[${o}] `);return this.timeCache={time:o,str:g},{iso:e,formatted:g}}safeStringify(r,e){let o=new Set;return JSON.stringify(r,(g,a)=>{if(typeof a=="object"&&a!==null){if(o.has(a))return "[Circular]";o.add(a);}return a},e)}highlightJson(r){return !this.colors||r.length>5e3?r:r.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,e=>/^"/.test(e)?/:$/.test(e)?s("#9ca3af",e.slice(0,-1))+":":s("#34d399",e):/true|false/.test(e)?s("#c084fc",e):/null/.test(e)?s("#f87171",e):s("#fbbf24",e))}formatMessage(r){return r.map(e=>{if(typeof e=="string")return e;if(e instanceof Error)return e.stack||e.message;try{return `
2
+ `+this.highlightJson(this.safeStringify(e,2))}catch{return "[Unserializable]"}}).join(" ")}emit(r,e,o,g){let a=y[r];if(!this.shouldLog(a))return;let f=this.getTimestamp(),m,n;if(this.mode==="json"){let c={level:r,time:f.iso,message:g.length===1?g[0]:g};m=n=this.safeStringify(c);}else {let c=this.formatMessage(g);m=`${f.formatted}${e} ${o(c)}`,n=u(m),this.colors||(m=n);}this.dispatch(r,a,g,m,n,f.iso);}dispatch(r,e,o,g,a,f){let m={level:r,levelValue:e,message:o,formatted:g,raw:a,timestamp:f};for(let n=0;n<this.transports.length;n++)this.transports[n]?.write(m);}success(...r){this.emit("success",this.theme.prefix.success,this.theme.success,r);}error(...r){this.emit("error",this.theme.prefix.error,this.theme.error,r);}warn(...r){this.emit("warn",this.theme.prefix.warn,this.theme.warn,r);}info(...r){this.emit("info",this.theme.prefix.info,this.theme.info,r);}trace(...r){this.emit("trace",b("\u{1F50D}"),b,r);}debug(...r){this.emit("debug",s("#94a3b8","\u{1F41B}"),e=>s("#94a3b8",e),r);}fatal(...r){this.emit("fatal",s("#be123c","\u{1F480}"),e=>s("#be123c",e),r);}box(r,e){let o=30;if(!this.shouldLog(o))return;let g=e.split(`
3
+ `),a=Math.max(r.length,...g.map(l=>u(l).length))+4,f=`\u250C\u2500 ${r} ${"\u2500".repeat(a-r.length-3)}\u2510`,m=`\u2514${"\u2500".repeat(a)}\u2518`,n=g.map(l=>{let E=a-u(l).length-2;return `\u2502 ${l}${" ".repeat(Math.max(0,E))} \u2502`}),c=[f,...n,m].join(`
4
+ `),O=u(c);if(this.mode==="json"){let l=this.getTimestamp();c=O=this.safeStringify({level:"info",time:l.iso,title:r,message:e}),this.dispatch("info",o,[e],c,O,l.iso);return}this.colors&&(c=s("#38bdf8",c));let j=this.getTimestamp();this.dispatch("info",o,[e],c,O,j.iso);}},st=t=>new k(t);exports.ConsoleTransport=C;exports.LogLevel=y;exports.Logger=k;exports.ansi=I;exports.classicTheme=et;exports.createLogger=st;exports.defaultTheme=$;exports.minimalTheme=rt;exports.modernTheme=N;
package/dist/index.mjs CHANGED
@@ -1 +1,4 @@
1
- var l=Object.defineProperty;var x=(t,r)=>{for(var s in r)l(t,s,{get:r[s],enumerable:true});};var h={};x(h,{blue:()=>g,bold:()=>m,cyan:()=>d,dim:()=>b,format:()=>e,gray:()=>c,green:()=>o,isColorSupported:()=>u,italic:()=>$,magenta:()=>T,red:()=>n,reset:()=>w,underline:()=>y,white:()=>v,yellow:()=>i});var u=!process.env.NO_COLOR&&(process.env.FORCE_COLOR||process.stdout?.isTTY||process.env.TERM==="xterm-256color"),e=(t,r)=>u?`\x1B[${t}m${r}\x1B[0m`:r,w=t=>e(0,t),n=t=>e(31,t),o=t=>e(32,t),i=t=>e(33,t),g=t=>e(34,t),T=t=>e(35,t),d=t=>e(36,t),v=t=>e(37,t),c=t=>e(90,t),m=t=>e(1,t),b=t=>e(2,t),$=t=>e(3,t),y=t=>e(4,t);var p={success:t=>o(t),error:t=>n(m(t)),warn:t=>i(t),info:t=>g(t),prefix:{success:o("\u2714"),error:n("\u2716"),warn:i("\u26A0"),info:g("\u2139")}};var O={success:console.log,error:console.error,warn:console.warn,info:console.info},a=class{theme;timestamps;colors;transport;constructor(r={}){this.theme={...p,...r.theme,prefix:{...p.prefix,...r.theme?.prefix}},this.timestamps=r.timestamps??false,this.colors=r.colors??true,this.transport={...O,...r.transport};}getTimestamp(){if(!this.timestamps)return "";let s=new Date().toISOString().split("T")[1]?.split(".")[0];return c(`[${s}] `)}formatMessage(r){return r.map(s=>{if(typeof s=="string")return s;try{return JSON.stringify(s,null,2)}catch{return "[Unserializable Object]"}}).join(" ")}stripAnsi(r){return r.replace(/\x1b\[[0-9;]*m/g,"")}output(r,s){let f=this.colors?s:this.stripAnsi(s);this.transport[r](f);}success(...r){let s=this.formatMessage(r);this.output("success",`${this.getTimestamp()}${this.theme.prefix.success} ${this.theme.success(s)}`);}error(...r){let s=this.formatMessage(r);this.output("error",`${this.getTimestamp()}${this.theme.prefix.error} ${this.theme.error(s)}`);}warn(...r){let s=this.formatMessage(r);this.output("warn",`${this.getTimestamp()}${this.theme.prefix.warn} ${this.theme.warn(s)}`);}info(...r){let s=this.formatMessage(r);this.output("info",`${this.getTimestamp()}${this.theme.prefix.info} ${this.theme.info(s)}`);}},k=t=>new a(t);export{a as Logger,h as ansi,k as createLogger,p as defaultTheme};
1
+ var M=Object.defineProperty;var A=(t,r)=>{for(var e in r)M(t,e,{get:r[e],enumerable:true});};var I={};A(I,{bgBlack:()=>F,bgBlue:()=>Y,bgColor256:()=>tt,bgCyan:()=>G,bgGreen:()=>U,bgHex:()=>Q,bgMagenta:()=>D,bgRed:()=>L,bgRgb:()=>R,bgWhite:()=>H,bgYellow:()=>W,black:()=>B,blue:()=>J,bold:()=>P,color256:()=>X,cyan:()=>v,dim:()=>h,format:()=>i,gray:()=>b,green:()=>w,hex:()=>s,inverse:()=>K,isColorSupported:()=>p,italic:()=>Z,magenta:()=>_,red:()=>d,reset:()=>V,rgb:()=>S,stripAnsi:()=>u,underline:()=>q,white:()=>z,yellow:()=>T});var x=process.env,p=!x.NO_COLOR&&(x.FORCE_COLOR||process.stdout&&process.stdout.isTTY||x.TERM==="xterm-256color"||x.CI==="true"),i=(t,r)=>p?`\x1B[${t}m${r}\x1B[0m`:r,V=t=>i(0,t),B=t=>i(30,t),d=t=>i(31,t),w=t=>i(32,t),T=t=>i(33,t),J=t=>i(34,t),_=t=>i(35,t),v=t=>i(36,t),z=t=>i(37,t),b=t=>i(90,t),F=t=>i(40,t),L=t=>i(41,t),U=t=>i(42,t),W=t=>i(43,t),Y=t=>i(44,t),D=t=>i(45,t),G=t=>i(46,t),H=t=>i(47,t),P=t=>i(1,t),h=t=>i(2,t),Z=t=>i(3,t),q=t=>i(4,t),K=t=>i(7,t),S=(t,r,e,o)=>p?`\x1B[38;2;${t};${r};${e}m${o}\x1B[0m`:o,R=(t,r,e,o)=>p?`\x1B[48;2;${t};${r};${e}m${o}\x1B[0m`:o,s=(t,r)=>{if(!p)return r;let e=t.replace(/^#/,"");return e.length!==6?r:S(parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16),r)},Q=(t,r)=>{if(!p)return r;let e=t.replace(/^#/,"");return e.length!==6?r:R(parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16),r)},X=(t,r)=>p?`\x1B[38;5;${t}m${r}\x1B[0m`:r,tt=(t,r)=>p?`\x1B[48;5;${t}m${r}\x1B[0m`:r,u=t=>t.replace(/\x1b\[[0-9;]*m/g,"");var N={success:t=>s("#10b981",t),error:t=>s("#f43f5e",t),warn:t=>s("#f59e0b",t),info:t=>s("#38bdf8",t),prefix:{success:s("#10b981","\u2714")+" "+s("#34d399",h("success")),error:s("#f43f5e","\u2716")+" "+s("#fb7185",h("error")),warn:s("#f59e0b","\u26A0")+" "+s("#fbbf24",h("warn")),info:s("#38bdf8","\u2139")+" "+s("#7dd3fc",h("info"))}},rt={success:t=>t,error:t=>t,warn:t=>t,info:t=>t,prefix:{success:s("#10b981","\u2714"),error:s("#f43f5e","\u2716"),warn:s("#f59e0b","\u26A0"),info:s("#38bdf8","\u2139")}},et={success:t=>w(t),error:t=>d(t),warn:t=>T(t),info:t=>v(t),prefix:{success:w("SUCCESS"),error:d("ERROR"),warn:T("WARN"),info:v("INFO")}},$=N;var y=(n=>(n[n.trace=10]="trace",n[n.debug=20]="debug",n[n.info=30]="info",n[n.success=35]="success",n[n.warn=40]="warn",n[n.error=50]="error",n[n.fatal=60]="fatal",n[n.none=100]="none",n))(y||{}),C=class{write(r){(r.levelValue>=50?console.error:console.log)(r.formatted);}},k=class{theme;timestamps;colors;level;mode;transports;timeCache={time:"",str:""};constructor(r={}){this.theme={...$,...r.theme,prefix:{...$.prefix,...r.theme?.prefix}},this.timestamps=r.timestamps??false,this.colors=r.colors??!!p,this.level=y[r.level??"trace"],this.mode=r.mode??"text",this.transports=r.transports??[new C];}shouldLog(r){return r>=this.level}getTimestamp(){if(!this.timestamps)return {iso:"",formatted:""};let e=new Date().toISOString(),o=e.split("T")[1]?.split(".")[0]||"";if(this.timeCache.time===o)return {iso:e,formatted:this.timeCache.str};let g=b(`[${o}] `);return this.timeCache={time:o,str:g},{iso:e,formatted:g}}safeStringify(r,e){let o=new Set;return JSON.stringify(r,(g,a)=>{if(typeof a=="object"&&a!==null){if(o.has(a))return "[Circular]";o.add(a);}return a},e)}highlightJson(r){return !this.colors||r.length>5e3?r:r.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,e=>/^"/.test(e)?/:$/.test(e)?s("#9ca3af",e.slice(0,-1))+":":s("#34d399",e):/true|false/.test(e)?s("#c084fc",e):/null/.test(e)?s("#f87171",e):s("#fbbf24",e))}formatMessage(r){return r.map(e=>{if(typeof e=="string")return e;if(e instanceof Error)return e.stack||e.message;try{return `
2
+ `+this.highlightJson(this.safeStringify(e,2))}catch{return "[Unserializable]"}}).join(" ")}emit(r,e,o,g){let a=y[r];if(!this.shouldLog(a))return;let f=this.getTimestamp(),m,n;if(this.mode==="json"){let c={level:r,time:f.iso,message:g.length===1?g[0]:g};m=n=this.safeStringify(c);}else {let c=this.formatMessage(g);m=`${f.formatted}${e} ${o(c)}`,n=u(m),this.colors||(m=n);}this.dispatch(r,a,g,m,n,f.iso);}dispatch(r,e,o,g,a,f){let m={level:r,levelValue:e,message:o,formatted:g,raw:a,timestamp:f};for(let n=0;n<this.transports.length;n++)this.transports[n]?.write(m);}success(...r){this.emit("success",this.theme.prefix.success,this.theme.success,r);}error(...r){this.emit("error",this.theme.prefix.error,this.theme.error,r);}warn(...r){this.emit("warn",this.theme.prefix.warn,this.theme.warn,r);}info(...r){this.emit("info",this.theme.prefix.info,this.theme.info,r);}trace(...r){this.emit("trace",b("\u{1F50D}"),b,r);}debug(...r){this.emit("debug",s("#94a3b8","\u{1F41B}"),e=>s("#94a3b8",e),r);}fatal(...r){this.emit("fatal",s("#be123c","\u{1F480}"),e=>s("#be123c",e),r);}box(r,e){let o=30;if(!this.shouldLog(o))return;let g=e.split(`
3
+ `),a=Math.max(r.length,...g.map(l=>u(l).length))+4,f=`\u250C\u2500 ${r} ${"\u2500".repeat(a-r.length-3)}\u2510`,m=`\u2514${"\u2500".repeat(a)}\u2518`,n=g.map(l=>{let E=a-u(l).length-2;return `\u2502 ${l}${" ".repeat(Math.max(0,E))} \u2502`}),c=[f,...n,m].join(`
4
+ `),O=u(c);if(this.mode==="json"){let l=this.getTimestamp();c=O=this.safeStringify({level:"info",time:l.iso,title:r,message:e}),this.dispatch("info",o,[e],c,O,l.iso);return}this.colors&&(c=s("#38bdf8",c));let j=this.getTimestamp();this.dispatch("info",o,[e],c,O,j.iso);}},st=t=>new k(t);export{C as ConsoleTransport,y as LogLevel,k as Logger,I as ansi,et as classicTheme,st as createLogger,$ as defaultTheme,rt as minimalTheme,N as modernTheme};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devink",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Fast, lightweight, professional logger built with TypeScript. No dependencies.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",