Skip to content

Commit 1118589

Browse files
committed
Add more logs
1 parent 64511a5 commit 1118589

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/common/src/chaindata/queries/Validators.ts

+3
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,14 @@ export const getValidators = async (
6767
chaindata: Chaindata,
6868
): Promise<string[]> => {
6969
try {
70+
logger.info(`getValidators: Retrieving validators`);
7071
if (!(await chaindata.checkApiConnection())) {
72+
logger.warn(`getValidators: No API connection`);
7173
return [];
7274
}
7375
const keys = await chaindata.api?.query.staking.validators.keys();
7476
if (!keys) {
77+
logger.warn(`getValidators: No keys`);
7578
return [];
7679
}
7780
const validators = keys.map((key) => key.args[0].toString());

packages/core/src/index.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ export const createAPIHandler = async (config, retries = 0) => {
3333
try {
3434
logger.info("Creating API Handler", winstonLabel);
3535
// Determine the correct set of endpoints based on the network prefix.
36-
const endpoints =
37-
config.global.networkPrefix === 2 || config.global.networkPrefix === 0
38-
? config.global.apiEndpoints
39-
: Constants.LocalEndpoints;
36+
const endpoints = config.global.apiEndpoints;
4037

4138
const handler = new ApiHandler(endpoints);
4239
await handler.setAPI();
@@ -183,7 +180,7 @@ export const addCleanCandidates = async (config: Config.ConfigSchema) => {
183180
// Remove any candidate in the db that doesn't have a stash or slotId
184181
await queries.deleteCandidatesWithMissingFields();
185182
} catch (e) {
186-
logger.error(JSON.stringify(e));
183+
logger.error("AddCandidates error: ", JSON.stringify(e));
187184
process.exit(1);
188185
}
189186
};
@@ -193,7 +190,7 @@ export const setChainMetadata = async (config) => {
193190
logger.info(`Setting chain metadata`, winstonLabel);
194191
await queries.setChainMetadata(config.global.networkPrefix);
195192
} catch (e) {
196-
logger.error(JSON.stringify(e));
193+
logger.error("Metadata error: ", JSON.stringify(e));
197194
process.exit(1);
198195
}
199196
};
@@ -208,7 +205,7 @@ export const initScorekeeper = async (config, handler, maybeBot) => {
208205
}
209206
return scorekeeper;
210207
} catch (e) {
211-
logger.error(JSON.stringify(e));
208+
logger.error("Scorekeeper error: ", e);
212209
process.exit(1);
213210
}
214211
};

0 commit comments

Comments
 (0)