Skip to content

Commit

Permalink
chore(exchanges): remove logger (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
bludnic committed May 11, 2024
1 parent 288b6ca commit 80eec56
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 13 deletions.
1 change: 0 additions & 1 deletion packages/exchanges/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
},
"dependencies": {
"@opentrader/db": "workspace:*",
"@opentrader/logger": "workspace:*",
"@opentrader/tools": "workspace:*",
"ccxt": "4.1.48"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { logger } from "@opentrader/logger/dist";
import type { Dictionary, Exchange, Market } from "ccxt";
import type { ExchangeCode } from "@opentrader/types";
import type { ICacheProvider } from "../../../types/cache/cache-provider.interface";
Expand All @@ -14,7 +13,7 @@ export class MemoryCacheProvider implements ICacheProvider {
const cachedMarkets = this.store[exchangeCode];

if (cachedMarkets) {
logger.info(
console.info(
`MemoryCacheProvider: Fetched ${Object.keys(cachedMarkets).length} markets on ${exchangeCode} from cache`,
);

Expand All @@ -26,7 +25,7 @@ export class MemoryCacheProvider implements ICacheProvider {
const endTime = Date.now();
const duration = (endTime - startTime) / 1000;

logger.info(
console.info(
`MemoryCacheProvider: Fetched ${Object.keys(markets).length} markets on ${exchangeCode} exchange in ${duration}s`,
);

Expand Down
5 changes: 2 additions & 3 deletions packages/exchanges/src/exchange.provider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { ExchangeAccountWithCredentials } from "@opentrader/db";
import type { ExchangeCode } from "@opentrader/types";
import { logger } from "@opentrader/logger";
import { exchanges } from "./exchanges";
import type { IExchange } from "./types";

Expand Down Expand Up @@ -43,7 +42,7 @@ export class ExchangeProvider {

this.privateExchanges[id] = newExchange; // cache it

logger.debug(
console.debug(
`ExchangeProvider: Created a new private instance of ${exchangeAccount.exchangeCode}: ${exchangeAccount.name} (ID: ${exchangeAccount.id})`,
);

Expand All @@ -65,7 +64,7 @@ export class ExchangeProvider {

this.publicExchanges[exchangeCode] = newExchange; // cache it

logger.debug(
console.debug(
`ExchangeProvider: Created a new public instance of ${exchangeCode}`,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { Dictionary, Exchange, Market } from "ccxt";
import type { ExchangeCode } from "@opentrader/types";
import type { Prisma } from "@opentrader/db";
import { xprisma } from "@opentrader/db";
import { logger } from "@opentrader/logger";
import type { ICacheProvider } from "../../../types/cache/cache-provider.interface";

export class PrismaCacheProvider implements ICacheProvider {
Expand All @@ -19,7 +18,7 @@ export class PrismaCacheProvider implements ICacheProvider {
const endTime = Date.now();
const duration = (endTime - startTime) / 1000;

logger.info(
console.info(
`PrismaCacheProvider: Fetched ${Object.keys(cachedMarkets).length} markets on ${exchangeCode} from cache in ${duration}s`,
);

Expand All @@ -32,7 +31,7 @@ export class PrismaCacheProvider implements ICacheProvider {
const endTime = Date.now();
const duration = (endTime - startTime) / 1000;

logger.info(
console.info(
`PrismaCacheProvider: Fetched ${Object.keys(markets).length} markets on ${exchangeCode} exchange in ${duration}s`,
);

Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 80eec56

Please sign in to comment.