auralogger 0.1.0__tar.gz
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.
- auralogger-0.1.0/LICENSE +17 -0
- auralogger-0.1.0/PKG-INFO +206 -0
- auralogger-0.1.0/README.md +177 -0
- auralogger-0.1.0/auralogger/__init__.py +42 -0
- auralogger-0.1.0/auralogger/cli/__init__.py +24 -0
- auralogger-0.1.0/auralogger/cli/aside_pools.py +621 -0
- auralogger-0.1.0/auralogger/cli/cli.py +163 -0
- auralogger-0.1.0/auralogger/cli/cli_auth.py +96 -0
- auralogger-0.1.0/auralogger/cli/cli_load_env.py +35 -0
- auralogger-0.1.0/auralogger/cli/cli_personality_state.py +40 -0
- auralogger-0.1.0/auralogger/cli/cli_style.py +82 -0
- auralogger-0.1.0/auralogger/cli/cli_tone.py +34 -0
- auralogger-0.1.0/auralogger/cli/commands/__init__.py +1 -0
- auralogger-0.1.0/auralogger/cli/commands/get_logs_cmd.py +9 -0
- auralogger-0.1.0/auralogger/cli/commands/init.py +319 -0
- auralogger-0.1.0/auralogger/cli/commands/server_check.py +146 -0
- auralogger-0.1.0/auralogger/cli/commands/test_serverlog.py +51 -0
- auralogger-0.1.0/auralogger/cli/get_logs.py +206 -0
- auralogger-0.1.0/auralogger/cli/get_logs_filters.py +88 -0
- auralogger-0.1.0/auralogger/cli/log_print.py +92 -0
- auralogger-0.1.0/auralogger/cli/log_styles.py +96 -0
- auralogger-0.1.0/auralogger/server/__init__.py +9 -0
- auralogger-0.1.0/auralogger/server/aura_log.py +382 -0
- auralogger-0.1.0/auralogger/server/proj_auth.py +63 -0
- auralogger-0.1.0/auralogger/utils/__init__.py +33 -0
- auralogger-0.1.0/auralogger/utils/backend_origin.py +52 -0
- auralogger-0.1.0/auralogger/utils/env_config.py +149 -0
- auralogger-0.1.0/auralogger/utils/http_utils.py +26 -0
- auralogger-0.1.0/auralogger/utils/parser.py +73 -0
- auralogger-0.1.0/auralogger/utils/recovery_messages.py +5 -0
- auralogger-0.1.0/auralogger.egg-info/PKG-INFO +206 -0
- auralogger-0.1.0/auralogger.egg-info/SOURCES.txt +42 -0
- auralogger-0.1.0/auralogger.egg-info/dependency_links.txt +1 -0
- auralogger-0.1.0/auralogger.egg-info/entry_points.txt +2 -0
- auralogger-0.1.0/auralogger.egg-info/requires.txt +5 -0
- auralogger-0.1.0/auralogger.egg-info/top_level.txt +1 -0
- auralogger-0.1.0/pyproject.toml +49 -0
- auralogger-0.1.0/setup.cfg +4 -0
- auralogger-0.1.0/tests/test_cli_load_env.py +31 -0
- auralogger-0.1.0/tests/test_cli_parity_updates.py +131 -0
- auralogger-0.1.0/tests/test_cli_unknown_command.py +28 -0
- auralogger-0.1.0/tests/test_get_logs_filters.py +55 -0
- auralogger-0.1.0/tests/test_public_api_names.py +42 -0
- auralogger-0.1.0/tests/test_wire_contract.py +98 -0
auralogger-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Bhanu Vardhan Reddy Nanavala
|
|
4
|
+
|
|
5
|
+
Contact: nbhanuvardhanreddy@gmail.com
|
|
6
|
+
|
|
7
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
8
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
9
|
+
copyright notice and this permission notice appear in all copies.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
12
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
13
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
14
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
15
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
16
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
17
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: auralogger
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Open-Source Developer package repository for AuraLogger, a real-time logging and observability SDK and CLI for streaming, storing, searching, and filtering application logs—beautifully visualized and accessible anywhere in the world across terminal, web, and any screen.
|
|
5
|
+
Author: Bhanu Vardhan Reddy Nanavala
|
|
6
|
+
License-Expression: ISC
|
|
7
|
+
Project-URL: Homepage, https://auralogger.com
|
|
8
|
+
Project-URL: Documentation, https://auralogger.com/docs
|
|
9
|
+
Keywords: auralogger,cli,logging
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: System :: Logging
|
|
21
|
+
Requires-Python: >=3.8
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
25
|
+
Requires-Dist: websocket-client>=1.6.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: ruff>=0.6.0; extra == "dev"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# Auralogger for Python (SDK + CLI)
|
|
31
|
+
|
|
32
|
+
a real-time logging and observability SDK and CLI for streaming, storing, searching, and filtering application logs—beautifully visualized and accessible anywhere in the world across terminal, web, and any screen.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Quick start
|
|
37
|
+
|
|
38
|
+
Run CLI commands from the directory that contains your `.env` or `.env.local` (or wherever you export `AURALOGGER_`* in the shell or CI). The CLI loads `.env` files from the **current working directory** — `cd` into the app first.
|
|
39
|
+
|
|
40
|
+
**Use a project virtualenv** (`python -m venv .venv`) so the CLI and library version match the repo you are in. Auralogger is **project-scoped** (credentials per app), not a global “install once and forget which folder you are in” tool.
|
|
41
|
+
|
|
42
|
+
### 1) Install
|
|
43
|
+
|
|
44
|
+
From PyPI:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install auralogger
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
auralogger
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 2) Run `init` (credentials + server snippet)
|
|
55
|
+
|
|
56
|
+
Get **private** credentials from [auralogger.com](https://auralogger.com), then run this in your app repo (where `.env` should live):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
auralogger init
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`auralogger init` walks you through anything missing, prints a **copy-paste block** for your `.env` (project token, user secret, session — each line skipped if already set), then prints a **small Python module** you can drop into your repo (for example `your_auralog_file.py`) with a ready-made `auralog(...)` helper .
|
|
63
|
+
|
|
64
|
+
### 3) Sanity-check connectivity
|
|
65
|
+
|
|
66
|
+
Before you sprinkle `auralog` everywhere, confirm the path works:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
auralogger server-check
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Optional: send a handful of test logs through the same path your app uses:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
auralogger test-serverlog
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
If token or user secret is missing after `.env` is loaded, the CLI will prompt before running checks.
|
|
79
|
+
|
|
80
|
+
### 4) Send logs from code
|
|
81
|
+
|
|
82
|
+
Run `auralogger init` once and paste the printed module, or follow this shape: configure once (reads `AURALOGGER_PROJECT_TOKEN` and `AURALOGGER_USER_SECRET` from the environment), then call your helper.
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from your_auralog_file import auralog
|
|
86
|
+
|
|
87
|
+
auralog(
|
|
88
|
+
"info",
|
|
89
|
+
"Request completed",
|
|
90
|
+
"api/orders#create",
|
|
91
|
+
{"order_id": "ord_123", "status": 201},
|
|
92
|
+
)
|
|
93
|
+
# expected: [info] Request completed @ api/orders#create {"order_id": "ord_123", "status": 201}
|
|
94
|
+
|
|
95
|
+
auralog("warn", "Cache miss")
|
|
96
|
+
# expected: [warn] Cache miss
|
|
97
|
+
|
|
98
|
+
auralog("error", "Payment gateway timeout", data={"provider": "stripe"})
|
|
99
|
+
# expected: [error] Payment gateway timeout {"provider": "stripe"}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Important:** the logging helper reads `**os.environ` only** — it does not load `.env` files by itself. In Django, FastAPI, Celery, etc., load env in your normal startup path (or rely on your host injecting variables).
|
|
103
|
+
|
|
104
|
+
### 5) Fetch logs in the terminal
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
auralogger get-logs -maxcount 20
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Each run performs **one** HTTP request and prints the `logs` array from that response. Use `**-maxcount`** (capped at **100** in the CLI) and `**-skip`** to page manually across separate runs or a small script. Full filter grammar, every field, and examples are in **CLI commands (reference)** below.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## CLI commands (reference)
|
|
115
|
+
|
|
116
|
+
Subcommands for the `auralogger` entrypoint, then `**get-logs`** filters (same grammar as the Node CLI). Environment variable spellings: `[user-docs/environment.md](user-docs/environment.md)`.
|
|
117
|
+
|
|
118
|
+
### Invocation
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
auralogger <command> [arguments...]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Run `auralogger --help` to see all commands and options.
|
|
125
|
+
|
|
126
|
+
### Commands (only `get-logs` takes extra filter tokens)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
| Command | Arguments | What it does |
|
|
130
|
+
| ---------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
131
|
+
| `init` | — | Prompts for missing `AURALOGGER_PROJECT_TOKEN` / `AURALOGGER_USER_SECRET`, prints copy-paste `.env` lines (token, user secret, session), then a **Python** server integration snippet with `sync_from_secret` and `auralog(...)`. |
|
|
132
|
+
| `server-check` | — | One **server-side** test log over WebSocket; prompts for missing token or user secret if needed. |
|
|
133
|
+
| `test-serverlog` | — | Calls `sync_from_secret`, sends **5** logs via `aura_log`, then closes the cached socket. |
|
|
134
|
+
| `get-logs` | `[filters...]` | `POST` to project logs with token + user secret (env or prompt). If styles are not in env, the CLI resolves them for that run so terminal colors match the dashboard when possible. |
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
### `get-logs` filter grammar
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
-<field> [--<operator>] <json-value>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
- The token after the field name must be **valid JSON**.
|
|
144
|
+
- `**maxcount`** and `**skip`**: value must be a JSON **number**.
|
|
145
|
+
- **All other fields**: value must be a JSON **array**.
|
|
146
|
+
|
|
147
|
+
**Paging:** one CLI invocation → one request → one page of logs. There is **no** automatic multi-page loop inside the CLI.
|
|
148
|
+
|
|
149
|
+
#### Fields and operators
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
| Field | Allowed operators | Default operator | Value shape |
|
|
153
|
+
| ------------- | -------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
154
|
+
| `type` | `in`, `not-in` | `in` | JSON array of type strings |
|
|
155
|
+
| `message` | `contains`, `not-contains` | `contains` | JSON array of substrings |
|
|
156
|
+
| `location` | `in`, `not-in` | `in` | JSON array of location strings |
|
|
157
|
+
| `time` | `since`, `from-to` | `since` | JSON array (e.g. `["10m"]` for `since`; use `from-to` with a pair when supported) |
|
|
158
|
+
| `order` | `eq` | `eq` | JSON array: `["newest-first"]` or `["oldest-first"]` |
|
|
159
|
+
| `maxcount` | `eq` | `eq` | JSON number, clamped to `0..100` |
|
|
160
|
+
| `skip` | `eq` | `eq` | JSON number, floored, minimum `0` |
|
|
161
|
+
| `session` | `eq` | `eq` | JSON array of session strings. If `AURALOGGER_PROJECT_SESSION` is set and you omit `-session`, the CLI prepends this filter for you. |
|
|
162
|
+
| `data.<path>` | `eq` | `eq` | JSON array — filter on nested `data` using a dot path (e.g. `data.userId`) |
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
If you omit `--<operator>`, the default operator for that field is used (for example `-type '["error"]'` is the same as `-type --in '["error"]'`).
|
|
166
|
+
|
|
167
|
+
#### Examples
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
auralogger get-logs -type '["error","warn"]' -maxcount 50
|
|
171
|
+
auralogger get-logs -message '["timeout"]' -skip 20 -maxcount 30
|
|
172
|
+
auralogger get-logs -type --not-in '["info","debug"]' -time --since '["10m"]'
|
|
173
|
+
auralogger get-logs -data.userId '["06431f39-55e2-4289-80c8-5d0340a8b66e"]'
|
|
174
|
+
auralogger get-logs -order '["oldest-first"]' -maxcount 25
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### Common parse errors (filters)
|
|
178
|
+
|
|
179
|
+
- `Expected 'get-logs'`
|
|
180
|
+
- `Expected field at position N`
|
|
181
|
+
- `Missing value for field '…'`
|
|
182
|
+
- `Invalid JSON for field '…'`
|
|
183
|
+
- `Field '…' expects a JSON array token`
|
|
184
|
+
- `Field 'maxcount' expects a JSON number token` (and similarly for `skip`)
|
|
185
|
+
- `Invalid op '…' for field '…'`
|
|
186
|
+
- `Unknown filter field: …`
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Browser and frontends
|
|
191
|
+
|
|
192
|
+
This package is for **Python on the server**. For React, Vue, Next, Vite, or any code bundled for the browser, use the `**auralogger-cli`** npm package and its **client** entry — **project token only** there, never `AURALOGGER_USER_SECRET` in frontend bundles.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## When something does not work
|
|
197
|
+
|
|
198
|
+
- **Wrong directory** — Run the CLI from the folder that contains `.env`, or export variables in the shell.
|
|
199
|
+
- **Logs never reach the dashboard** — Confirm `AURALOGGER_PROJECT_TOKEN` and `AURALOGGER_USER_SECRET` are set for the process (or passed explicitly in your configure step). Successful sends are quiet locally; problems may show as a one-time message on stderr.
|
|
200
|
+
- `**get-logs` looks plain** — Optional style env vars are documented in `[user-docs/environment.md](user-docs/environment.md)`; the CLI can still resolve styling for a run when those are unset.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Requirements
|
|
205
|
+
|
|
206
|
+
Python **3.8+**.
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Auralogger for Python (SDK + CLI)
|
|
2
|
+
|
|
3
|
+
a real-time logging and observability SDK and CLI for streaming, storing, searching, and filtering application logs—beautifully visualized and accessible anywhere in the world across terminal, web, and any screen.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Quick start
|
|
8
|
+
|
|
9
|
+
Run CLI commands from the directory that contains your `.env` or `.env.local` (or wherever you export `AURALOGGER_`* in the shell or CI). The CLI loads `.env` files from the **current working directory** — `cd` into the app first.
|
|
10
|
+
|
|
11
|
+
**Use a project virtualenv** (`python -m venv .venv`) so the CLI and library version match the repo you are in. Auralogger is **project-scoped** (credentials per app), not a global “install once and forget which folder you are in” tool.
|
|
12
|
+
|
|
13
|
+
### 1) Install
|
|
14
|
+
|
|
15
|
+
From PyPI:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install auralogger
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
auralogger
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2) Run `init` (credentials + server snippet)
|
|
26
|
+
|
|
27
|
+
Get **private** credentials from [auralogger.com](https://auralogger.com), then run this in your app repo (where `.env` should live):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
auralogger init
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`auralogger init` walks you through anything missing, prints a **copy-paste block** for your `.env` (project token, user secret, session — each line skipped if already set), then prints a **small Python module** you can drop into your repo (for example `your_auralog_file.py`) with a ready-made `auralog(...)` helper .
|
|
34
|
+
|
|
35
|
+
### 3) Sanity-check connectivity
|
|
36
|
+
|
|
37
|
+
Before you sprinkle `auralog` everywhere, confirm the path works:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
auralogger server-check
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Optional: send a handful of test logs through the same path your app uses:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
auralogger test-serverlog
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
If token or user secret is missing after `.env` is loaded, the CLI will prompt before running checks.
|
|
50
|
+
|
|
51
|
+
### 4) Send logs from code
|
|
52
|
+
|
|
53
|
+
Run `auralogger init` once and paste the printed module, or follow this shape: configure once (reads `AURALOGGER_PROJECT_TOKEN` and `AURALOGGER_USER_SECRET` from the environment), then call your helper.
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from your_auralog_file import auralog
|
|
57
|
+
|
|
58
|
+
auralog(
|
|
59
|
+
"info",
|
|
60
|
+
"Request completed",
|
|
61
|
+
"api/orders#create",
|
|
62
|
+
{"order_id": "ord_123", "status": 201},
|
|
63
|
+
)
|
|
64
|
+
# expected: [info] Request completed @ api/orders#create {"order_id": "ord_123", "status": 201}
|
|
65
|
+
|
|
66
|
+
auralog("warn", "Cache miss")
|
|
67
|
+
# expected: [warn] Cache miss
|
|
68
|
+
|
|
69
|
+
auralog("error", "Payment gateway timeout", data={"provider": "stripe"})
|
|
70
|
+
# expected: [error] Payment gateway timeout {"provider": "stripe"}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Important:** the logging helper reads `**os.environ` only** — it does not load `.env` files by itself. In Django, FastAPI, Celery, etc., load env in your normal startup path (or rely on your host injecting variables).
|
|
74
|
+
|
|
75
|
+
### 5) Fetch logs in the terminal
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
auralogger get-logs -maxcount 20
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Each run performs **one** HTTP request and prints the `logs` array from that response. Use `**-maxcount`** (capped at **100** in the CLI) and `**-skip`** to page manually across separate runs or a small script. Full filter grammar, every field, and examples are in **CLI commands (reference)** below.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## CLI commands (reference)
|
|
86
|
+
|
|
87
|
+
Subcommands for the `auralogger` entrypoint, then `**get-logs`** filters (same grammar as the Node CLI). Environment variable spellings: `[user-docs/environment.md](user-docs/environment.md)`.
|
|
88
|
+
|
|
89
|
+
### Invocation
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
auralogger <command> [arguments...]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Run `auralogger --help` to see all commands and options.
|
|
96
|
+
|
|
97
|
+
### Commands (only `get-logs` takes extra filter tokens)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
| Command | Arguments | What it does |
|
|
101
|
+
| ---------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
102
|
+
| `init` | — | Prompts for missing `AURALOGGER_PROJECT_TOKEN` / `AURALOGGER_USER_SECRET`, prints copy-paste `.env` lines (token, user secret, session), then a **Python** server integration snippet with `sync_from_secret` and `auralog(...)`. |
|
|
103
|
+
| `server-check` | — | One **server-side** test log over WebSocket; prompts for missing token or user secret if needed. |
|
|
104
|
+
| `test-serverlog` | — | Calls `sync_from_secret`, sends **5** logs via `aura_log`, then closes the cached socket. |
|
|
105
|
+
| `get-logs` | `[filters...]` | `POST` to project logs with token + user secret (env or prompt). If styles are not in env, the CLI resolves them for that run so terminal colors match the dashboard when possible. |
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
### `get-logs` filter grammar
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
-<field> [--<operator>] <json-value>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
- The token after the field name must be **valid JSON**.
|
|
115
|
+
- `**maxcount`** and `**skip`**: value must be a JSON **number**.
|
|
116
|
+
- **All other fields**: value must be a JSON **array**.
|
|
117
|
+
|
|
118
|
+
**Paging:** one CLI invocation → one request → one page of logs. There is **no** automatic multi-page loop inside the CLI.
|
|
119
|
+
|
|
120
|
+
#### Fields and operators
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
| Field | Allowed operators | Default operator | Value shape |
|
|
124
|
+
| ------------- | -------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
125
|
+
| `type` | `in`, `not-in` | `in` | JSON array of type strings |
|
|
126
|
+
| `message` | `contains`, `not-contains` | `contains` | JSON array of substrings |
|
|
127
|
+
| `location` | `in`, `not-in` | `in` | JSON array of location strings |
|
|
128
|
+
| `time` | `since`, `from-to` | `since` | JSON array (e.g. `["10m"]` for `since`; use `from-to` with a pair when supported) |
|
|
129
|
+
| `order` | `eq` | `eq` | JSON array: `["newest-first"]` or `["oldest-first"]` |
|
|
130
|
+
| `maxcount` | `eq` | `eq` | JSON number, clamped to `0..100` |
|
|
131
|
+
| `skip` | `eq` | `eq` | JSON number, floored, minimum `0` |
|
|
132
|
+
| `session` | `eq` | `eq` | JSON array of session strings. If `AURALOGGER_PROJECT_SESSION` is set and you omit `-session`, the CLI prepends this filter for you. |
|
|
133
|
+
| `data.<path>` | `eq` | `eq` | JSON array — filter on nested `data` using a dot path (e.g. `data.userId`) |
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
If you omit `--<operator>`, the default operator for that field is used (for example `-type '["error"]'` is the same as `-type --in '["error"]'`).
|
|
137
|
+
|
|
138
|
+
#### Examples
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
auralogger get-logs -type '["error","warn"]' -maxcount 50
|
|
142
|
+
auralogger get-logs -message '["timeout"]' -skip 20 -maxcount 30
|
|
143
|
+
auralogger get-logs -type --not-in '["info","debug"]' -time --since '["10m"]'
|
|
144
|
+
auralogger get-logs -data.userId '["06431f39-55e2-4289-80c8-5d0340a8b66e"]'
|
|
145
|
+
auralogger get-logs -order '["oldest-first"]' -maxcount 25
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Common parse errors (filters)
|
|
149
|
+
|
|
150
|
+
- `Expected 'get-logs'`
|
|
151
|
+
- `Expected field at position N`
|
|
152
|
+
- `Missing value for field '…'`
|
|
153
|
+
- `Invalid JSON for field '…'`
|
|
154
|
+
- `Field '…' expects a JSON array token`
|
|
155
|
+
- `Field 'maxcount' expects a JSON number token` (and similarly for `skip`)
|
|
156
|
+
- `Invalid op '…' for field '…'`
|
|
157
|
+
- `Unknown filter field: …`
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Browser and frontends
|
|
162
|
+
|
|
163
|
+
This package is for **Python on the server**. For React, Vue, Next, Vite, or any code bundled for the browser, use the `**auralogger-cli`** npm package and its **client** entry — **project token only** there, never `AURALOGGER_USER_SECRET` in frontend bundles.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## When something does not work
|
|
168
|
+
|
|
169
|
+
- **Wrong directory** — Run the CLI from the folder that contains `.env`, or export variables in the shell.
|
|
170
|
+
- **Logs never reach the dashboard** — Confirm `AURALOGGER_PROJECT_TOKEN` and `AURALOGGER_USER_SECRET` are set for the process (or passed explicitly in your configure step). Successful sends are quiet locally; problems may show as a one-time message on stderr.
|
|
171
|
+
- `**get-logs` looks plain** — Optional style env vars are documented in `[user-docs/environment.md](user-docs/environment.md)`; the CLI can still resolve styling for a run when those are unset.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Requirements
|
|
176
|
+
|
|
177
|
+
Python **3.8+**.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Public API barrel (mirrors node/src/index.ts)."""
|
|
2
|
+
|
|
3
|
+
from auralogger.cli.commands.init import run_init
|
|
4
|
+
from auralogger.cli.commands.server_check import run_server_check
|
|
5
|
+
from auralogger.cli.commands.test_serverlog import run_test_serverlog
|
|
6
|
+
from auralogger.cli.get_logs import run_get_logs
|
|
7
|
+
from auralogger.cli.get_logs_filters import ApiLogFilter, normalize_and_validate_filters
|
|
8
|
+
from auralogger.cli.log_styles import (
|
|
9
|
+
DEFAULT_LOG_STYLE_SPEC,
|
|
10
|
+
build_style_entries_from_api,
|
|
11
|
+
resolve_log_style_spec,
|
|
12
|
+
style_map_from_config_entries,
|
|
13
|
+
)
|
|
14
|
+
from auralogger.server.aura_log import auralogger, aura_log, close_aura_log_socket
|
|
15
|
+
from auralogger.server.proj_auth import fetch_proj_auth_config, fetch_proj_auth_payload
|
|
16
|
+
from auralogger.utils.backend_origin import build_proj_auth_url, build_project_logs_url
|
|
17
|
+
from auralogger.utils.http_utils import parse_error_body
|
|
18
|
+
from auralogger.utils.parser import ParsedFilter, ParsedGetLogsCommand, parse_command
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"aura_log",
|
|
22
|
+
"close_aura_log_socket",
|
|
23
|
+
"auralogger",
|
|
24
|
+
"run_get_logs",
|
|
25
|
+
"normalize_and_validate_filters",
|
|
26
|
+
"ApiLogFilter",
|
|
27
|
+
"parse_error_body",
|
|
28
|
+
"run_init",
|
|
29
|
+
"run_server_check",
|
|
30
|
+
"run_test_serverlog",
|
|
31
|
+
"DEFAULT_LOG_STYLE_SPEC",
|
|
32
|
+
"build_style_entries_from_api",
|
|
33
|
+
"resolve_log_style_spec",
|
|
34
|
+
"style_map_from_config_entries",
|
|
35
|
+
"fetch_proj_auth_config",
|
|
36
|
+
"fetch_proj_auth_payload",
|
|
37
|
+
"build_proj_auth_url",
|
|
38
|
+
"build_project_logs_url",
|
|
39
|
+
"parse_command",
|
|
40
|
+
"ParsedFilter",
|
|
41
|
+
"ParsedGetLogsCommand",
|
|
42
|
+
]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""CLI package. Entrypoint: ``auralogger.cli.cli`` (``main``, ``print_usage``)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
__all__ = ["main", "print_usage"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def __getattr__(name: str) -> Any:
|
|
11
|
+
if name == "main":
|
|
12
|
+
from auralogger.cli.cli import main
|
|
13
|
+
|
|
14
|
+
return main
|
|
15
|
+
if name == "print_usage":
|
|
16
|
+
from auralogger.cli.cli import print_usage
|
|
17
|
+
|
|
18
|
+
return print_usage
|
|
19
|
+
# Console scripts may target ``auralogger.cli:_entrypoint`` (older installs / metadata).
|
|
20
|
+
if name == "_entrypoint":
|
|
21
|
+
from auralogger.cli.cli import _entrypoint
|
|
22
|
+
|
|
23
|
+
return _entrypoint
|
|
24
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|