Skip to content

Commit 94ae6d2

Browse files
author
Freytes
committed
fix: Console Logging for further troubleshooting
1 parent 0b06563 commit 94ae6d2

File tree

8 files changed

+46
-46
lines changed

8 files changed

+46
-46
lines changed

packages/agent/src/swarm/investmentManager/plugins/degen-trader/services/analyticsService.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class AnalyticsService {
131131
efficiency: actualSlippageBps / slippageBps
132132
});
133133
} catch (error) {
134-
logger.error('Error tracking slippage impact', error);
134+
console.log('Error tracking slippage impact', error);
135135
}
136136
}
137137

@@ -243,7 +243,7 @@ export class AnalyticsService {
243243
amount: data.amount
244244
});
245245
} catch (error) {
246-
logger.error("Error tracking trade execution:", error);
246+
console.log("Error tracking trade execution:", error);
247247
}
248248
}
249249

@@ -275,7 +275,7 @@ export class AnalyticsService {
275275

276276
return tradeData;
277277
} catch (error) {
278-
logger.error("Error adding trade performance:", error);
278+
console.log("Error adding trade performance:", error);
279279
throw error;
280280
}
281281
}
@@ -303,7 +303,7 @@ export class AnalyticsService {
303303

304304
await this.runtime.databaseAdapter.setCache(`token_stats:${tokenAddress}`, stats);
305305
} catch (error) {
306-
logger.error("Error updating token statistics:", error);
306+
console.log("Error updating token statistics:", error);
307307
}
308308
}
309309
}

packages/agent/src/swarm/investmentManager/plugins/degen-trader/services/buyService.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class BuyService {
105105

106106
return result;
107107
} catch (error) {
108-
logger.error("Error handling buy signal:", error);
108+
console.log("Error handling buy signal:", error);
109109
return {
110110
success: false,
111111
error: error instanceof Error ? error.message : String(error),
@@ -154,7 +154,7 @@ export class BuyService {
154154

155155
return { isValid: true };
156156
} catch (error) {
157-
logger.error("Error validating token:", error);
157+
console.log("Error validating token:", error);
158158
return {
159159
isValid: false,
160160
reason: `Validation error: ${error instanceof Error ? error.message : String(error)}`,
@@ -200,7 +200,7 @@ export class BuyService {
200200
const minTradeSize = 0.05; // Minimum 0.05 SOL
201201
return Math.max(minTradeSize, finalAmount);
202202
} catch (error) {
203-
logger.error("Error calculating optimal buy amount:", error);
203+
console.log("Error calculating optimal buy amount:", error);
204204
return 0;
205205
}
206206
}
@@ -236,7 +236,7 @@ export class BuyService {
236236
// Convert to basis points
237237
return Math.floor(finalSlippage * 100);
238238
} catch (error) {
239-
logger.error("Error calculating dynamic slippage:", error);
239+
console.log("Error calculating dynamic slippage:", error);
240240
return 100; // Default to 1% slippage
241241
}
242242
}
@@ -272,7 +272,7 @@ export class BuyService {
272272
if (priceChange < -5) return "bearish";
273273
return "neutral";
274274
} catch (error) {
275-
logger.error("Error assessing market condition:", error);
275+
console.log("Error assessing market condition:", error);
276276
return "neutral";
277277
}
278278
}
@@ -299,11 +299,11 @@ export class BuyService {
299299
const recommendation = await this.dataService.getTokenRecommendation();
300300

301301
if (!recommendation) {
302-
logger.info("No token recommendation available");
302+
console.log("No token recommendation available");
303303
return;
304304
}
305305

306-
logger.info("Token recommendation:", recommendation);
306+
console.log("Token recommendation:", recommendation);
307307

308308
// Create buy signal
309309
const signal: BuySignalMessage = {
@@ -316,7 +316,7 @@ export class BuyService {
316316
// Create buy task with the recommended amount
317317
await this.createBuyTask(signal, recommendation.buy_amount);
318318
} catch (error) {
319-
logger.error("Error generating buy signal:", error);
319+
console.log("Error generating buy signal:", error);
320320
}
321321
}
322322

@@ -346,7 +346,7 @@ export class BuyService {
346346
logger.info("Final suggested amount:", { suggestedAmount });
347347
return Math.min(suggestedAmount, walletBalance);
348348
} catch (error) {
349-
logger.error("Trade analysis failed:", {
349+
console.log("Trade analysis failed:", {
350350
error: error instanceof Error ? error.message : "Unknown error",
351351
stack: error instanceof Error ? error.stack : undefined,
352352
});
@@ -410,7 +410,7 @@ export class BuyService {
410410

411411
logger.info("Buy task created");
412412
} catch (error) {
413-
logger.error("Error creating buy task:", error);
413+
console.log("Error creating buy task:", error);
414414
}
415415
}
416416
}

packages/agent/src/swarm/investmentManager/plugins/degen-trader/services/dataService.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class DataService {
4141
})
4242
);
4343
} catch (error) {
44-
logger.error("Error getting Birdeye signals:", error);
44+
console.log("Error getting Birdeye signals:", error);
4545
return [];
4646
}
4747
}
@@ -66,7 +66,7 @@ export class DataService {
6666
},
6767
}));
6868
} catch (error) {
69-
logger.error("Error getting Twitter signals:", error);
69+
console.log("Error getting Twitter signals:", error);
7070
return [];
7171
}
7272
}
@@ -91,7 +91,7 @@ export class DataService {
9191
}
9292
}));
9393
} catch (error) {
94-
logger.error("Error getting CMC signals:", error);
94+
console.log("Error getting CMC signals:", error);
9595
return [];
9696
}
9797
}
@@ -147,7 +147,7 @@ export class DataService {
147147
await this.cacheManager.set(cacheKey, result, 60000);
148148
return result;
149149
} catch (error) {
150-
logger.error("Error fetching token market data:", error);
150+
console.log("Error fetching token market data:", error);
151151
return {
152152
price: 0,
153153
marketCap: 0,
@@ -230,7 +230,7 @@ export class DataService {
230230
buy_amount: await this.calculateOptimalBuyAmount(bestToken),
231231
};
232232
} catch (error) {
233-
logger.error("Failed to get token recommendation:", error);
233+
console.log("Failed to get token recommendation:", error);
234234
return this.getDefaultRecommendation();
235235
}
236236
}
@@ -315,7 +315,7 @@ export class DataService {
315315
drawdown
316316
};
317317
} catch (error) {
318-
logger.error("Error getting portfolio status:", error);
318+
console.log("Error getting portfolio status:", error);
319319
throw error;
320320
}
321321
}
@@ -346,7 +346,7 @@ export class DataService {
346346

347347
return { isValid: true };
348348
} catch (error) {
349-
logger.error("Error validating token for trading:", error);
349+
console.log("Error validating token for trading:", error);
350350
return {
351351
isValid: false,
352352
reason: `Validation error: ${error instanceof Error ? error.message : String(error)}`,
@@ -384,7 +384,7 @@ export class DataService {
384384

385385
return Math.min(availableCapital * basePercentage, token.liquidity * 0.02);
386386
} catch (error) {
387-
logger.error("Error calculating optimal buy amount:", error);
387+
console.log("Error calculating optimal buy amount:", error);
388388
return 0;
389389
}
390390
}
@@ -407,7 +407,7 @@ export class DataService {
407407

408408
return positions;
409409
} catch (error) {
410-
logger.error("Error getting positions:", error);
410+
console.log("Error getting positions:", error);
411411
return {};
412412
}
413413
}

