@agoric/cosmic-swingset 0.41.4-dev-121b677.0 → 0.41.4-dev-d2ea4b4.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/cosmic-swingset",
3
- "version": "0.41.4-dev-121b677.0+121b677",
3
+ "version": "0.41.4-dev-d2ea4b4.0+d2ea4b4",
4
4
  "description": "Agoric's Cosmos blockchain integration",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,17 +22,18 @@
22
22
  "author": "Agoric",
23
23
  "license": "Apache-2.0",
24
24
  "dependencies": {
25
- "@agoric/assert": "0.6.1-dev-121b677.0+121b677",
26
- "@agoric/builders": "0.1.1-dev-121b677.0+121b677",
27
- "@agoric/cosmos": "0.34.2-dev-121b677.0+121b677",
28
- "@agoric/deploy-script-support": "0.10.4-dev-121b677.0+121b677",
29
- "@agoric/internal": "0.3.3-dev-121b677.0+121b677",
30
- "@agoric/store": "0.9.3-dev-121b677.0+121b677",
31
- "@agoric/swing-store": "0.9.2-dev-121b677.0+121b677",
32
- "@agoric/swingset-vat": "0.32.3-dev-121b677.0+121b677",
33
- "@agoric/telemetry": "0.6.3-dev-121b677.0+121b677",
34
- "@agoric/vm-config": "0.1.1-dev-121b677.0+121b677",
25
+ "@agoric/assert": "0.6.1-dev-d2ea4b4.0+d2ea4b4",
26
+ "@agoric/builders": "0.1.1-dev-d2ea4b4.0+d2ea4b4",
27
+ "@agoric/cosmos": "0.34.2-dev-d2ea4b4.0+d2ea4b4",
28
+ "@agoric/deploy-script-support": "0.10.4-dev-d2ea4b4.0+d2ea4b4",
29
+ "@agoric/internal": "0.3.3-dev-d2ea4b4.0+d2ea4b4",
30
+ "@agoric/store": "0.9.3-dev-d2ea4b4.0+d2ea4b4",
31
+ "@agoric/swing-store": "0.9.2-dev-d2ea4b4.0+d2ea4b4",
32
+ "@agoric/swingset-vat": "0.32.3-dev-d2ea4b4.0+d2ea4b4",
33
+ "@agoric/telemetry": "0.6.3-dev-d2ea4b4.0+d2ea4b4",
34
+ "@agoric/vm-config": "0.1.1-dev-d2ea4b4.0+d2ea4b4",
35
35
  "@endo/bundle-source": "^3.0.2",
36
+ "@endo/env-options": "^1.1.0",
36
37
  "@endo/far": "^1.0.2",
37
38
  "@endo/import-bundle": "^1.0.2",
38
39
  "@endo/init": "^1.0.2",
@@ -69,5 +70,5 @@
69
70
  "typeCoverage": {
70
71
  "atLeast": 79.32
71
72
  },
72
- "gitHead": "121b67747aaa842adff618c610dbb0835d88cc33"
73
+ "gitHead": "d2ea4b46b9efa61e97eec8711830d9fdd741ca55"
73
74
  }
@@ -1,45 +1,55 @@
1
- /* global process */
1
+ import {
2
+ getEnvironmentOptionsList,
3
+ getEnvironmentOption,
4
+ } from '@endo/env-options';
2
5
  import anylogger from 'anylogger';
3
6
 
4
7
  // Turn on debugging output with DEBUG=agoric
5
8
 
6
- const { DEBUG: debugEnv = '' } = process.env;
7
- let debugging;
9
+ const DEBUG_LIST = getEnvironmentOptionsList('DEBUG');
8
10
 
9
- const filterOutPrefixes = [];
10
- // Mute vat logging unless requested, for determinism.
11
- if (!debugEnv.includes('SwingSet:vat')) {
12
- filterOutPrefixes.push('SwingSet:vat:');
13
- }
14
- // Mute liveSlots logging unless requested, for determinism.
15
- if (!debugEnv.includes('SwingSet:ls')) {
16
- filterOutPrefixes.push('SwingSet:ls:');
17
- }
11
+ const isVatLogNameColon = nameColon =>
12
+ ['SwingSet:ls:', 'SwingSet:vat:'].some(sel => nameColon.startsWith(sel));
18
13
 
19
- if (process.env.DEBUG === undefined) {
20
- // DEBUG wasn't set, default to info level; quieter than normal.
21
- debugging = 'info';
22
- } else if (debugEnv.includes('agoric')) {
23
- // $DEBUG set and we're enabled; loudly verbose.
24
- debugging = 'debug';
25
- } else {
26
- // $DEBUG set but we're not enabled; slightly louder than normal.
27
- debugging = 'log';
14
+ // Turn on debugging output with DEBUG=agoric or DEBUG=agoric:${level}
15
+ let selectedLevel =
16
+ DEBUG_LIST.length || getEnvironmentOption('DEBUG', 'unset') === 'unset'
17
+ ? 'log'
18
+ : 'info';
19
+ for (const selector of DEBUG_LIST) {
20
+ const parts = selector.split(':');
21
+ if (parts[0] !== 'agoric') {
22
+ continue;
23
+ }
24
+ if (parts.length > 1) {
25
+ selectedLevel = parts[1];
26
+ } else {
27
+ selectedLevel = 'debug';
28
+ }
28
29
  }
29
- const defaultLevel = anylogger.levels[debugging];
30
+ const selectedCode = anylogger.levels[selectedLevel];
31
+ const globalCode = selectedCode === undefined ? -Infinity : selectedCode;
30
32
 
31
33
  const oldExt = anylogger.ext;
32
34
  anylogger.ext = (l, o) => {
33
35
  l = oldExt(l, o);
34
- l.enabledFor = lvl => defaultLevel >= anylogger.levels[lvl];
36
+ l.enabledFor = lvl => globalCode >= anylogger.levels[lvl];
35
37
 
36
38
  const prefix = l.name.replace(/:/g, ': ');
37
- const filteredOut = filterOutPrefixes.find(pfx => l.name.startsWith(pfx));
39
+
40
+ const nameColon = `${l.name}:`;
41
+ const logBelongsToVat = isVatLogNameColon(nameColon);
42
+
43
+ // If this is a vat log, then it is enabled by a selector in DEBUG_LIST.
44
+ const logMatchesSelector =
45
+ !logBelongsToVat ||
46
+ DEBUG_LIST.some(selector => {
47
+ const selectorColon = `${selector}:`;
48
+ return nameColon.startsWith(selectorColon);
49
+ });
50
+
38
51
  for (const [level, code] of Object.entries(anylogger.levels)) {
39
- if (filteredOut || code > defaultLevel) {
40
- // Disable printing.
41
- l[level] = () => {};
42
- } else {
52
+ if (logMatchesSelector && globalCode >= code) {
43
53
  // Enable the printing with a prefix.
44
54
  const doLog = l[level];
45
55
  if (doLog) {
@@ -51,6 +61,9 @@ anylogger.ext = (l, o) => {
51
61
  } else {
52
62
  l[level] = () => {};
53
63
  }
64
+ } else {
65
+ // Disable printing.
66
+ l[level] = () => {};
54
67
  }
55
68
  }
56
69
  return l;