@hasna/logs 0.3.5 → 0.3.6
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/cli/index.js +7 -5
- package/dist/index-4hj4sakk.js +1241 -0
- package/dist/index-86j0hn03.js +540 -0
- package/dist/mcp/index.js +1 -1
- package/dist/server/index.js +2 -2
- package/package.json +1 -1
- package/src/cli/index.ts +5 -1
- package/src/lib/summarize.ts +2 -1
package/dist/cli/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// @bun
|
|
3
3
|
import {
|
|
4
4
|
runJob
|
|
5
|
-
} from "../index-
|
|
5
|
+
} from "../index-4hj4sakk.js";
|
|
6
6
|
import {
|
|
7
7
|
createPage,
|
|
8
8
|
createProject,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
listProjects,
|
|
13
13
|
resolveProjectId,
|
|
14
14
|
summarizeLogs
|
|
15
|
-
} from "../index-
|
|
15
|
+
} from "../index-86j0hn03.js";
|
|
16
16
|
import {
|
|
17
17
|
createJob,
|
|
18
18
|
listJobs
|
|
@@ -2174,15 +2174,17 @@ function resolveProject(nameOrId) {
|
|
|
2174
2174
|
return resolveProjectId(getDb(), nameOrId) ?? nameOrId;
|
|
2175
2175
|
}
|
|
2176
2176
|
var program2 = new Command().name("logs").description("@hasna/logs \u2014 log aggregation and monitoring").version("0.0.1");
|
|
2177
|
-
program2.command("list").description("Search and list logs").option("--project <name|id>", "Filter by project name or ID").option("--page <id>", "Filter by page ID").option("--level <levels>", "Comma-separated levels (error,warn,info,debug,fatal)").option("--service <name>", "Filter by service").option("--since <iso>", "Since timestamp or relative (1h, 24h, 7d)").option("--text <query>", "Full-text search").option("--limit <n>", "Max results", "100").option("--format <fmt>", "Output format: table|json|compact", "table").action((opts) => {
|
|
2177
|
+
program2.command("list").description("Search and list logs").option("--project <name|id>", "Filter by project name or ID").option("--page <id>", "Filter by page ID").option("--level <levels>", "Comma-separated levels (error,warn,info,debug,fatal)").option("--service <name>", "Filter by service").option("--since <iso>", "Since timestamp or relative (1h, 24h, 7d)").option("--until <iso>", "Until timestamp or relative (e.g. logs list --since 2h --until 1h)").option("--text <query>", "Full-text search").option("--limit <n>", "Max results", "100").option("--format <fmt>", "Output format: table|json|compact", "table").action((opts) => {
|
|
2178
2178
|
const db = getDb();
|
|
2179
2179
|
const since = parseRelativeTime(opts.since);
|
|
2180
|
+
const until = parseRelativeTime(opts.until);
|
|
2180
2181
|
const rows = searchLogs(db, {
|
|
2181
2182
|
project_id: resolveProject(opts.project),
|
|
2182
2183
|
page_id: opts.page,
|
|
2183
2184
|
level: opts.level ? opts.level.split(",") : undefined,
|
|
2184
2185
|
service: opts.service,
|
|
2185
2186
|
since,
|
|
2187
|
+
until,
|
|
2186
2188
|
text: opts.text,
|
|
2187
2189
|
limit: Number(opts.limit)
|
|
2188
2190
|
});
|
|
@@ -2207,8 +2209,8 @@ program2.command("tail").description("Show most recent logs").option("--project
|
|
|
2207
2209
|
for (const r of rows)
|
|
2208
2210
|
console.log(colorRow(r.timestamp, r.level, r.service ?? "-", r.message));
|
|
2209
2211
|
});
|
|
2210
|
-
program2.command("summary").description("Error/warn summary by service").option("--project <name|id>", "Project name or ID").option("--since <time>", "Relative time (1h, 24h, 7d)", "24h").action((opts) => {
|
|
2211
|
-
const summary = summarizeLogs(getDb(), resolveProject(opts.project), parseRelativeTime(opts.since));
|
|
2212
|
+
program2.command("summary").description("Error/warn summary by service").option("--project <name|id>", "Project name or ID").option("--since <time>", "Relative time (1h, 24h, 7d)", "24h").option("--until <time>", "Upper bound time").action((opts) => {
|
|
2213
|
+
const summary = summarizeLogs(getDb(), resolveProject(opts.project), parseRelativeTime(opts.since), parseRelativeTime(opts.until));
|
|
2212
2214
|
if (!summary.length) {
|
|
2213
2215
|
console.log("No errors/warnings in this window.");
|
|
2214
2216
|
return;
|