sockethub 5.0.0-alpha.11 → 5.0.0-alpha.13
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/bin/sockethub +1 -1
- package/bin/sockethub-logged +28 -12
- package/package.json +12 -13
package/bin/sockethub
CHANGED
package/bin/sockethub-logged
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
/**
|
|
3
3
|
* Sockethub launcher with split logging:
|
|
4
|
-
* - Console: filtered via
|
|
4
|
+
* - Console: filtered via namespace patterns
|
|
5
5
|
* - File: full debug output to sockethub.log
|
|
6
6
|
*/
|
|
7
7
|
import { spawn } from "node:child_process";
|
|
8
8
|
import { createWriteStream } from "node:fs";
|
|
9
9
|
import { dirname, join } from "node:path";
|
|
10
|
-
import debug from "debug";
|
|
11
10
|
|
|
12
|
-
// Console filter
|
|
13
|
-
|
|
11
|
+
// Console namespace filter. Include patterns show a namespace; a leading "-"
|
|
12
|
+
// excludes it; "*" matches any run of characters. (Self-contained matcher so we
|
|
13
|
+
// don't depend on the legacy `debug` package — Sockethub logs via winston.)
|
|
14
|
+
const CONSOLE_FILTER = [
|
|
14
15
|
"sockethub:init",
|
|
15
16
|
"sockethub:server:bootstrap:*",
|
|
16
17
|
"sockethub:server:core",
|
|
@@ -18,14 +19,29 @@ const CONSOLE_DEBUG = [
|
|
|
18
19
|
"sockethub:server:listener",
|
|
19
20
|
"sockethub:server:janitor",
|
|
20
21
|
"sockethub:server:rate-limiter",
|
|
21
|
-
]
|
|
22
|
+
];
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
function patternToRegExp(pattern: string): RegExp {
|
|
25
|
+
const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|
|
26
|
+
return new RegExp(`^${escaped.replace(/\*/g, ".*?")}$`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const includes = CONSOLE_FILTER.filter((p) => !p.startsWith("-")).map(
|
|
30
|
+
patternToRegExp,
|
|
31
|
+
);
|
|
32
|
+
const excludes = CONSOLE_FILTER.filter((p) => p.startsWith("-")).map((p) =>
|
|
33
|
+
patternToRegExp(p.slice(1)),
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const shouldShow = (namespace: string): boolean => {
|
|
37
|
+
if (excludes.some((re) => re.test(namespace))) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return includes.some((re) => re.test(namespace));
|
|
41
|
+
};
|
|
26
42
|
|
|
27
|
-
// Extract namespace from
|
|
28
|
-
//
|
|
43
|
+
// Extract the sockethub namespace from a winston log line
|
|
44
|
+
// (e.g. "2026-… debug: sockethub:server:core message", with optional ANSI colors)
|
|
29
45
|
const namespaceRegex = /sockethub:[^\s\x1b]+/;
|
|
30
46
|
function getNamespace(line: string): string | null {
|
|
31
47
|
const match = line.match(namespaceRegex);
|
|
@@ -38,7 +54,7 @@ const timestamp = () => new Date().toISOString();
|
|
|
38
54
|
logFile.write(`\n--- Sockethub started at ${timestamp()} ---\n`);
|
|
39
55
|
|
|
40
56
|
const child = spawn("bun", ["run", join(dirname(import.meta.path), "sockethub")], {
|
|
41
|
-
env: { ...process.env,
|
|
57
|
+
env: { ...process.env, LOG_LEVEL: "debug" },
|
|
42
58
|
stdio: ["inherit", "pipe", "pipe"],
|
|
43
59
|
});
|
|
44
60
|
|
|
@@ -46,7 +62,7 @@ function processLine(line: string, stream: "stdout" | "stderr") {
|
|
|
46
62
|
// Always write to file
|
|
47
63
|
logFile.write(`${line}\n`);
|
|
48
64
|
|
|
49
|
-
// Check if namespace passes
|
|
65
|
+
// Check if namespace passes the console filter
|
|
50
66
|
// Non-debug lines (console.log from init, errors) are always shown
|
|
51
67
|
const namespace = getNamespace(line);
|
|
52
68
|
const show = namespace
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sockethub",
|
|
3
3
|
"description": "A polyglot messaging service",
|
|
4
|
-
"version": "5.0.0-alpha.
|
|
4
|
+
"version": "5.0.0-alpha.13",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Nick Jennings <nick@silverbucket.net>",
|
|
7
7
|
"license": "LGPL-3.0+",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bin": "bin/sockethub",
|
|
10
10
|
"preferGlobal": true,
|
|
11
11
|
"engines": {
|
|
12
|
-
"
|
|
12
|
+
"node": ">=20"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"sockethub",
|
|
@@ -33,24 +33,23 @@
|
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|
|
35
35
|
"url": "git+https://github.com/sockethub/sockethub.git",
|
|
36
|
-
"directory": "
|
|
36
|
+
"directory": "packages/sockethub"
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://sockethub.org",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@sockethub/platform-dummy": "^3.0.0-alpha.
|
|
41
|
-
"@sockethub/platform-feeds": "^4.0.0-alpha.
|
|
42
|
-
"@sockethub/platform-irc": "^4.0.0-alpha.
|
|
43
|
-
"@sockethub/platform-xmpp": "^5.0.0-alpha.
|
|
44
|
-
"@sockethub/server": "^5.0.0-alpha.
|
|
40
|
+
"@sockethub/platform-dummy": "^3.0.0-alpha.13",
|
|
41
|
+
"@sockethub/platform-feeds": "^4.0.0-alpha.13",
|
|
42
|
+
"@sockethub/platform-irc": "^4.0.0-alpha.13",
|
|
43
|
+
"@sockethub/platform-xmpp": "^5.0.0-alpha.13",
|
|
44
|
+
"@sockethub/server": "^5.0.0-alpha.13"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "bun build.js",
|
|
48
48
|
"clean:deps": "rm -rf node_modules",
|
|
49
49
|
"dev": "bun run --hot ./bin/sockethub --examples",
|
|
50
|
-
"info": "
|
|
51
|
-
"start": "
|
|
52
|
-
"start:
|
|
53
|
-
"start:quiet": "bun run ./bin/sockethub"
|
|
50
|
+
"info": "node ./bin/sockethub --info",
|
|
51
|
+
"start": "node ./bin/sockethub",
|
|
52
|
+
"start:logged": "bun ./bin/sockethub-logged"
|
|
54
53
|
},
|
|
55
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "864733e5b34449ef39542eceb4ff11aa308081bc"
|
|
56
55
|
}
|