Skip to content

Commit f2b8e95

Browse files
chore: replace info-level logs with debug (#116)
1 parent c90f73a commit f2b8e95

File tree

19 files changed

+128
-94
lines changed

19 files changed

+128
-94
lines changed

packages/indexer-api/src/database/database.provider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export async function connectToDatabase(
77
) {
88
try {
99
const database = await createDataSource(databaseConfig).initialize();
10-
logger.info({
10+
logger.debug({
1111
at: "IndexerAPI#connectToDatabase",
1212
message: "Postgres connection established",
1313
});
@@ -16,6 +16,7 @@ export async function connectToDatabase(
1616
logger.error({
1717
at: "IndexerAPI#connectToDatabase",
1818
message: "Unable to connect to database",
19+
notificationPath: "across-indexer-error",
1920
error,
2021
});
2122
throw error;

packages/indexer-api/src/main.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ async function initializeRedis(
1818

1919
return new Promise<Redis>((resolve, reject) => {
2020
redis.on("ready", () => {
21-
logger.info({
22-
at: "Indexer-API",
21+
logger.debug({
22+
at: "IndexerAPI#initializeRedis",
2323
message: "Redis connection established",
2424
config,
2525
});
@@ -28,8 +28,9 @@ async function initializeRedis(
2828

2929
redis.on("error", (err) => {
3030
logger.error({
31-
at: "Indexer-API",
31+
at: "IndexerAPI#initializeRedis",
3232
message: "Redis connection failed",
33+
notificationPath: "across-indexer-error",
3334
error: err,
3435
});
3536
reject(err);
@@ -42,7 +43,7 @@ export async function connectToDatabase(
4243
) {
4344
try {
4445
const database = await createDataSource(databaseConfig).initialize();
45-
logger.info({
46+
logger.debug({
4647
at: "IndexerAPI#connectToDatabase",
4748
message: "Postgres connection established",
4849
});
@@ -51,6 +52,7 @@ export async function connectToDatabase(
5152
logger.error({
5253
at: "IndexerAPI#connectToDatabase",
5354
message: "Unable to connect to database",
55+
notificationPath: "across-indexer-error",
5456
error,
5557
});
5658
throw error;
@@ -102,8 +104,8 @@ export async function Main(
102104
const app = ExpressApp(allRouters);
103105

104106
logger.info({
107+
at: "IndexerAPI#Main",
105108
message: `Starting indexer api on port ${port}`,
106-
at: "main.ts",
107109
});
108110
void (await new Promise((res) => {
109111
app.listen(port, () => res(app));

packages/indexer-database/src/utils/BaseRepository.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class BaseRepository {
2121
.values(data)
2222
.returning("*")
2323
.execute();
24-
this.logger.info({
24+
this.logger.debug({
2525
at: "BaseRepository#insert",
2626
message: `Saved ${data.length} ${repository.metadata.name} events`,
2727
});
@@ -30,6 +30,7 @@ export class BaseRepository {
3030
this.logger.error({
3131
at: "BaseRepository#insert",
3232
message: `There was an error while saving ${repository.metadata.name} events`,
33+
notificationPath: "across-indexer-error",
3334
error,
3435
});
3536
if (throwError || this.throwError) {

packages/indexer/src/data-indexing/service/AcrossIndexerManager.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ export class AcrossIndexerManager {
5757

5858
private startHubPoolIndexer() {
5959
if (!this.config.enableHubPoolIndexer) {
60-
this.logger.warn("Hub pool indexer is disabled");
60+
this.logger.warn({
61+
at: "Indexer#AcrossIndexerManager#startHubPoolIndexer",
62+
message: "Hub pool indexer is disabled",
63+
});
6164
return;
6265
}
6366
const hubPoolIndexerDataHandler = new HubPoolIndexerDataHandler(
@@ -120,7 +123,10 @@ export class AcrossIndexerManager {
120123
this.spokePoolIndexers = spokePoolIndexers;
121124

122125
if (this.spokePoolIndexers.length === 0) {
123-
this.logger.warn("No spoke pool indexers to start");
126+
this.logger.warn({
127+
at: "Indexer#AcrossIndexerManager#startSpokePoolIndexers",
128+
message: "No spoke pool indexers to start",
129+
});
124130
return;
125131
}
126132
return Promise.all(

packages/indexer/src/data-indexing/service/HubPoolIndexerDataHandler.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export class HubPoolIndexerDataHandler implements IndexerDataHandler {
5050
blockRange: BlockRange,
5151
lastFinalisedBlock: number,
5252
) {
53-
this.logger.info({
54-
at: "HubPoolIndexerDataHandler::processBlockRange",
53+
this.logger.debug({
54+
at: "Indexer#HubPoolIndexerDataHandler#processBlockRange",
5555
message: `Start processing block range ${this.getDataIdentifier()}`,
5656
blockRange,
5757
lastFinalisedBlock,
@@ -64,8 +64,8 @@ export class HubPoolIndexerDataHandler implements IndexerDataHandler {
6464
let events: FetchEventsResult;
6565

6666
if (this.cachedFetchEventsResult) {
67-
this.logger.info({
68-
at: "HubPoolIndexerDataHandler::processBlockRange",
67+
this.logger.debug({
68+
at: "Indexer#HubPoolIndexerDataHandler#processBlockRange",
6969
message: `Using cached events for ${this.getDataIdentifier()}`,
7070
});
7171
events = this.cachedFetchEventsResult;
@@ -74,8 +74,8 @@ export class HubPoolIndexerDataHandler implements IndexerDataHandler {
7474
this.cachedFetchEventsResult = events;
7575
}
7676

77-
this.logger.info({
78-
at: "HubPoolIndexerDataHandler::processBlockRange",
77+
this.logger.debug({
78+
at: "Indexer#HubPoolIndexerDataHandler#processBlockRange",
7979
message: `Fetched events ${this.getDataIdentifier()}`,
8080
events: {
8181
proposedRootBundleEvents: events.proposedRootBundleEvents.length,
@@ -88,8 +88,8 @@ export class HubPoolIndexerDataHandler implements IndexerDataHandler {
8888
identifier: this.getDataIdentifier(),
8989
});
9090
await this.storeEvents(events, lastFinalisedBlock);
91-
this.logger.info({
92-
at: "HubPoolIndexerDataHandler::processBlockRange",
91+
this.logger.debug({
92+
at: "Indexer#HubPoolIndexerDataHandler#processBlockRange",
9393
message: `Finished processing block range ${this.getDataIdentifier()}`,
9494
blockRange,
9595
lastFinalisedBlock,

packages/indexer/src/data-indexing/service/Indexer.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export class Indexer {
5151
}
5252

5353
if (!blockRangeResult?.blockRange) {
54-
this.logger.info({
55-
at: "Indexer::start",
54+
this.logger.debug({
55+
at: "Indexer#start",
5656
message: `No new blocks to process ${this.dataHandler.getDataIdentifier()}`,
5757
blockRangeResult,
5858
dataIdentifier: this.dataHandler.getDataIdentifier(),
@@ -70,8 +70,10 @@ export class Indexer {
7070
blockRangeProcessedSuccessfully = true;
7171
} catch (error) {
7272
this.logger.error({
73-
at: "Indexer::start",
73+
at: "Indexer#start",
7474
message: "Error processing block range",
75+
notificationPath: "across-indexer-error",
76+
blockRangeResult,
7577
dataIdentifier: this.dataHandler.getDataIdentifier(),
7678
error,
7779
});
@@ -80,8 +82,8 @@ export class Indexer {
8082
if (!blockRangeResult?.isBackfilling) {
8183
await across.utils.delay(this.config.loopWaitTimeSeconds);
8284
} else {
83-
this.logger.info({
84-
at: "Indexer::start",
85+
this.logger.debug({
86+
at: "Indexer#start",
8587
message: `Skip delay ${this.dataHandler.getDataIdentifier()}. Backfill in progress...`,
8688
dataIdentifier: this.dataHandler.getDataIdentifier(),
8789
});
@@ -96,7 +98,7 @@ export class Indexer {
9698
*/
9799
public stopGracefully() {
98100
this.logger.info({
99-
at: "Indexer::stopGracefully",
101+
at: "Indexer#stopGracefully",
100102
message: `Requesting indexer ${this.dataHandler.getDataIdentifier()} to be stopped`,
101103
});
102104
this.stopRequested = true;

packages/indexer/src/data-indexing/service/SpokePoolIndexerDataHandler.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ export class SpokePoolIndexerDataHandler implements IndexerDataHandler {
7373
blockRange: BlockRange,
7474
lastFinalisedBlock: number,
7575
) {
76-
this.logger.info({
77-
at: "SpokePoolIndexerDataHandler::processBlockRange",
76+
this.logger.debug({
77+
at: "Indexer#SpokePoolIndexerDataHandler#processBlockRange",
7878
message: `Processing block range ${this.getDataIdentifier()}`,
7979
blockRange,
8080
lastFinalisedBlock,
@@ -91,8 +91,8 @@ export class SpokePoolIndexerDataHandler implements IndexerDataHandler {
9191
).reduce((acc, speedUps) => {
9292
return acc + Object.values(speedUps).length;
9393
}, 0);
94-
this.logger.info({
95-
at: "SpokePoolIndexerDataHandler::processBlockRange",
94+
this.logger.debug({
95+
at: "Indexer#SpokePoolIndexerDataHandler#processBlockRange",
9696
message: `Found events for ${this.getDataIdentifier()}`,
9797
events: {
9898
v3FundsDepositedEvents: events.v3FundsDepositedEvents.length,

packages/indexer/src/database/database.provider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export async function connectToDatabase(
77
) {
88
try {
99
const database = await createDataSource(databaseConfig).initialize();
10-
logger.info({
10+
logger.debug({
1111
at: "Indexer#connectToDatabase",
1212
message: "Postgres connection established",
1313
});
@@ -16,6 +16,7 @@ export async function connectToDatabase(
1616
logger.error({
1717
at: "Indexer#connectToDatabase",
1818
message: "Unable to connect to database",
19+
notificationPath: "across-indexer-error",
1920
error,
2021
});
2122
throw error;

packages/indexer/src/generics/BaseIndexer.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export abstract class BaseIndexer {
1212
private readonly name: string,
1313
) {
1414
this.logger.debug({
15-
at: "BaseIndexer#constructor",
15+
at: "Indexer#BaseIndexer#constructor",
1616
message: `Instantiated indexer ${name}`,
1717
});
1818
}
@@ -25,8 +25,8 @@ export abstract class BaseIndexer {
2525
* @param delay The delay in seconds between each iteration of the indexer
2626
*/
2727
public async start(delay: number): Promise<void> {
28-
this.logger.info({
29-
at: "BaseIndexer#start",
28+
this.logger.debug({
29+
at: "Indexer#BaseIndexer#start",
3030
message: `Starting indexer ${this.name}`,
3131
});
3232

@@ -35,8 +35,9 @@ export abstract class BaseIndexer {
3535
await this.initialize();
3636
} catch (e) {
3737
this.logger.error({
38-
at: "BaseIndexer#start",
38+
at: "Indexer#BaseIndexer#start",
3939
message: `Failed to initialize ${this.name}`,
40+
notificationPath: "across-indexer-error",
4041
error: (e as unknown as Error).message,
4142
});
4243
return;
@@ -48,8 +49,8 @@ export abstract class BaseIndexer {
4849
await across.utils.delay(delay);
4950
} while (!this.stopRequested);
5051

51-
this.logger.info({
52-
at: "BaseIndexer#start",
52+
this.logger.debug({
53+
at: "Indexer#BaseIndexer#start",
5354
message: `Ended halted ${this.name}`,
5455
});
5556
}
@@ -60,7 +61,7 @@ export abstract class BaseIndexer {
6061
*/
6162
public stop(): void {
6263
this.logger.info({
63-
at: "BaseIndexer#stop",
64+
at: "Indexer#BaseIndexer#stop",
6465
message: `Requesting indexer ${this.name} to be stopped`,
6566
});
6667
this.stopRequested = true;

packages/indexer/src/main.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async function initializeRedis(
3030

3131
return new Promise<Redis>((resolve, reject) => {
3232
redis.on("ready", () => {
33-
logger.info({
33+
logger.debug({
3434
at: "Indexer#initializeRedis",
3535
message: "Redis connection established",
3636
config,
@@ -42,6 +42,7 @@ async function initializeRedis(
4242
logger.error({
4343
at: "Indexer#initializeRedis",
4444
message: "Redis connection failed",
45+
notificationPath: "across-indexer-error",
4546
error: err,
4647
});
4748
reject(err);
@@ -50,7 +51,7 @@ async function initializeRedis(
5051
}
5152

5253
export async function Main(config: parseEnv.Config, logger: winston.Logger) {
53-
const { redisConfig, postgresConfig, hubChainId } = config;
54+
const { redisConfig, postgresConfig } = config;
5455
const redis = await initializeRedis(redisConfig, logger);
5556
const redisCache = new RedisCache(redis);
5657
const postgres = await connectToDatabase(postgresConfig, logger);
@@ -138,9 +139,9 @@ export async function Main(config: parseEnv.Config, logger: winston.Logger) {
138139
}
139140
});
140141

141-
logger.info({
142-
message: "Running indexers",
142+
logger.debug({
143143
at: "Indexer#Main",
144+
message: "Running indexers",
144145
});
145146
// start all indexers in parallel, will wait for them to complete, but they all loop independently
146147
const [bundleServicesManagerResults, acrossIndexerManagerResult] =

0 commit comments

Comments
 (0)