@meadown/logger 1.8.8 → 1.8.9
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
|
@@ -30,7 +30,7 @@ tells you where things came from and disappears when you ship.
|
|
|
30
30
|
|
|
31
31
|
- **Zero dependencies**
|
|
32
32
|
- **Development-focused** — built for the dev experience, not production ops
|
|
33
|
-
- **Clickable source link** — every log is a clickable link to the exact file it came from
|
|
33
|
+
- **Clickable source link** — every log is a clickable link that jumps to the exact file and line it came from
|
|
34
34
|
- **Tap logging** — log any value or promise inline; fetch calls also get timing, status, size, and body
|
|
35
35
|
- **Color-coded levels** — `[INFO]` cyan, `[WARN]` yellow, `[ERROR]` red
|
|
36
36
|
- **Tree layout output** — clean, scannable structure in your terminal
|
|
@@ -163,9 +163,7 @@ as the fetch example above.
|
|
|
163
163
|
|
|
164
164
|
## Clickable source link
|
|
165
165
|
|
|
166
|
-
That `(server.ts:42)` is a **clickable link**. Click it and the file
|
|
167
|
-
The line number is right there so you can jump straight to it. Works in VS Code,
|
|
168
|
-
iTerm2, WezTerm, Kitty, and Windows Terminal. Degrades to plain text everywhere else.
|
|
166
|
+
That `(server.ts:42)` is a **clickable link**. Click it and your editor opens the file and jumps straight to that line. Works in VS Code, iTerm2, WezTerm, Kitty, and Windows Terminal. Degrades to plain text everywhere else.
|
|
169
167
|
|
|
170
168
|
## Color-coded levels
|
|
171
169
|
|
|
@@ -61,7 +61,7 @@ function renderMessage(args, useColor) {
|
|
|
61
61
|
*/
|
|
62
62
|
function formatLocation(caller, interactive) {
|
|
63
63
|
if (caller.file !== null && caller.line !== null && interactive)
|
|
64
|
-
return (0, link_js_1.hyperlink)(caller.label, (0, link_js_1.fileUrl)(caller.file));
|
|
64
|
+
return (0, link_js_1.hyperlink)(caller.label, (0, link_js_1.fileUrl)(caller.file, caller.line));
|
|
65
65
|
return caller.label;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Builds a
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* which would look for a file literally named `foo.ts:42`). The line number
|
|
6
|
-
* stays visible in the link's display text instead.
|
|
2
|
+
* Builds a `file://` URL for a path so terminals can open it on click.
|
|
3
|
+
* When `line` is provided, appends `:line` so supporting terminals (VS Code,
|
|
4
|
+
* iTerm2, WezTerm) jump straight to that line.
|
|
7
5
|
*/
|
|
8
|
-
export declare function fileUrl(file: string): string;
|
|
6
|
+
export declare function fileUrl(file: string, line?: number): string;
|
|
9
7
|
/**
|
|
10
8
|
* Wraps `text` in an OSC-8 terminal hyperlink pointing at `url`. Terminals that
|
|
11
9
|
* support OSC-8 render `text` as a clickable link; others ignore the escape and
|
|
@@ -10,14 +10,13 @@ exports.fileUrl = fileUrl;
|
|
|
10
10
|
exports.hyperlink = hyperlink;
|
|
11
11
|
const node_url_1 = require("node:url");
|
|
12
12
|
/**
|
|
13
|
-
* Builds a
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* which would look for a file literally named `foo.ts:42`). The line number
|
|
17
|
-
* stays visible in the link's display text instead.
|
|
13
|
+
* Builds a `file://` URL for a path so terminals can open it on click.
|
|
14
|
+
* When `line` is provided, appends `:line` so supporting terminals (VS Code,
|
|
15
|
+
* iTerm2, WezTerm) jump straight to that line.
|
|
18
16
|
*/
|
|
19
|
-
function fileUrl(file) {
|
|
20
|
-
|
|
17
|
+
function fileUrl(file, line) {
|
|
18
|
+
const base = file.startsWith("file://") ? file : (0, node_url_1.pathToFileURL)(file).href;
|
|
19
|
+
return line != null ? `${base}:${line}` : base;
|
|
21
20
|
}
|
|
22
21
|
/**
|
|
23
22
|
* Wraps `text` in an OSC-8 terminal hyperlink pointing at `url`. Terminals that
|
package/dist/core/writeLog.js
CHANGED
|
@@ -53,7 +53,7 @@ function renderMessage(args, useColor) {
|
|
|
53
53
|
*/
|
|
54
54
|
function formatLocation(caller, interactive) {
|
|
55
55
|
if (caller.file !== null && caller.line !== null && interactive)
|
|
56
|
-
return hyperlink(caller.label, fileUrl(caller.file));
|
|
56
|
+
return hyperlink(caller.label, fileUrl(caller.file, caller.line));
|
|
57
57
|
return caller.label;
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Builds a
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* which would look for a file literally named `foo.ts:42`). The line number
|
|
6
|
-
* stays visible in the link's display text instead.
|
|
2
|
+
* Builds a `file://` URL for a path so terminals can open it on click.
|
|
3
|
+
* When `line` is provided, appends `:line` so supporting terminals (VS Code,
|
|
4
|
+
* iTerm2, WezTerm) jump straight to that line.
|
|
7
5
|
*/
|
|
8
|
-
export declare function fileUrl(file: string): string;
|
|
6
|
+
export declare function fileUrl(file: string, line?: number): string;
|
|
9
7
|
/**
|
|
10
8
|
* Wraps `text` in an OSC-8 terminal hyperlink pointing at `url`. Terminals that
|
|
11
9
|
* support OSC-8 render `text` as a clickable link; others ignore the escape and
|
package/dist/decorations/link.js
CHANGED
|
@@ -6,14 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { pathToFileURL } from "node:url";
|
|
8
8
|
/**
|
|
9
|
-
* Builds a
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* which would look for a file literally named `foo.ts:42`). The line number
|
|
13
|
-
* stays visible in the link's display text instead.
|
|
9
|
+
* Builds a `file://` URL for a path so terminals can open it on click.
|
|
10
|
+
* When `line` is provided, appends `:line` so supporting terminals (VS Code,
|
|
11
|
+
* iTerm2, WezTerm) jump straight to that line.
|
|
14
12
|
*/
|
|
15
|
-
export function fileUrl(file) {
|
|
16
|
-
|
|
13
|
+
export function fileUrl(file, line) {
|
|
14
|
+
const base = file.startsWith("file://") ? file : pathToFileURL(file).href;
|
|
15
|
+
return line != null ? `${base}:${line}` : base;
|
|
17
16
|
}
|
|
18
17
|
/**
|
|
19
18
|
* Wraps `text` in an OSC-8 terminal hyperlink pointing at `url`. Terminals that
|
package/package.json
CHANGED