mslxdff 0.1.32 → 0.1.33

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.
Files changed (2) hide show
  1. package/bin/mslxdff.js +25 -1
  2. package/package.json +1 -1
package/bin/mslxdff.js CHANGED
@@ -14,7 +14,7 @@ import { createAutoSelector } from "../src/auto.js";
14
14
  import { createPeersService } from "../src/peers.js";
15
15
  import { createEventBus } from "../src/events.js";
16
16
  import { createGroupsService, createBansService, refreshGroupMembers, syncPeersFromMembers } from "../src/groups.js";
17
- import { logDir, recentCalls, lastError, appendCall, appendError, appendEvent, recentEvents } from "../src/logs.js";
17
+ import { logDir, recentCalls, lastError, appendCall, appendError, appendEvent, recentEvents, eventsFile, callsFile, errorsFile } from "../src/logs.js";
18
18
 
19
19
  const logs = { appendCall, appendError, appendEvent };
20
20
 
@@ -85,6 +85,29 @@ if (args.includes("-uninstall") || args.includes("--uninstall")) {
85
85
  process.exit(0);
86
86
  }
87
87
 
88
+ if (args.includes("-log") || args.includes("--log") || args.includes("-logs") || args.includes("--logs")) {
89
+ const idx = args.findIndex((x) => x === "-log" || x === "--log" || x === "-logs" || x === "--logs");
90
+ const raw = args[idx + 1];
91
+ const n = Number(raw);
92
+ const count = Number.isInteger(n) && n > 0 ? n : 10;
93
+ const file = eventsFile();
94
+ const dir = logDir();
95
+ console.log(`log dir: ${dir}`);
96
+ console.log(`events: ${file}`);
97
+ const evts = recentEvents(count);
98
+ if (!evts.length) {
99
+ console.log(`(no events yet — file empty or not found)`);
100
+ } else {
101
+ console.log(`--- last ${evts.length} event(s) ---`);
102
+ for (const e of evts) console.log(fmtEvent(e));
103
+ }
104
+ // also hint for other logs
105
+ if (count <= 10) {
106
+ console.log(`\nhint: mslxdff -log 100 | calls: ${callsFile()} errors: ${errorsFile()} daemon: ${logFile()}`);
107
+ }
108
+ process.exit(0);
109
+ }
110
+
88
111
  if (args.includes("-status") || args.includes("--status") || args.includes("-s")) {
89
112
  await printStatus();
90
113
  process.exit(0);
@@ -793,6 +816,7 @@ Usage:
793
816
  mslxdff start as a background daemon and exit (status + help if one is already running)
794
817
  mslxdff -d start as a background daemon
795
818
  mslxdff -status show current status (daemon, models, recent calls, last error)
819
+ mslxdff -log [N] show last N events (default 10, e.g. -log 100)
796
820
  mslxdff -model list list the free models this proxy serves (cached)
797
821
  mslxdff -model status show per-model health status (normal/limit/error)
798
822
  mslxdff -model refresh force-refresh the model cache from the upstream
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mslxdff",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "description": "测试项目,请勿使用。",
5
5
  "type": "module",
6
6
  "bin": {