packages/agent/src/swarm/investmentManager/plugins/degen-trader/services/monitoringService.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class MonitoringService implements TradeExecutionService {
103103
// Add monitoring intervals here
104104
const priceMonitorInterval = setInterval(() => {
105105
this.monitorPrices().catch(error =>
106-
logger.error("Price monitoring error:", error)
106+
console.log("Price monitoring error:", error)
107107
);
108108
}, 60000); // Every minute
109109

@@ -122,7 +122,7 @@ export class MonitoringService implements TradeExecutionService {
122122
const currentBalance = await getTokenBalance(this.runtime, tokenAddress);
123123

124124
if (!currentBalance || BigInt(currentBalance.toString()) <= BigInt(0)) {
125-
logger.info("No position to monitor", { tokenAddress });
125+
console.log("No position to monitor", { tokenAddress });
126126
return;
127127
}
128128

@@ -180,7 +180,7 @@ export class MonitoringService implements TradeExecutionService {
180180
priceChangePercent
181181
};
182182
} catch (error) {
183-
logger.error("Error monitoring token:", error);
183+
console.log("Error monitoring token:", error);
184184
return { error: true, message: String(error) };
185185
}
186186
}
@@ -209,7 +209,7 @@ export class MonitoringService implements TradeExecutionService {
209209

210210
logger.info("Sell signal created", { tokenAddress, amount, reason });
211211
} catch (error) {
212-
logger.error("Error creating sell signal:", error);
212+
console.log("Error creating sell signal:", error);
213213
}
214214
}
215215

@@ -248,7 +248,7 @@ export class MonitoringService implements TradeExecutionService {
248248

249249
logger.info("Trailing stop set", trailingStopData);
250250
} catch (error) {
251-
logger.error("Error setting trailing stop:", error);
251+
console.log("Error setting trailing stop:", error);
252252
}
253253
}
254254

@@ -266,7 +266,7 @@ export class MonitoringService implements TradeExecutionService {
266266
}
267267
}
268268
} catch (error) {
269-
logger.error("Error monitoring prices:", error);
269+
console.log("Error monitoring prices:", error);
270270
}
271271
}
272272
}

