@agoric/cosmic-swingset 0.41.3 → 0.41.4-calypso-dev-dabccdc.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/Makefile CHANGED
@@ -73,7 +73,7 @@ start-amm-etc: $(INTER_PROTO)/gov-amm-vaults-etc.js
73
73
 
74
74
  gov-q:
75
75
  $(AGCH) query gov proposals --output json | \
76
- jq -c '.proposals[] | [.proposal_id,.voting_end_time,.status]'
76
+ jq -c '.proposals[] | [if .proposal_id == null then .id else .proposal_id end,.voting_end_time,.status]'
77
77
 
78
78
  # This probably shouldn't install, but that's what published instructions
79
79
  # expect.
@@ -81,7 +81,7 @@ all: build-chain install-nobuild
81
81
 
82
82
  client: build-helper install-nobuild
83
83
 
84
- install-nobuild: install-local install-agd install-helper
84
+ install-nobuild: install-local install-agd
85
85
 
86
86
  install: all install-nobuild
87
87
 
@@ -141,18 +141,18 @@ scenario2-setup:
141
141
 
142
142
  t1/decentral-economy-config.json: $(ECONOMY_PROPOSALS)
143
143
  jq -s '.[0] * { coreProposals: .[1] }' \
144
- ../vats/decentral-core-config.json \
144
+ ../vm-config/decentral-core-config.json \
145
145
  '$(ECONOMY_PROPOSALS)' > t1/decentral-economy-config.json
146
146
 
147
147
  scenario2-run-chain-economy: t1/decentral-economy-config.json
148
- echo "DEPRECATED use: CHAIN_BOOTSTRAP_VAT_CONFIG=@agoric/vats/decentral-itest-vaults-config.json scenario2-run-chain"
148
+ echo "DEPRECATED use: CHAIN_BOOTSTRAP_VAT_CONFIG=@agoric/vm-config/decentral-itest-vaults-config.json scenario2-run-chain"
149
149
  CHAIN_BOOTSTRAP_VAT_CONFIG="$$PWD/t1/decentral-economy-config.json" \
150
150
  $(MAKE) scenario2-run-chain
151
151
 
152
152
  # We want to use the same configuration that will be deployed to the next
153
153
  # devnet.agoric.net so that developers can test their code against it locally.
154
- scenario2-run-chain: ../vats/decentral-devnet-config.json
155
- CHAIN_BOOTSTRAP_VAT_CONFIG="$${CHAIN_BOOTSTRAP_VAT_CONFIG-$$PWD/../vats/decentral-devnet-config.json}" \
154
+ scenario2-run-chain: ../vm-config/decentral-devnet-config.json
155
+ CHAIN_BOOTSTRAP_VAT_CONFIG="$${CHAIN_BOOTSTRAP_VAT_CONFIG-$$PWD/../vm-config/decentral-devnet-config.json}" \
156
156
  OTEL_EXPORTER_PROMETHEUS_PORT=$(OTEL_EXPORTER_PROMETHEUS_PORT) \
157
157
  $(AGC) --home=t1/n0 start --log_level=warn $(AGC_START_ARGS)
158
158
 
@@ -363,10 +363,6 @@ install-agd:
363
363
  mkdir -p "$(BIN)"
364
364
  ln -sf "$(SDK_ROOT)/bin/agd" "$(BIN)/agd"
365
365
 
366
- install-helper:
367
- mkdir -p "$(BIN)"
368
- ln -sf "$(SDK_ROOT)/bin/agd" "$(BIN)/ag-cosmos-helper"
369
-
370
366
  install-local:
371
367
  mkdir -p "$(BIN)"
372
368
  ln -sf "$(SDK_ROOT)/bin/agd" "$(BIN)/ag-chain-cosmos"
package/README.md CHANGED
@@ -52,7 +52,7 @@ agd --help
52
52
 
53
53
  #### Scenario 3 : no testnet (develop off-chain demo)
54
54
 
55
- In this scenario, you run:
55
+ In this scenario, you run:
56
56
  - a **solo node** with the server-side Pixel Demo running and exposing an HTTP server in localhost
57
57
  - a **web browser** connecting to the solo node and enabling user interaction with the Pixel Demo
58
58
 
@@ -76,7 +76,7 @@ The HTML frontend code is pure JS/DOM (no additional libraries yet) in the
76
76
 
77
77
  #### Scenario 2: a single local testnet node (develop on-chain demo)
78
78
 
79
- In this scenario, you run:
79
+ In this scenario, you run:
80
80
  - one or several **solo node(s)** each exposing an HTTP server in localhost (each to a different port)
