@meadown/logger 1.5.0 → 1.5.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 +24 -10
- package/SECURITY.md +50 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -14,7 +14,11 @@ No dependencies. No config. Import it and you're done.
|
|
|
14
14
|
## Install
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
+
pnpm add @meadown/logger
|
|
18
|
+
# or
|
|
17
19
|
npm install @meadown/logger
|
|
20
|
+
# or
|
|
21
|
+
yarn add @meadown/logger
|
|
18
22
|
```
|
|
19
23
|
|
|
20
24
|
## Using it
|
|
@@ -32,14 +36,15 @@ customLog.error("Something went wrong")
|
|
|
32
36
|
You'll see something like:
|
|
33
37
|
|
|
34
38
|
```text
|
|
35
|
-
[INFO]
|
|
36
|
-
|
|
39
|
+
[INFO]
|
|
40
|
+
├── Auth user logged in
|
|
41
|
+
└── 05-30 04:00:00 PM - (server.ts:42)
|
|
37
42
|
```
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
to scan
|
|
44
|
+
Each entry is a little tree: the level tag — `[INFO]`, `[WARN]`, or `[ERROR]` — on
|
|
45
|
+
top, your message hanging off a `├──` branch, and a short local timestamp
|
|
46
|
+
(month-day, 12-hour time) plus the source location on the `└──` branch below.
|
|
47
|
+
Entries are spaced apart by a blank line so they're easy to scan in a busy terminal.
|
|
43
48
|
|
|
44
49
|
### One thing if you re-export it
|
|
45
50
|
|
|
@@ -59,12 +64,13 @@ export const customLog = (...args) => log(...args)
|
|
|
59
64
|
## Color-coded levels
|
|
60
65
|
|
|
61
66
|
The level tag is colored so you can spot what matters at a glance — `[INFO]` in
|
|
62
|
-
cyan, `[WARN]` in yellow, `[ERROR]` in red. The
|
|
63
|
-
|
|
67
|
+
cyan, `[WARN]` in yellow, `[ERROR]` in red. The timestamp and source location are
|
|
68
|
+
tinted teal, and the tree branches sit in a quiet gray, so the colored level tag is
|
|
69
|
+
what your eye lands on first.
|
|
64
70
|
|
|
65
71
|
Colors appear automatically when you're in a terminal. When output is piped to a
|
|
66
|
-
file or another program,
|
|
67
|
-
|
|
72
|
+
file or another program, everything prints as plain text — no stray color codes in
|
|
73
|
+
your log files. Nothing to configure.
|
|
68
74
|
|
|
69
75
|
## Click to open the source
|
|
70
76
|
|
|
@@ -108,6 +114,14 @@ developing and go silent in production. The only thing that flips the switch is
|
|
|
108
114
|
So leave your logs in the code. Once you ship with `NODE_ENV=production`, they just
|
|
109
115
|
quietly step aside.
|
|
110
116
|
|
|
117
|
+
## Security
|
|
118
|
+
|
|
119
|
+
It's a tiny, zero-dependency package with no file, network, or dynamic-code access.
|
|
120
|
+
See [SECURITY.md](https://github.com/meadown/meadown-logger/blob/main/SECURITY.md)
|
|
121
|
+
for the security model and how to report a vulnerability. One thing to know: like
|
|
122
|
+
`console.log`, log arguments are written to the terminal as-is and are not
|
|
123
|
+
sanitized — don't log untrusted data to a terminal you trust.
|
|
124
|
+
|
|
111
125
|
## License
|
|
112
126
|
|
|
113
127
|
MIT © meadown
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Reporting a vulnerability
|
|
4
|
+
|
|
5
|
+
Please report security issues **privately** by email to
|
|
6
|
+
[inbox.meadown@gmail.com](mailto:inbox.meadown@gmail.com).
|
|
7
|
+
|
|
8
|
+
Include a description, the affected version, and steps to reproduce. We aim to
|
|
9
|
+
acknowledge reports within a few days and to coordinate a fix and disclosure.
|
|
10
|
+
|
|
11
|
+
> Once this repository is public, reports can also be filed via GitHub Security
|
|
12
|
+
> Advisories ("Report a vulnerability" under the Security tab).
|
|
13
|
+
|
|
14
|
+
## Supported versions
|
|
15
|
+
|
|
16
|
+
Only the latest published `@meadown/logger` release receives security fixes.
|
|
17
|
+
|
|
18
|
+
## Security model
|
|
19
|
+
|
|
20
|
+
`@meadown/logger` is intentionally minimal, which keeps its attack surface small:
|
|
21
|
+
|
|
22
|
+
- **Zero runtime dependencies.** Installing the package pulls in no transitive
|
|
23
|
+
packages, so there is no third-party supply-chain surface to inherit.
|
|
24
|
+
- **No I/O or dynamic execution.** It does not read or write files, open network
|
|
25
|
+
connections, spawn processes, or use `eval`/`Function`. It only writes to the
|
|
26
|
+
console and reads `process.env.NODE_ENV` (to stay quiet in production).
|
|
27
|
+
- **Nothing is persisted.** Log output is never written to disk, so the logger
|
|
28
|
+
cannot leak logged data to a temp file or similar.
|
|
29
|
+
|
|
30
|
+
## Trust boundary: log arguments are output, not input
|
|
31
|
+
|
|
32
|
+
Like `console.log` itself, this logger passes the arguments you give it through
|
|
33
|
+
to the terminal as output. **It does not sanitize them.**
|
|
34
|
+
|
|
35
|
+
If you log **untrusted data** (user input, third-party API responses, etc.) that
|
|
36
|
+
contains terminal control or escape sequences (ANSI `\x1b[…`, OSC-8 hyperlinks,
|
|
37
|
+
carriage returns), those sequences reach the terminal and can manipulate it —
|
|
38
|
+
e.g. overwrite previously printed text or spoof a clickable link. This is an
|
|
39
|
+
inherent property of writing untrusted text to a terminal, not specific to this
|
|
40
|
+
package.
|
|
41
|
+
|
|
42
|
+
Guidance:
|
|
43
|
+
|
|
44
|
+
- Treat log output as you would any other untrusted text rendered in a terminal.
|
|
45
|
+
- Do not log raw untrusted input to a terminal or log stream you treat as
|
|
46
|
+
trusted; sanitize or encode it first if that is a concern in your environment.
|
|
47
|
+
|
|
48
|
+
The clickable source link the logger emits is built from the runtime call
|
|
49
|
+
stack's file path (encoded via `node:url`'s `pathToFileURL`), not from your
|
|
50
|
+
arguments, so the logger's own escape sequences are not attacker-influenced.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meadown/logger",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "A tiny, zero-dependency logger for Node.js and TypeScript that tags each line, timestamps it, shows the source file and line, and goes quiet in production.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"logger",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"files": [
|
|
42
|
-
"dist"
|
|
42
|
+
"dist",
|
|
43
|
+
"SECURITY.md"
|
|
43
44
|
],
|
|
44
45
|
"engines": {
|
|
45
46
|
"node": ">=18"
|