@beeverlabs/auralogger 1.0.0 → 1.0.1
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/dist/bin/auralogger.js +1 -1
- package/dist/bin/auralogger.js.map +1 -1
- package/package.json +2 -5
- package/readme.md +268 -11
package/dist/bin/auralogger.js
CHANGED
|
@@ -12,7 +12,7 @@ function printUsage() {
|
|
|
12
12
|
console.log(" auralogger server-check");
|
|
13
13
|
console.log(" auralogger get-logs [filters...]");
|
|
14
14
|
console.log("");
|
|
15
|
-
console.log("
|
|
15
|
+
console.log("Docs: https://www.npmjs.com/package/@beeverlabs/auralogger (get-logs filters)");
|
|
16
16
|
}
|
|
17
17
|
async function main() {
|
|
18
18
|
const args = process.argv.slice(2);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auralogger.js","sourceRoot":"","sources":["../../src/bin/auralogger.ts"],"names":[],"mappings":";;;AAEA,0CAAyC;AACzC,kCAAkC;AAClC,oCAAoC;AACpC,kDAAiD;AAEjD,SAAS,UAAU;IACjB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtB,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IAClD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"auralogger.js","sourceRoot":"","sources":["../../src/bin/auralogger.ts"],"names":[],"mappings":";;;AAEA,0CAAyC;AACzC,kCAAkC;AAClC,oCAAoC;AACpC,kDAAiD;AAEjD,SAAS,UAAU;IACjB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtB,OAAO,CAAC,GAAG,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AC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,CAAC,KAAK,CAAC,eAAe,OAAO,EAAE,CAAC,CAAC;IACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beeverlabs/auralogger",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Auralogger SDK and CLI for Node: terminal logs, websocket ingest, and filtered get-logs for agents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"logger",
|
|
7
7
|
"logs",
|
|
@@ -23,9 +23,6 @@
|
|
|
23
23
|
"bin": {
|
|
24
24
|
"auralogger": "dist/bin/auralogger.js"
|
|
25
25
|
},
|
|
26
|
-
"directories": {
|
|
27
|
-
"doc": "docs"
|
|
28
|
-
},
|
|
29
26
|
"files": [
|
|
30
27
|
"dist"
|
|
31
28
|
],
|
package/readme.md
CHANGED
|
@@ -1,19 +1,276 @@
|
|
|
1
|
-
|
|
1
|
+
# @beeverlabs/auralogger
|
|
2
|
+
|
|
3
|
+
Terminal-first logging for Node.js: pretty logs locally and the same events streamed to **[Auralogger](https://auralogger.com)**. Includes a small CLI for setup and for pulling filtered logs (great for agents and scripts).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## At a glance
|
|
8
|
+
|
|
9
|
+
```mermaid
|
|
10
|
+
flowchart TB
|
|
11
|
+
subgraph install [1. Your machine]
|
|
12
|
+
PKG["npm install @beeverlabs/auralogger"]
|
|
13
|
+
APP[Your Node app]
|
|
14
|
+
PKG --> APP
|
|
15
|
+
end
|
|
16
|
+
subgraph cloud [2. Auralogger]
|
|
17
|
+
WEB[auralogger.com]
|
|
18
|
+
PROJ[Project + API secret]
|
|
19
|
+
WEB --> PROJ
|
|
20
|
+
end
|
|
21
|
+
subgraph local [3. Project folder]
|
|
22
|
+
INIT["auralogger init"]
|
|
23
|
+
CFG["auralogger.config.json"]
|
|
24
|
+
INIT --> CFG
|
|
25
|
+
end
|
|
26
|
+
PROJ -->|"copy secret"| INIT
|
|
27
|
+
CFG -->|"auraLog() + websocket"| cloud
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
| You want to… | Do this |
|
|
31
|
+
|--------------|---------|
|
|
32
|
+
| Send logs from code | `import { auraLog } from '@beeverlabs/auralogger'` (after `init`) |
|
|
33
|
+
| Set up this repo folder | Run `auralogger init` in the project root |
|
|
34
|
+
| Fetch logs in the terminal | `auralogger get-logs` with filters (see below) |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Getting started
|
|
39
|
+
|
|
40
|
+
### 1. Install
|
|
41
|
+
|
|
42
|
+
Requires **Node.js 18+**.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install @beeverlabs/auralogger
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Optional global CLI (same binary name):
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install -g @beeverlabs/auralogger
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
You can also run one-off commands with `npx`:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx @beeverlabs/auralogger init
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 2. Create a project on Auralogger
|
|
61
|
+
|
|
62
|
+
1. Open **[auralogger.com](https://auralogger.com)** and sign in.
|
|
63
|
+
2. Create a **project** (or open an existing one).
|
|
64
|
+
This is the workspace your logs and API secret belong to.
|
|
65
|
+
|
|
66
|
+
### 3. Get your secret API key
|
|
67
|
+
|
|
68
|
+
In the Auralogger UI, open your project and copy the **secret / API key** (the credential the CLI and runtime use to authenticate).
|
|
69
|
+
|
|
70
|
+
Use it in either of these ways:
|
|
71
|
+
|
|
72
|
+
| Approach | When to use |
|
|
73
|
+
|----------|-------------|
|
|
74
|
+
| **Environment variable** | Set `AURALOGGER_SECRET_KEY` in your shell or `.env` (recommended for CI and teams). |
|
|
75
|
+
| **`auralogger init` prompt** | Run `init` in a terminal; paste the key when asked (no env var required). |
|
|
76
|
+
|
|
77
|
+
The CLI also accepts a key already stored in `auralogger.config.json` if you run `init` again to refresh config.
|
|
78
|
+
|
|
79
|
+
### 4. Connect this folder: `auralogger init`
|
|
80
|
+
|
|
81
|
+
Every command uses your **current working directory** as the project root.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
cd /path/to/your-app
|
|
85
|
+
auralogger init
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`init` talks to Auralogger, then writes **`auralogger.config.json`** in that folder (and tries to add it to `.gitignore`).
|
|
89
|
+
|
|
90
|
+
### 5. About `auralogger.config.json`
|
|
91
|
+
|
|
92
|
+
After a successful `init` you will have a file like `auralogger.config.json` in the project root. It holds **auth and project metadata** the SDK and CLI rely on (including `project_id`, `secret_key`, `session`, and styling info from the server).
|
|
93
|
+
|
|
94
|
+
- **Do not delete or hand-edit this file** unless you know what you are doing. If it is wrong or missing, run `auralogger init` again from the same folder.
|
|
95
|
+
- **Do not commit secrets.** Keep the file out of git (the CLI attempts to append it to `.gitignore`). Prefer `AURALOGGER_SECRET_KEY` in environment when you want the secret outside the file.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Log from your Node app
|
|
100
|
+
|
|
101
|
+
The package reads **`auralogger.config.json` from `process.cwd()`**, so run your app from the same directory where you ran `init` (or `cd` there in your process).
|
|
102
|
+
|
|
103
|
+
**`auraLog(type, message, location?, data?)`**
|
|
104
|
+
|
|
105
|
+
- **`type`**: string, e.g. `"info"`, `"error"`, `"warn"`.
|
|
106
|
+
- **`message`**: string.
|
|
107
|
+
- **`location`** (optional): string, e.g. file or module name.
|
|
108
|
+
- **`data`** (optional): plain object (serialized to JSON for the wire format).
|
|
109
|
+
|
|
110
|
+
**CommonJS**
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
const { auraLog } = require("@beeverlabs/auralogger");
|
|
114
|
+
|
|
115
|
+
auraLog("info", "Server listening", "server.js", { port: 3000 });
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**ESM**
|
|
119
|
+
|
|
120
|
+
```js
|
|
121
|
+
import { auraLog } from "@beeverlabs/auralogger";
|
|
122
|
+
|
|
123
|
+
auraLog("error", "Payment failed", "checkout.js", { orderId: "42" });
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Logs are printed in the terminal (styled using your config) and sent to Auralogger over WebSocket. Failures are reported to stderr; your app keeps running.
|
|
2
127
|
|
|
3
128
|
---
|
|
4
129
|
|
|
5
|
-
|
|
130
|
+
## CLI commands
|
|
131
|
+
|
|
132
|
+
General form:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
auralogger <command> [arguments...]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
There are **no subcommand flags** (`--verbose`, etc.) on `init`, `reset`, or `server-check`. Only `get-logs` takes structured filter arguments.
|
|
139
|
+
|
|
140
|
+
### `auralogger init`
|
|
141
|
+
|
|
142
|
+
| | |
|
|
143
|
+
|--|--|
|
|
144
|
+
| **Purpose** | Authenticate with your secret, fetch project config from Auralogger, write `auralogger.config.json`. |
|
|
145
|
+
| **Arguments** | None. |
|
|
146
|
+
| **Secret source** | `AURALOGGER_SECRET_KEY`, or existing `secret_key` in config, or interactive prompt. |
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
auralogger init
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### `auralogger reset`
|
|
153
|
+
|
|
154
|
+
| | |
|
|
155
|
+
|--|--|
|
|
156
|
+
| **Purpose** | Delete `auralogger.config.json` in the current directory. |
|
|
157
|
+
| **Arguments** | None. |
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
auralogger reset
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
If the file is already missing, the CLI says there is nothing to remove.
|
|
164
|
+
|
|
165
|
+
### `auralogger server-check`
|
|
166
|
+
|
|
167
|
+
| | |
|
|
168
|
+
|--|--|
|
|
169
|
+
| **Purpose** | Verify that the WebSocket endpoint is reachable using your current `project_id` and secret. |
|
|
170
|
+
| **Arguments** | None. |
|
|
171
|
+
| **Requires** | Valid `auralogger.config.json` with `project_id` and a resolvable secret (`AURALOGGER_SECRET_KEY` or `secret_key` in config). |
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
auralogger server-check
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### `auralogger get-logs`
|
|
178
|
+
|
|
179
|
+
| | |
|
|
180
|
+
|--|--|
|
|
181
|
+
| **Purpose** | Query the Auralogger API and print matching logs in the terminal. |
|
|
182
|
+
| **Arguments** | Zero or more **filters** (see below). |
|
|
183
|
+
| **Requires** | Valid config in the current directory (same secret story as above). |
|
|
184
|
+
|
|
185
|
+
#### Filter grammar
|
|
186
|
+
|
|
187
|
+
Each filter is a triple:
|
|
188
|
+
|
|
189
|
+
```text
|
|
190
|
+
-<field> [--<operator>] <json-value>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Rules:
|
|
6
194
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
195
|
+
- **`<field>`** starts with `-` (e.g. `-type`, `-message`, `-data.userId`).
|
|
196
|
+
- **`--<operator>`** is optional; if omitted, a default operator applies per field.
|
|
197
|
+
- **`<json-value>`** must be valid JSON:
|
|
198
|
+
- For **`maxcount`** and **`skip`**: a JSON **number**.
|
|
199
|
+
- For all other fields: a JSON **array** (even for a single value).
|
|
200
|
+
|
|
201
|
+
#### Fields and operators
|
|
202
|
+
|
|
203
|
+
| Field | Operators | Default operator | Value |
|
|
204
|
+
|-------|-----------|------------------|--------|
|
|
205
|
+
| `type` | `in`, `not-in` | `in` | JSON array of strings |
|
|
206
|
+
| `message` | `contains`, `not-contains` | `contains` | JSON array of strings |
|
|
207
|
+
| `location` | `in`, `not-in` | `in` | JSON array |
|
|
208
|
+
| `time` | `since`, `from-to` | `since` | JSON array (e.g. relative like `"10m"`) |
|
|
209
|
+
| `order` | `eq` | `eq` | JSON array: `["newest-first"]` or `["oldest-first"]` |
|
|
210
|
+
| `maxcount` | `eq` | `eq` | JSON number (`0`–`100`) |
|
|
211
|
+
| `skip` | `eq` | `eq` | JSON number (≥ `0`) |
|
|
212
|
+
| `data.<path>` | `eq` | `eq` | JSON array |
|
|
213
|
+
|
|
214
|
+
#### Examples
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# Latest errors and warnings, up to 50 rows
|
|
218
|
+
auralogger get-logs -type '["error","warn"]' -maxcount 50
|
|
219
|
+
|
|
220
|
+
# Message contains "timeout", skip first 20 rows
|
|
221
|
+
auralogger get-logs -message '["timeout"]' -skip 20 -maxcount 30
|
|
222
|
+
|
|
223
|
+
# Exclude info/debug; only logs since 10 minutes ago
|
|
224
|
+
auralogger get-logs -type --not-in '["info","debug"]' -time --since '["10m"]'
|
|
225
|
+
|
|
226
|
+
# Match nested data field
|
|
227
|
+
auralogger get-logs -data.userId '["06431f39-55e2-4289-80c8-5d0340a8b66e"]'
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
#### Typical parse errors (what they mean)
|
|
231
|
+
|
|
232
|
+
| Message | Meaning |
|
|
233
|
+
|---------|---------|
|
|
234
|
+
| `Expected 'get-logs'` | Arguments before the first filter are wrong; the first token after `get-logs` should start a filter. |
|
|
235
|
+
| `Expected field at position N` | Missing `-field` where a filter was expected. |
|
|
236
|
+
| `Missing value for field 'x'` | Operator or field without a JSON value. |
|
|
237
|
+
| `Invalid JSON for field 'x'` | Value is not valid JSON. |
|
|
238
|
+
| `Field 'x' expects a JSON array token` | That field requires an array value. |
|
|
239
|
+
| `Field 'maxcount' expects a JSON number token` | `maxcount` / `skip` need a number, not an array. |
|
|
240
|
+
| `Invalid op 'x' for field 'y'` | Operator not allowed for that field. |
|
|
241
|
+
| `Unknown filter field: x` | Field name not recognized. |
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Optional environment variable (users)
|
|
246
|
+
|
|
247
|
+
| Variable | Purpose |
|
|
248
|
+
|----------|---------|
|
|
249
|
+
| `AURALOGGER_SECRET_KEY` | Your project secret, used by `init`, `server-check`, runtime logging, and `get-logs` when you do not rely only on `secret_key` inside `auralogger.config.json`. |
|
|
250
|
+
|
|
251
|
+
Production traffic uses Auralogger’s default HTTP and WebSocket endpoints. You do not need to set base URLs for normal use.
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## First-time checklist
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
cd your-project
|
|
259
|
+
npm install @beeverlabs/auralogger
|
|
260
|
+
# set AURALOGGER_SECRET_KEY or be ready to paste at prompt
|
|
261
|
+
auralogger init
|
|
262
|
+
auralogger server-check
|
|
263
|
+
auralogger get-logs -maxcount 20
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
11
267
|
|
|
12
|
-
|
|
268
|
+
## Contributing and advanced topics
|
|
13
269
|
|
|
14
|
-
**
|
|
270
|
+
**End-user documentation ends above.**
|
|
15
271
|
|
|
16
|
-
|
|
17
|
-
- Contributors: **`dev-docs/`** (`README.md`, `file-map.md`, `routes.md`)
|
|
272
|
+
Contributor notes (file map, HTTP/WebSocket route reference, local base URL overrides) live **only in the GitHub repository**, under **`dev-docs/`**. Those files are **not** part of the published npm package tarball.
|
|
18
273
|
|
|
19
|
-
**
|
|
274
|
+
- **Repository:** [github.com/Beever-Labs/auralogger-node](https://github.com/Beever-Labs/auralogger-node)
|
|
275
|
+
- **Issues:** [github.com/Beever-Labs/auralogger-node/issues](https://github.com/Beever-Labs/auralogger-node/issues)
|
|
276
|
+
- **Product:** [auralogger.com](https://auralogger.com)
|