packages/agent/src/swarm/investmentManager/plugins/degen-trader/services/sellService.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class SellService {
146146
}
147147
}
148148
} catch (error) {
149-
logger.error("Failed to process sell signal:", error);
149+
console.log("Failed to process sell signal:", error);
150150
return {
151151
success: false,
152152
error: error instanceof Error ? error.message : String(error),
@@ -192,7 +192,7 @@ export class SellService {
192192
// Convert to basis points
193193
return Math.floor(finalSlippage * 100);
194194
} catch (error) {
195-
logger.error("Error calculating dynamic slippage:", error);
195+
console.log("Error calculating dynamic slippage:", error);
196196
return 100; // Default to 1% slippage
197197
}
198198
}
@@ -214,7 +214,7 @@ export class SellService {
214214
const data = await response.json();
215215
return data.outAmount || "0";
216216
} catch (error) {
217-
logger.error("Error getting expected amount:", error);
217+
console.log("Error getting expected amount:", error);
218218
return "0";
219219
}
220220
}
@@ -250,7 +250,7 @@ export class SellService {
250250
if (priceChange < -5) return "bearish";
251251
return "neutral";
252252
} catch (error) {
253-
logger.error("Error assessing market condition:", error);
253+
console.log("Error assessing market condition:", error);
254254
return "neutral";
255255
}
256256
}

packages/agent/src/swarm/investmentManager/plugins/degen-trader/services/taskService.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export class TaskService extends TradeExecutionService {
125125
});
126126
}
127127
} catch (error) {
128-
logger.warn("Failed to fetch expected receive amount for sell", error);
128+
console.log("Failed to fetch expected receive amount for sell", error);
129129
}
130130

131131
// Calculate slippage using parent class method
@@ -147,7 +147,7 @@ export class TaskService extends TradeExecutionService {
147147
logger.info("Sell task created", { taskId });
148148
return { success: true, taskId };
149149
} catch (error) {
150-
logger.error("Error creating sell task", error);
150+
console.log("Error creating sell task", error);
151151
return { success: false, error: error instanceof Error ? error.message : String(error) };
152152
}
153153
}
@@ -201,7 +201,7 @@ export class TaskService extends TradeExecutionService {
201201

202202
return result;
203203
} catch (error) {
204-
logger.error("Error executing sell task:", error);
204+
console.log("Error executing sell task:", error);
205205
return { success: false, error: error instanceof Error ? error.message : String(error) };
206206
}
207207
}
@@ -213,7 +213,7 @@ export class TaskService extends TradeExecutionService {
213213
logger.info("Position monitoring completed");
214214
return { success: true };
215215
} catch (error) {
216-
logger.error("Error monitoring positions:", error);
216+
console.log("Error monitoring positions:", error);
217217
return { success: false, error: error instanceof Error ? error.message : String(error) };
218218
}
219219
}
@@ -224,7 +224,7 @@ export class TaskService extends TradeExecutionService {
224224
logger.info("Slippage parameters optimized");
225225
return { success: true };
226226
} catch (error) {
227-
logger.error("Error optimizing slippage parameters:", error);
227+
console.log("Error optimizing slippage parameters:", error);
228228
return { success: false, error: error instanceof Error ? error.message : String(error) };
229229
}
230230
}
@@ -235,7 +235,7 @@ export class TaskService extends TradeExecutionService {
235235
logger.info("Buy parameters optimized");
236236
return { success: true };
237237
} catch (error) {
238-
logger.error("Error optimizing buy parameters:", error);
238+
console.log("Error optimizing buy parameters:", error);
239239
return { success: false, error: error instanceof Error ? error.message : String(error) };
240240
}
241241
}
@@ -246,7 +246,7 @@ export class TaskService extends TradeExecutionService {
246246
logger.info("Performance analysis completed");
247247
return { success: true };
248248
} catch (error) {
249-
logger.error("Error analyzing performance:", error);
249+
console.log("Error analyzing performance:", error);
250250
return { success: false, error: error instanceof Error ? error.message : String(error) };
251251
}
252252
}

packages/agent/src/swarm/investmentManager/plugins/degen-trader/services/tradeExecutionService.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class TradeExecutionService {
5656

5757
return result;
5858
} catch (error) {
59-
logger.error("Buy trade execution failed:", error);
59+
console.log("Buy trade execution failed:", error);
6060
return {
6161
success: false,
6262
error: error instanceof Error ? error.message : String(error)
@@ -100,7 +100,7 @@ export class TradeExecutionService {
100100

101101
return result;
102102
} catch (error) {
103-
logger.error("Sell trade execution failed:", error);
103+
console.log("Sell trade execution failed:", error);
104104
return {
105105
success: false,
106106
error: error instanceof Error ? error.message : String(error)
@@ -121,7 +121,7 @@ export class TradeExecutionService {
121121

122122
return expectedAmount.toString();
123123
} catch (error) {
124-
logger.error("Error calculating expected amount:", error);
124+
console.log("Error calculating expected amount:", error);
125125
return "0";
126126
}
127127
}

0 commit comments

Comments
 (0)