From 3313a2d3d5f9b6bad0df027c3dd1a82df7f00858 Mon Sep 17 00:00:00 2001 From: 0xBossanova <0xBossanova@proton.me> Date: Wed, 15 Feb 2023 12:21:20 +0100 Subject: [PATCH] bug: logging loop error on startup resulted in overflow (#47) --- src/core/logging/index.ts | 2 +- ...s~ed059be5c2dae5fdda81af669d632c83bc3abb63 | 28 ------------------- src/index.ts | 12 ++++---- 3 files changed, 6 insertions(+), 36 deletions(-) delete mode 100644 src/core/logging/slacklogger.ts~ed059be5c2dae5fdda81af669d632c83bc3abb63 diff --git a/src/core/logging/index.ts b/src/core/logging/index.ts index 6adbf76..3e60fac 100644 --- a/src/core/logging/index.ts +++ b/src/core/logging/index.ts @@ -1,3 +1,3 @@ +export { DiscordLogger } from "./discordLogger"; export { Logger } from "./logger"; export { SlackLogger } from "./slackLogger"; -export { DiscordLogger } from "./discordLogger"; \ No newline at end of file diff --git a/src/core/logging/slacklogger.ts~ed059be5c2dae5fdda81af669d632c83bc3abb63 b/src/core/logging/slacklogger.ts~ed059be5c2dae5fdda81af669d632c83bc3abb63 deleted file mode 100644 index 618048a..0000000 --- a/src/core/logging/slacklogger.ts~ed059be5c2dae5fdda81af669d632c83bc3abb63 +++ /dev/null @@ -1,28 +0,0 @@ -import { WebClient } from "@slack/web-api"; - -/** - * Creates and returns a Slack WebClient using OAuth2 tokens. - * @param token The token for OAuth2 authentication. - */ -export function getSlackClient(token: string) { - return new WebClient(token); -} -/** - * Sends the `message` to the Slack channel `channel` if `client` is not undefined. If - * `client` is undefined, it will print `message` to stdout. - * @param message The message to send to slack. - * @param client The slack WebClient or undefined. - * @param channel The slack Channel to send the message to or undefined. - */ -export async function sendSlackMessage(message: string, client: WebClient | undefined, channel: string | undefined) { - if (client && channel) { - // send log to slack channel - await client.chat.postMessage({ - text: message, - channel: channel, - }); - } else { - // log to stdout - console.log(message); - } -} diff --git a/src/index.ts b/src/index.ts index e86d592..f57917e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -69,20 +69,18 @@ Connections Details:\n const paths = getPaths(graph, botConfig.offerAssetInfo, botConfig.maxPathPools) ?? []; const filteredPools = removedUnusedPools(allPools, paths); - - setupMessage += `**Total Paths:** \t${paths.length}\n`; - for (let pathlength = 2; 2 <= botConfig.maxPathPools; pathlength++) { + setupMessage += `**\nDerived Paths for Arbitrage: +Total Paths:** \t${paths.length}\n`; + for (let pathlength = 2; pathlength <= botConfig.maxPathPools; pathlength++) { const nrOfPaths = paths.filter((path) => path.pools.length === pathlength).length; - setupMessage += ` - Derived Paths for Arbitrage:\n - **${pathlength} HOP Paths:** \t${nrOfPaths}`; + setupMessage += `**${pathlength} HOP Paths:** \t${nrOfPaths}\n`; } setupMessage += `(Removed ${allPools.length - filteredPools.length} unused pools)\n`; setupMessage += "---".repeat(30); startupMessage += setupMessage; - + console.log(startupMessage); await logger.sendMessage(startupMessage, LogType.Console); let loop;