@vibesdotdev/logging 0.0.1 → 0.0.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 +12 -70
- package/package.json +8 -9
- package/SPEC.md +0 -65
package/README.md
CHANGED
|
@@ -1,80 +1,22 @@
|
|
|
1
1
|
# @vibesdotdev/logging
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
isomorphic sinks/formatters, and the audit kind. Environment-specific sinks
|
|
5
|
-
(file, browser, OTEL) live in sibling packages.
|
|
3
|
+
Structured logging contracts, levels, formatters, and runtime descriptors for Vibes packages.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
This package is part of the public Vibes framework package set. The source repository is private while the public repository split is being prepared, so package documentation is published on the Vibes docs site.
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
import { getLogger, getDefaultLogger } from '@vibesdotdev/logging';
|
|
7
|
+
## Install
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const child = logger.child('database');
|
|
17
|
-
child.debug('Connected');
|
|
18
|
-
|
|
19
|
-
const contextual = logger.withRequestContext({
|
|
20
|
-
requestId: 'req-123',
|
|
21
|
-
userId: 'user-456',
|
|
22
|
-
});
|
|
23
|
-
contextual.info('Request handled');
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Audit
|
|
27
|
-
|
|
28
|
-
```ts
|
|
29
|
-
import { auditLog } from '@vibesdotdev/logging/audit';
|
|
30
|
-
|
|
31
|
-
await auditLog({
|
|
32
|
-
category: 'authentication',
|
|
33
|
-
severity: 'medium',
|
|
34
|
-
action: 'login',
|
|
35
|
-
actor: { id: 'user-123', type: 'user' },
|
|
36
|
-
outcome: 'success',
|
|
37
|
-
});
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Filter via env
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
VIBES_LOG='vibes:pm:*,-vibes:pm:verbose' \
|
|
44
|
-
VIBES_LOG_LEVEL=debug \
|
|
45
|
-
bun run app
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## CLI
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
vibes logs list
|
|
52
|
-
vibes logs view <output>
|
|
53
|
-
vibes logs tail <output>
|
|
54
|
-
vibes logs search <pattern>
|
|
55
|
-
vibes logs rotate <output>
|
|
9
|
+
```sh
|
|
10
|
+
bun add @vibesdotdev/logging
|
|
11
|
+
# or
|
|
12
|
+
npm install @vibesdotdev/logging
|
|
56
13
|
```
|
|
57
14
|
|
|
58
|
-
##
|
|
15
|
+
## Documentation
|
|
59
16
|
|
|
60
|
-
|
|
61
|
-
-
|
|
62
|
-
- `buffer` — in-memory startup buffer
|
|
63
|
-
- `memory` — testable in-memory store
|
|
64
|
-
- `stdout` — raw stderr (MCP-safe)
|
|
65
|
-
|
|
66
|
-
Environment-specific sinks load from sibling packages (apps choose what to load):
|
|
67
|
-
- [`@vibesdotdev/logging-fs`](../logging-fs/) — file sink, file output, stdout-capture, file-backed audit
|
|
68
|
-
- [`@vibesdotdev/logging-browser`](../logging-browser/) — browser sink
|
|
69
|
-
- [`@vibesdotdev/logging-otel`](../logging-otel/) — OpenTelemetry sink
|
|
70
|
-
|
|
71
|
-
## Test
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
bun test
|
|
75
|
-
```
|
|
17
|
+
- Package guide: https://docs.vibes.dev/packages/logging
|
|
18
|
+
- Vibes docs: https://docs.vibes.dev
|
|
76
19
|
|
|
77
|
-
##
|
|
20
|
+
## License
|
|
78
21
|
|
|
79
|
-
|
|
80
|
-
- [runtime](../runtime/SPEC.md), [runtime-plugin](../runtime-plugin/SPEC.md)
|
|
22
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibesdotdev/logging",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -280,16 +280,11 @@
|
|
|
280
280
|
"registry": "https://registry.npmjs.org",
|
|
281
281
|
"access": "public"
|
|
282
282
|
},
|
|
283
|
-
"repository": {
|
|
284
|
-
"type": "git",
|
|
285
|
-
"url": "git+https://github.com/vibesdotdev/monorepo.git",
|
|
286
|
-
"directory": "packages/logging"
|
|
287
|
-
},
|
|
288
283
|
"peerDependencies": {
|
|
289
|
-
"@vibesdotdev/runtime": "0.0.
|
|
284
|
+
"@vibesdotdev/runtime": "0.0.2"
|
|
290
285
|
},
|
|
291
286
|
"dependencies": {
|
|
292
|
-
"@vibesdotdev/runtime": "0.0.
|
|
287
|
+
"@vibesdotdev/runtime": "0.0.2",
|
|
293
288
|
"zod": "^4.3.6",
|
|
294
289
|
"esm-env": "^1.2.2",
|
|
295
290
|
"ansis": "^4.3.0",
|
|
@@ -306,7 +301,6 @@
|
|
|
306
301
|
"src",
|
|
307
302
|
"bin",
|
|
308
303
|
"README.md",
|
|
309
|
-
"SPEC.md",
|
|
310
304
|
"LICENSE",
|
|
311
305
|
"!src/**/__tests__/**",
|
|
312
306
|
"!src/**/__stubs__/**",
|
|
@@ -327,5 +321,10 @@
|
|
|
327
321
|
],
|
|
328
322
|
"vibes": {
|
|
329
323
|
"visibility": "public-framework"
|
|
324
|
+
},
|
|
325
|
+
"description": "Structured logging contracts, levels, formatters, and runtime descriptors for Vibes packages.",
|
|
326
|
+
"homepage": "https://docs.vibes.dev/packages/logging",
|
|
327
|
+
"bugs": {
|
|
328
|
+
"url": "https://docs.vibes.dev/packages/logging#support"
|
|
330
329
|
}
|
|
331
330
|
}
|
package/SPEC.md
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# @vibesdotdev/logging
|
|
2
|
-
|
|
3
|
-
Structured logging for vibes. Universal core: kinds, schemas, core logger, isomorphic sinks/formatters/outputs, audit kind, MCP-safe defaults. Environment-specific sinks live in sibling packages and register themselves.
|
|
4
|
-
|
|
5
|
-
## Owns
|
|
6
|
-
|
|
7
|
-
- **Runtime kinds:** `logging/sink`, `logging/formatter`, `logging/output`, `logging/audit`, `logging/logger`
|
|
8
|
-
- **Context providers:** `logging/sinks`, `logging/outputs`, `cli/logger`
|
|
9
|
-
- **Core** (`./core`): `createRuntimeLogger`, `getLogger(namespace)`, `getDefaultLogger`, child loggers, `withRequestContext`, glob-based namespace settings + per-namespace level
|
|
10
|
-
- **Isomorphic sinks** (`./sinks/*`): `console`, `buffer`, `memory`, `stdout`
|
|
11
|
-
- **Formatters** (`./formatters/*`): `jsonl`, `json`, `json5`, `pretty` (pure transforms — universal)
|
|
12
|
-
- **Universal outputs** (`./outputs/*`): `remote` (HTTP via fetch)
|
|
13
|
-
- **Audit** (`./audit`): `logging/audit` kind, descriptor schema, retention-policy schema. File-backed impl extracts to [`logging-fs`](../logging-fs/).
|
|
14
|
-
- **Schemas** (`./schemas`): `LogLevelSchema`, `RuntimeLogEntry`, `SinkDescriptor`, `FormatterDescriptor`, `OutputDescriptor`, `AuditEntry`, `AuditDescriptor`, `LoggerDescriptor`
|
|
15
|
-
- **CLI** (`./cli`): `vibes logs` group + `list/view/tail/search/rotate` descriptors. Commands query the runtime; they do not import environment-specific sinks/outputs.
|
|
16
|
-
- **Paths** (`./paths`): canonical log file path resolution (string-only, no FS)
|
|
17
|
-
- **Plugins:** `./plugin` (root) and `./cli-plugin` (CLI commands) — register kinds + isomorphic sinks/formatters/outputs only
|
|
18
|
-
|
|
19
|
-
## Does not own
|
|
20
|
-
|
|
21
|
-
- **Filesystem-backed sinks/outputs/audit impl** → [`logging-fs`](../logging-fs/) — `file` sink, `file` output, `stdout-capture` sink, file-backed audit logger
|
|
22
|
-
- **Browser sink** → [`logging-browser`](../logging-browser/)
|
|
23
|
-
- **OpenTelemetry sink** → [`logging-otel`](../logging-otel/) — owns OTEL peer deps
|
|
24
|
-
- **Daemon-specific logger config** → [`runtime-plugin/logging`](../runtime-plugin/SPEC.md)
|
|
25
|
-
- **App-specific audit policies.** Apps register their own `logging/audit` descriptors with domain rules.
|
|
26
|
-
- **Logging consumers** (apps calling `getLogger`)
|
|
27
|
-
- **Durable archival** (S3, etc.) — that's an output adapter, not core
|
|
28
|
-
|
|
29
|
-
## Hard rules
|
|
30
|
-
|
|
31
|
-
- **The core package is universal.** No Node/Bun/FS/process imports in core. Anything that breaks browser or Cloudflare bundles belongs in an environment-specific package.
|
|
32
|
-
- **All logging through `getLogger(ns)` / `getDefaultLogger()`.** No raw `console.log` in features.
|
|
33
|
-
- **Stdout is reserved (MCP-safe).** Universal sinks default to stderr. The `stdout-capture` sink (in `logging-fs`) redirects rogue stdout to a file.
|
|
34
|
-
- **Sink/output/audit selection is runtime-resolved.** Apps register descriptors; the runtime composes them into `logging/sinks` and `logging/outputs` context providers.
|
|
35
|
-
- **Sink package contract:** each environment-specific package exports a plugin that registers `logging/sink`, `logging/output`, or `logging/audit` descriptors + impls. Apps load only the packages their scope can support. Core never imports them.
|
|
36
|
-
- **Namespaces are colon-separated, hierarchical.** Filter via `VIBES_LOG` (globs with `+/-`); level via `VIBES_LOG_LEVEL`.
|
|
37
|
-
- **Audit entries are immutable, append-only, retention by category.** Categories: `authentication`, `authorization`, `security`, `data_access`, `data_modification`, `configuration`, `system`.
|
|
38
|
-
|
|
39
|
-
## Public entrypoints
|
|
40
|
-
|
|
41
|
-
`.`, `./plugin`, `./cli-plugin`, `./core`, `./core/logger`, `./core/namespace`, `./kinds`, `./kinds/sink`, `./kinds/formatter`, `./kinds/output`, `./kinds/audit`, `./kinds/logger`, `./kinds/logger.impl`, `./paths`, `./contexts`, `./contexts/logger`, `./contexts/audit`, `./schemas`, `./schemas/entry`, `./schemas/sink`, `./schemas/formatter`, `./schemas/output`, `./schemas/audit`, `./schemas/logger`, `./sinks` (universal-only barrel), `./formatters`, `./outputs` (universal-only barrel), `./audit` (kind/schema only), `./cli/types`, `./cli/logs.descriptor`, `./cli/logs.list.descriptor`, `./cli/logs.list.impl`, `./cli/logs.search.descriptor`, `./cli/logs.search.impl`, `./cli/logs.tail.descriptor`, `./cli/logs.tail.impl`, `./cli/logs.rotate.descriptor`, `./cli/logs.rotate.impl`, `./cli/logs.view.descriptor`, `./cli/logs.view.impl`.
|
|
42
|
-
|
|
43
|
-
Per-adapter sub-subpaths (`./sinks/console`, `./formatters/json`, `./outputs/remote`, …) are intentionally not exposed: the canonical access pattern is descriptor registration via the plugin + `runtime.query('logging/sink' | 'logging/formatter' | 'logging/output')`. Consumers do not import the impl files directly.
|
|
44
|
-
|
|
45
|
-
## Environment
|
|
46
|
-
|
|
47
|
-
| Variable | Default | Purpose |
|
|
48
|
-
| --- | --- | --- |
|
|
49
|
-
| `VIBES_LOG` | — | Namespace selectors (`vibes:pm:*,-vibes:pm:verbose`) |
|
|
50
|
-
| `VIBES_LOG_LEVEL` | `info` | Minimum level |
|
|
51
|
-
| `VIBES_LOG_DIR` | `~/.vibes/logs` | Log directory (consumed by `logging-fs`) |
|
|
52
|
-
| `VIBES_LOG_FILE` | `app.jsonl` | File sink filename (consumed by `logging-fs`) |
|
|
53
|
-
| `OTEL_SERVICE_NAME` | `vibes` | OTEL service name (consumed by `logging-otel`) |
|
|
54
|
-
| `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` | `http://localhost:4318/v1/logs` | OTEL endpoint |
|
|
55
|
-
| `MCP_ENABLE_STDERR` | `false` | Mirror captured stdout to stderr |
|
|
56
|
-
|
|
57
|
-
## Verification
|
|
58
|
-
|
|
59
|
-
`bun test` from package root. Covers schemas, namespace globs, core logger + context providers, isomorphic sinks/formatters, `remote` output, audit retention policy. Environment-specific tests live in each extract package.
|
|
60
|
-
|
|
61
|
-
## Links
|
|
62
|
-
|
|
63
|
-
- [runtime/SPEC.md](../runtime/SPEC.md)
|
|
64
|
-
- [runtime-plugin/SPEC.md](../runtime-plugin/SPEC.md)
|
|
65
|
-
- [logging-fs](../logging-fs/), [logging-browser](../logging-browser/), [logging-otel](../logging-otel/)
|