81
81
  - a **single local blockchain testnet node** with the server-side Pixel Demo running
82
82
  - a **web browser** connecting to each solo node via a different port and enabling user interaction with the Pixel Demo
@@ -107,12 +107,12 @@ You can communicate with the node by opening http://localhost:8000/
107
107
  You can start other solo nodes with `make scenario2-run-client BASE_PORT=8001` and `make scenario2-run-client BASE_PORT=8002` and communicate with them respectively with on http://localhost:8001/ and http://localhost:8002/
108
108
 
109
109
 
110
-
110
+
111
111
  #### Scenario 1: your own local testnet (develop testnet provisioner)
112
112
 
113
- In this scenario, you run:
113
+ In this scenario, you run:
114
114
  - a **solo node** exposing an HTTP server in localhost
115
- - a **several local blockchain testnet nodes** with the server-side Pixel Demo running on top.
115
+ - a **several local blockchain testnet nodes** with the server-side Pixel Demo running on top.
116
116
  - a **web browser** connecting to the solo node and enabling user interaction with the Pixel Demo
117
117
 
118
118
  This scenario is only useful for moving toward deploying the local source code as a new testnet. Before using this scenario, you should test your on-chain code under Scenario 2.
@@ -132,7 +132,7 @@ See [Testnet Tutorial](#testnet-tutorial) for more guidance.
132
132
 
133
133
  #### Scenario 0: a public testnet (kick the tires)
134
134
 
135
- In this scenario, you run:
135
+ In this scenario, you run:
136
136
  - a **solo node** exposing an HTTP server in localhost
137
137
  - a **web browser** connecting to the solo node and enabling user interaction with the Pixel Demo
138
138
 
@@ -148,7 +148,7 @@ Alternatively, running the solo node from a Docker image and no local source cod
148
148
 
149
149
  Now go to http://localhost:8000/ to interact with your new solo node.
150
150
 
151
- Learn more about ERTP [here](https://agoric.com/documentation/ertp/guide/).
151
+ Learn more about ERTP [here](https://agoric.com/documentation/ertp/guide/).
152
152
 
153
153
  ### Initial Endowments
154
154
 
@@ -194,7 +194,7 @@ If you are not running on Linux, you will need to use Docker to provide the setu
194
194
 
195
195
  If you want to install the Docker image scripts on this machine, run:
196
196
 
197
- ```
197
+ ```sh
198
198
  $ sudo make docker-install
199
199
  ```
200
200
 
package/calc-rpcport.js CHANGED
@@ -11,6 +11,7 @@ import toml from '@iarna/toml';
11
11
 
12
12
  const configString = fs.readFileSync(process.argv[2]).toString();
13
13
  const config = toml.parse(configString);
14
+ // @ts-expect-error Property 'laddr' does not exist on type 'AnyJson'
14
15
  const { laddr } = config.rpc; // like tcp://0.0.0.0:26657
15
16
  // eslint-disable-next-line no-useless-escape
16
17
  const m = laddr.match(/^tcp:\/\/([\d\.]+):(\d+)$/);
@@ -1,138 +1,147 @@
1
- [
2
- "@agoric/vats/scripts/init-core.js",
3
- "@agoric/vats/scripts/init-network.js",
4
- {
5
- "module": "@agoric/inter-protocol/scripts/init-core.js",
6
- "entrypoint": "defaultProposalBuilder",
7
- "args": [
1
+ {
2
+ "steps": [
3
+ [
4
+ "@agoric/builders/scripts/vats/init-core.js"
5
+ ],
6
+ [
7
+ "@agoric/builders/scripts/vats/init-network.js",
8
+ "@agoric/builders/scripts/pegasus/init-core.js",
9
+ "@agoric/builders/scripts/vats/init-transfer.js"
10
+ ],
11
+ [
8
12
  {
9
- "econCommitteeOptions": {
10
- "committeeSize": 1
11
- },
12
- "minInitialPoolLiquidity": "0"
13
- }
14
- ]
15
- },
16
- "@agoric/pegasus/scripts/init-core.js",
17
- {
18
- "module": "@agoric/inter-protocol/scripts/add-collateral-core.js",
19
- "entrypoint": "defaultProposalBuilder",
20
- "args": [
13
+ "module": "@agoric/builders/scripts/inter-protocol/init-core.js",
14
+ "entrypoint": "defaultProposalBuilder",
15
+ "args": [
16
+ {
17
+ "econCommitteeOptions": {
18
+ "committeeSize": 1
19
+ },
20
+ "minInitialPoolLiquidity": "0"
21
+ }
22
+ ]
23
+ },
21
24
  {
22
- "interchainAssetOptions": {
23
- "denom": "ibc/toyatom",
24
- "decimalPlaces": 4,
25
- "keyword": "ATOM",
26
- "oracleBrand": "ATOM",
27
- "proposedName": "ATOM"
28
- }
29
- }
30
- ]
31
- },
32
- {
33
- "module": "@agoric/inter-protocol/scripts/add-collateral-core.js",
34
- "entrypoint": "psmProposalBuilder",
35
- "args": [
25
+ "module": "@agoric/builders/scripts/inter-protocol/add-collateral-core.js",
26
+ "entrypoint": "defaultProposalBuilder",
27
+ "args": [
28
+ {
29
+ "interchainAssetOptions": {
30
+ "denom": "ibc/toyatom",
31
+ "decimalPlaces": 4,
32
+ "keyword": "ATOM",
33
+ "oracleBrand": "ATOM",
34
+ "proposedName": "ATOM"
35
+ }
36
+ }
37
+ ]
38
+ },
36
39
  {
37
- "anchorOptions": {
38
- "denom": "ibc/toyusdc",
39
- "decimalPlaces": 6,
40
- "keyword": "USDC_axl",
41
- "proposedName": "USD Coin"
42
- }
43
- }
44
- ]
45
- },
46
- {
47
- "module": "@agoric/inter-protocol/scripts/add-collateral-core.js",
48
- "entrypoint": "psmProposalBuilder",
49
- "args": [
40
+ "module": "@agoric/builders/scripts/inter-protocol/add-collateral-core.js",
41
+ "entrypoint": "psmProposalBuilder",
42
+ "args": [
43
+ {
44
+ "anchorOptions": {
45
+ "denom": "ibc/toyusdc",
46
+ "decimalPlaces": 6,
47
+ "keyword": "USDC_axl",
48
+ "proposedName": "USD Coin"
49
+ }
50
+ }
51
+ ]
52
+ },
50
53
  {
51
- "anchorOptions": {
52
- "denom": "ibc/usdc5678",
53
- "decimalPlaces": 6,
54
- "keyword": "USDC_grv",
55
- "proposedName": "USC Coin"
56
- }
57
- }
58
- ]
59
- },
60
- {
61
- "module": "@agoric/inter-protocol/scripts/add-collateral-core.js",
62
- "entrypoint": "psmProposalBuilder",
63
- "args": [
54
+ "module": "@agoric/builders/scripts/inter-protocol/add-collateral-core.js",
55
+ "entrypoint": "psmProposalBuilder",
56
+ "args": [
57
+ {
58
+ "anchorOptions": {
59
+ "denom": "ibc/usdc5678",
60
+ "decimalPlaces": 6,
61
+ "keyword": "USDC_grv",
62
+ "proposedName": "USC Coin"
63
+ }
64
+ }
65
+ ]
66
+ },
64
67
  {
65
- "anchorOptions": {
66
- "denom": "ibc/usdt1234",
67
- "decimalPlaces": 6,
68
- "keyword": "USDT_axl",
69
- "proposedName": "Tether USD"
70
- }
71
- }
72
- ]
73
- },
74
- {
75
- "module": "@agoric/inter-protocol/scripts/add-collateral-core.js",
76
- "entrypoint": "psmProposalBuilder",
77
- "args": [
68
+ "module": "@agoric/builders/scripts/inter-protocol/add-collateral-core.js",
69
+ "entrypoint": "psmProposalBuilder",
70
+ "args": [
71
+ {
72
+ "anchorOptions": {
73
+ "denom": "ibc/usdt1234",
74
+ "decimalPlaces": 6,
75
+ "keyword": "USDT_axl",
76
+ "proposedName": "Tether USD"
77
+ }
78
+ }
79
+ ]
80
+ },
78
81
  {
79
- "anchorOptions": {
80
- "denom": "ibc/toyollie",
81
- "decimalPlaces": 6,
82
- "keyword": "USDT_grv",
83
- "proposedName": "Tether USD"
84
- }
85
- }
86
- ]
87
- },
88
- {
89
- "module": "@agoric/inter-protocol/scripts/add-collateral-core.js",
90
- "entrypoint": "psmProposalBuilder",
91
- "args": [
82
+ "module": "@agoric/builders/scripts/inter-protocol/add-collateral-core.js",
83
+ "entrypoint": "psmProposalBuilder",
84
+ "args": [
85
+ {
86
+ "anchorOptions": {
87
+ "denom": "ibc/toyollie",
88
+ "decimalPlaces": 6,
89
+ "keyword": "USDT_grv",
90
+ "proposedName": "Tether USD"
91
+ }
92
+ }
93
+ ]
94
+ },
92
95
  {
93
- "anchorOptions": {
94
- "denom": "ibc/toyellie",
95
- "decimalPlaces": 6,
96
- "keyword": "AUSD",
97
- "proposedName": "Anchor USD"
98
- }
99
- }
100
- ]
101
- },
102
- {
103
- "module": "@agoric/inter-protocol/scripts/price-feed-core.js",
104
- "entrypoint": "defaultProposalBuilder",
105
- "args": [
96
+ "module": "@agoric/builders/scripts/inter-protocol/add-collateral-core.js",
97
+ "entrypoint": "psmProposalBuilder",
98
+ "args": [
99
+ {
100
+ "anchorOptions": {
101
+ "denom": "ibc/toyellie",
102
+ "decimalPlaces": 6,
103
+ "keyword": "AUSD",
104
+ "proposedName": "Anchor USD"
105
+ }
106
+ }
107
+ ]
108
+ },
106
109
  {
107
- "AGORIC_INSTANCE_NAME": "ATOM-USD price feed",
108
- "oracleAddresses": [
109
- "@PRIMARY_ADDRESS@",
110
- "agoric1dy0yegdsev4xvce3dx7zrz2ad9pesf5svzud6y"
111
- ],
112
- "IN_BRAND_LOOKUP": [
113
- "agoricNames",
114
- "oracleBrand",
115
- "ATOM"
116
- ],
117
- "IN_BRAND_DECIMALS": 6,
118
- "OUT_BRAND_LOOKUP": [
119
- "agoricNames",
120
- "oracleBrand",
121
- "USD"
122
- ],
123
- "OUT_BRAND_DECIMALS": 4
124
- }
125
- ]
126
- },
127
- {
128
- "module": "@agoric/inter-protocol/scripts/invite-committee-core.js",
129
- "entrypoint": "defaultProposalBuilder",
130
- "args": [
110
+ "module": "@agoric/builders/scripts/inter-protocol/price-feed-core.js",
111
+ "entrypoint": "defaultProposalBuilder",
112
+ "args": [
113
+ {
114
+ "AGORIC_INSTANCE_NAME": "ATOM-USD price feed",
115
+ "oracleAddresses": [
116
+ "@PRIMARY_ADDRESS@",
117
+ "agoric1dy0yegdsev4xvce3dx7zrz2ad9pesf5svzud6y"
118
+ ],
119
+ "IN_BRAND_LOOKUP": [
120
+ "agoricNames",
121
+ "oracleBrand",
122
+ "ATOM"
123
+ ],
124
+ "IN_BRAND_DECIMALS": 6,
125
+ "OUT_BRAND_LOOKUP": [
126
+ "agoricNames",
127
+ "oracleBrand",
128
+ "USD"
129
+ ],
130
+ "OUT_BRAND_DECIMALS": 4
131
+ }
132
+ ]
133
+ },
131
134
  {
132
- "voterAddresses": {
133
- "someone": "@PRIMARY_ADDRESS@"
134
- }
135
+ "module": "@agoric/builders/scripts/inter-protocol/invite-committee-core.js",
136
+ "entrypoint": "defaultProposalBuilder",
137
+ "args": [
138
+ {
139
+ "voterAddresses": {
140
+ "someone": "@PRIMARY_ADDRESS@"
141
+ }
142
+ }
143
+ ]
135
144
  }
136
145
  ]
137
- }
138
- ]
146
+ ]
147
+ }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@agoric/cosmic-swingset",
3
- "version": "0.41.3",
3
+ "version": "0.41.4-calypso-dev-dabccdc.0+dabccdc",
4
4
  "description": "Agoric's Cosmos blockchain integration",
5
5
  "type": "module",
6
6
  "bin": {
7
- "ag-chain-cosmos": "./src/entrypoint.js"
7
+ "ag-chain-cosmos": "src/entrypoint.js"
8
8
  },
9
9
  "main": "src/chain-main.js",
10
10
  "repository": "https://github.com/Agoric/agoric-sdk",
@@ -15,49 +15,60 @@
15
15
  "test:xs": "exit 0",
16
16
  "lint-fix": "yarn lint:eslint --fix",
17
17
  "lint": "run-s --continue-on-error lint:*",
18
- "lint:types": "tsc -p jsconfig.json",
18
+ "lint:types": "tsc",
19
19
  "lint:eslint": "eslint ."
20
20
  },
21
21
  "keywords": [],
22
22
  "author": "Agoric",
23
23
  "license": "Apache-2.0",
24
24
  "dependencies": {
25
- "@agoric/assert": "^0.6.0",
26
- "@agoric/cosmos": "^0.34.1",
27
- "@agoric/deploy-script-support": "^0.10.3",
28
- "@agoric/internal": "^0.3.2",
29
- "@agoric/store": "^0.9.2",
30
- "@agoric/swing-store": "^0.9.1",
31
- "@agoric/swingset-vat": "^0.32.2",
32
- "@agoric/telemetry": "^0.6.2",
33
- "@endo/far": "^0.2.18",
34
- "@endo/import-bundle": "^0.3.4",
35
- "@endo/init": "^0.5.56",
36
- "@endo/marshal": "^0.8.5",
37
- "@endo/nat": "^4.1.27",
38
- "@endo/promise-kit": "^0.2.56",
25
+ "@agoric/assert": "0.6.1-calypso-dev-dabccdc.0+dabccdc",
26
+ "@agoric/builders": "0.1.1-calypso-dev-dabccdc.0+dabccdc",
27
+ "@agoric/cosmos": "0.34.2-calypso-dev-dabccdc.0+dabccdc",
28
+ "@agoric/deploy-script-support": "0.10.4-calypso-dev-dabccdc.0+dabccdc",
29
+ "@agoric/internal": "0.3.3-calypso-dev-dabccdc.0+dabccdc",
30
+ "@agoric/store": "0.9.3-calypso-dev-dabccdc.0+dabccdc",
31
+ "@agoric/swing-store": "0.9.2-calypso-dev-dabccdc.0+dabccdc",
32
+ "@agoric/swingset-vat": "0.32.3-calypso-dev-dabccdc.0+dabccdc",
33
+ "@agoric/telemetry": "0.6.3-calypso-dev-dabccdc.0+dabccdc",
34
+ "@agoric/vm-config": "0.1.1-calypso-dev-dabccdc.0+dabccdc",
35
+ "@endo/bundle-source": "^3.2.3",
36
+ "@endo/env-options": "^1.1.4",
37
+ "@endo/far": "^1.1.2",
38
+ "@endo/import-bundle": "^1.1.2",
39
+ "@endo/init": "^1.1.2",
40
+ "@endo/marshal": "^1.5.0",
41
+ "@endo/nat": "^5.0.7",
42
+ "@endo/promise-kit": "^1.1.2",
39
43
  "@iarna/toml": "^2.2.3",
40
- "@opentelemetry/sdk-metrics": "^0.32.0",
44
+ "@opentelemetry/api": "~1.3.0",
45
+ "@opentelemetry/sdk-metrics": "~1.9.0",
41
46
  "anylogger": "^0.21.0",
42
47
  "deterministic-json": "^1.0.5",
43
48
  "import-meta-resolve": "^2.2.1",
44
49
  "tmp": "^0.2.1"
45
50
  },
46
51
  "devDependencies": {
47
- "ava": "^5.2.0",
48
- "c8": "^7.13.0"
52
+ "ava": "^5.3.0",
53
+ "c8": "^9.1.0"
49
54
  },
50
55
  "publishConfig": {
51
56
  "access": "public"
52
57
  },
53
58
  "engines": {
54
- "node": ">=14.15.0"
59
+ "node": "^18.12 || ^20.9"
55
60
  },
56
61
  "ava": {
57
62
  "files": [
58
- "test/**/test-*.js"
63
+ "test/**/*.test.*"
64
+ ],
65
+ "require": [
66
+ "@endo/init/debug.js"
59
67
  ],
60
68
  "timeout": "20m"
61
69
  },
62
- "gitHead": "ba3b776444425bbcb275ce918794d9259f8e15da"
70
+ "typeCoverage": {
71
+ "atLeast": 80.49
72
+ },
73
+ "gitHead": "dabccdcdabd3793ecae0a2b8b955c9c34150f12f"
63
74
  }
package/perf.sh CHANGED
@@ -21,7 +21,10 @@ curl "$url"
21
21
  # Run the Apache Benchmark:
22
22
  ab -n 16000 -c 5 "$url"
23
23
 
24
- { sleep 1; : NOTE: This will time out because of rate limiting; } &
24
+ {
25
+ sleep 1
26
+ : NOTE: This will time out because of rate limiting
27
+ } &
25
28
  # This one hangs (because of rate limiting at around 16350 requests since the
26
29
  # last one started):
27
30
  ab -n 3000 -c 5 "$url"
@@ -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;