@agoric/cosmic-swingset 0.41.4-dev-47470c7.0 → 0.41.4-dev-de9b2e7.0
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/package.json +20 -12
- package/src/anylogger-agoric.js +48 -47
- package/tools/inquisitor.mjs +1 -0
- package/tsconfig.json +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/cosmic-swingset",
|
|
3
|
-
"version": "0.41.4-dev-
|
|
3
|
+
"version": "0.41.4-dev-de9b2e7.0+de9b2e7",
|
|
4
4
|
"description": "Agoric's Cosmos blockchain integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"author": "Agoric",
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agoric/builders": "0.1.1-dev-
|
|
26
|
-
"@agoric/cosmos": "0.34.2-dev-
|
|
27
|
-
"@agoric/deploy-script-support": "0.10.4-dev-
|
|
28
|
-
"@agoric/internal": "0.3.3-dev-
|
|
29
|
-
"@agoric/store": "0.9.3-dev-
|
|
30
|
-
"@agoric/swing-store": "0.9.2-dev-
|
|
31
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
32
|
-
"@agoric/telemetry": "0.6.3-dev-
|
|
33
|
-
"@agoric/vm-config": "0.1.1-dev-
|
|
25
|
+
"@agoric/builders": "0.1.1-dev-de9b2e7.0+de9b2e7",
|
|
26
|
+
"@agoric/cosmos": "0.34.2-dev-de9b2e7.0+de9b2e7",
|
|
27
|
+
"@agoric/deploy-script-support": "0.10.4-dev-de9b2e7.0+de9b2e7",
|
|
28
|
+
"@agoric/internal": "0.3.3-dev-de9b2e7.0+de9b2e7",
|
|
29
|
+
"@agoric/store": "0.9.3-dev-de9b2e7.0+de9b2e7",
|
|
30
|
+
"@agoric/swing-store": "0.9.2-dev-de9b2e7.0+de9b2e7",
|
|
31
|
+
"@agoric/swingset-vat": "0.32.3-dev-de9b2e7.0+de9b2e7",
|
|
32
|
+
"@agoric/telemetry": "0.6.3-dev-de9b2e7.0+de9b2e7",
|
|
33
|
+
"@agoric/vm-config": "0.1.1-dev-de9b2e7.0+de9b2e7",
|
|
34
34
|
"@endo/bundle-source": "^3.5.1",
|
|
35
35
|
"@endo/env-options": "^1.1.8",
|
|
36
36
|
"@endo/errors": "^1.2.9",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"tmp": "^0.2.1"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@agoric/kmarshal": "0.1.1-dev-
|
|
55
|
+
"@agoric/kmarshal": "0.1.1-dev-de9b2e7.0+de9b2e7",
|
|
56
56
|
"ava": "^5.3.0",
|
|
57
57
|
"better-sqlite3": "^9.1.1",
|
|
58
58
|
"c8": "^10.1.2"
|
|
@@ -64,9 +64,17 @@
|
|
|
64
64
|
"node": "^18.12 || ^20.9"
|
|
65
65
|
},
|
|
66
66
|
"ava": {
|
|
67
|
+
"extensions": {
|
|
68
|
+
"js": true,
|
|
69
|
+
"ts": "module"
|
|
70
|
+
},
|
|
67
71
|
"files": [
|
|
68
72
|
"test/**/*.test.*"
|
|
69
73
|
],
|
|
74
|
+
"nodeArguments": [
|
|
75
|
+
"--import=ts-blank-space/register",
|
|
76
|
+
"--no-warnings"
|
|
77
|
+
],
|
|
70
78
|
"require": [
|
|
71
79
|
"@endo/init/debug.js"
|
|
72
80
|
],
|
|
@@ -75,5 +83,5 @@
|
|
|
75
83
|
"typeCoverage": {
|
|
76
84
|
"atLeast": 84.59
|
|
77
85
|
},
|
|
78
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "de9b2e7ca244a6d131f2e4206aeee76f814382e4"
|
|
79
87
|
}
|
package/src/anylogger-agoric.js
CHANGED
|
@@ -4,68 +4,69 @@ import {
|
|
|
4
4
|
getEnvironmentOption,
|
|
5
5
|
} from '@endo/env-options';
|
|
6
6
|
import anylogger from 'anylogger';
|
|
7
|
+
import { defineName } from '@agoric/internal/src/js-utils.js';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
/** @import {BaseLevels} from 'anylogger'; */
|
|
10
|
+
/** @typedef {keyof BaseLevels} LogLevel; */
|
|
9
11
|
|
|
10
|
-
const
|
|
12
|
+
const VAT_LOGGER_PREFIXES = Object.freeze([
|
|
13
|
+
'SwingSet:vat',
|
|
14
|
+
'SwingSet:ls', // "ls" for "liveslots"
|
|
15
|
+
]);
|
|
11
16
|
|
|
12
|
-
const
|
|
13
|
-
['SwingSet:ls:', 'SwingSet:vat:'].some(sel => nameColon.startsWith(sel));
|
|
17
|
+
const DEBUG_LIST = getEnvironmentOptionsList('DEBUG');
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
/**
|
|
20
|
+
* As documented in ../../../docs/env.md, the log level defaults to "log" when
|
|
21
|
+
* environment variable DEBUG is non-empty or unset, and to the quieter "info"
|
|
22
|
+
* when it is set to an empty string, but in either case is overridden if DEBUG
|
|
23
|
+
* is a comma-separated list that contains "agoric:none" or "agoric:${level}" or
|
|
24
|
+
* "agoric" (the last an alias for "agoric:debug").
|
|
25
|
+
*
|
|
26
|
+
* @type {string | undefined}
|
|
27
|
+
*/
|
|
28
|
+
let maxActiveLevel =
|
|
29
|
+
DEBUG_LIST.length > 0 || getEnvironmentOption('DEBUG', 'unset') === 'unset'
|
|
18
30
|
? 'log'
|
|
19
31
|
: 'info';
|
|
20
32
|
for (const selector of DEBUG_LIST) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (parts.length > 1) {
|
|
26
|
-
selectedLevel = parts[1];
|
|
27
|
-
} else {
|
|
28
|
-
selectedLevel = 'debug';
|
|
33
|
+
const fullSelector = selector === 'agoric' ? 'agoric:debug' : selector;
|
|
34
|
+
const [_, detail] = fullSelector.match(/^agoric:(.*)/gs) || [];
|
|
35
|
+
if (detail) {
|
|
36
|
+
maxActiveLevel = detail === 'none' ? undefined : detail;
|
|
29
37
|
}
|
|
30
38
|
}
|
|
31
|
-
const
|
|
32
|
-
|
|
39
|
+
const maxActiveLevelCode = /** @type {number} */ (
|
|
40
|
+
(maxActiveLevel && anylogger.levels[maxActiveLevel]) ?? -Infinity
|
|
41
|
+
);
|
|
33
42
|
|
|
34
43
|
const oldExt = anylogger.ext;
|
|
35
44
|
anylogger.ext = logger => {
|
|
36
|
-
|
|
37
|
-
l.enabledFor = lvl => globalCode >= anylogger.levels[lvl];
|
|
45
|
+
logger = oldExt(logger);
|
|
38
46
|
|
|
39
|
-
|
|
47
|
+
/** @type {(level: LogLevel) => boolean} */
|
|
48
|
+
const enabledFor = level => anylogger.levels[level] <= maxActiveLevelCode;
|
|
49
|
+
logger.enabledFor = enabledFor;
|
|
40
50
|
|
|
41
|
-
const nameColon = `${
|
|
42
|
-
const
|
|
51
|
+
const nameColon = `${logger.name}:`;
|
|
52
|
+
const label = logger.name.replaceAll(':', ': ');
|
|
43
53
|
|
|
44
|
-
//
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
DEBUG_LIST.some(
|
|
48
|
-
const selectorColon = `${selector}:`;
|
|
49
|
-
return nameColon.startsWith(selectorColon);
|
|
50
|
-
});
|
|
54
|
+
// Vat logs are suppressed unless matched by a prefix in DEBUG_LIST.
|
|
55
|
+
const suppressed =
|
|
56
|
+
VAT_LOGGER_PREFIXES.some(prefix => nameColon.startsWith(`${prefix}:`)) &&
|
|
57
|
+
!DEBUG_LIST.some(prefix => nameColon.startsWith(`${prefix}:`));
|
|
51
58
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
l[level] = () => {};
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
// Disable printing.
|
|
67
|
-
l[level] = () => {};
|
|
68
|
-
}
|
|
59
|
+
const levels = /** @type {LogLevel[]} */ (Object.keys(anylogger.levels));
|
|
60
|
+
for (const level of levels) {
|
|
61
|
+
const impl = logger[level];
|
|
62
|
+
const disabled = !impl || suppressed || !enabledFor(level);
|
|
63
|
+
logger[level] = disabled
|
|
64
|
+
? defineName(`dummy ${level}`, () => {})
|
|
65
|
+
: defineName(level, (...args) => {
|
|
66
|
+
// Prepend a timestamp and label.
|
|
67
|
+
const timestamp = new Date().toISOString();
|
|
68
|
+
impl(`${timestamp} ${label}:`, ...args);
|
|
69
|
+
});
|
|
69
70
|
}
|
|
70
|
-
return
|
|
71
|
+
return logger;
|
|
71
72
|
};
|
package/tools/inquisitor.mjs
CHANGED
|
@@ -318,6 +318,7 @@ export const makeHelpers = ({ db, EV }) => {
|
|
|
318
318
|
stable: { db, getRefs, kvGet, kvGetJSON, kvGlob, vatsByID, vatsByName },
|
|
319
319
|
});
|
|
320
320
|
};
|
|
321
|
+
/** @typedef {ReturnType<typeof makeHelpers>} Helpers */
|
|
321
322
|
|
|
322
323
|
/**
|
|
323
324
|
* Wrap a swing-store sub-store (kvStore/transcriptStore/etc.) with a
|