Skip to content

Commit

Permalink
Merge branch 'update-logger' into 'dev'
Browse files Browse the repository at this point in the history
Update logger

See merge request ergo/rosen-bridge/watcher!311
  • Loading branch information
vorujack committed Oct 20, 2024
2 parents ac094e4 + 17f5d5d commit 05dbb91
Show file tree
Hide file tree
Showing 39 changed files with 164 additions and 113 deletions.
5 changes: 5 additions & 0 deletions .changeset/real-pandas-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rosen-bridge/watcher': patch
---

Update logger structure
84 changes: 74 additions & 10 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
},
"dependencies": {
"@emurgo/cip14-js": "^3.0.1",
"@rosen-bridge/abstract-logger": "^2.0.1",
"@rosen-bridge/address-extractor": "^5.0.7",
"@rosen-bridge/asset-check": "^1.0.4",
"@rosen-bridge/bitcoin-esplora-scanner": "^0.1.14",
Expand All @@ -85,7 +86,7 @@
"@rosen-bridge/evm-rpc-scanner": "^1.0.4",
"@rosen-bridge/health-check": "6.0.3",
"@rosen-bridge/log-level-check": "^1.0.3",
"@rosen-bridge/minimum-fee": "^2.1.0",
"@rosen-bridge/minimum-fee": "^2.2.2",
"@rosen-bridge/node-sync-check": "^1.0.3",
"@rosen-bridge/observation-extractor": "^5.0.7",
"@rosen-bridge/permit-check": "^1.0.3",
Expand All @@ -94,7 +95,7 @@
"@rosen-bridge/tokens": "^1.2.1",
"@rosen-bridge/watcher-data-extractor": "^8.0.2",
"@rosen-bridge/wid-check": "^1.0.3",
"@rosen-bridge/winston-logger": "0.2.1",
"@rosen-bridge/winston-logger": "1.0.2",
"@rosen-clients/cardano-koios": "^2.0.3",
"axios": "^0.26.1",
"bip39": "^3.1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/api/Transaction.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Buffer } from 'buffer';
import { ErgoBoxCandidate } from 'ergo-lib-wasm-nodejs';
import * as wasm from 'ergo-lib-wasm-nodejs';
import WinstonLogger from '@rosen-bridge/winston-logger';
import { DefaultLoggerFactory } from '@rosen-bridge/abstract-logger';

import { ErgoNetwork } from '../ergo/network/ergoNetwork';
import { Boxes } from '../ergo/boxes';
Expand All @@ -23,7 +23,7 @@ import {
import { HealthStatusLevel } from '@rosen-bridge/health-check';
import { HealthCheckSingleton } from '../utils/healthCheck';

const logger = WinstonLogger.getInstance().getLogger(import.meta.url);
const logger = DefaultLoggerFactory.getInstance().getLogger(import.meta.url);

export type ApiResponse = {
response: string;
Expand Down
4 changes: 2 additions & 2 deletions src/api/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { generateSK } from '../utils/utils';
import { ErgoUtils } from '../ergo/utils';
import { JsonBI } from '../ergo/network/parser';
import { ERGO_CHAIN_NAME, ERGO_NATIVE_ASSET } from '../config/constants';
import WinstonLogger from '@rosen-bridge/winston-logger';
import { DefaultLoggerFactory } from '@rosen-bridge/abstract-logger';

const logger = WinstonLogger.getInstance().getLogger(import.meta.url);
const logger = DefaultLoggerFactory.getInstance().getLogger(import.meta.url);

const addressRouter = express.Router();

Expand Down
4 changes: 2 additions & 2 deletions src/api/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { DEFAULT_API_LIMIT, MAX_API_LIMIT } from '../config/constants';
import { stringifyQueryParam } from '../utils/utils';
import { ErgoUtils } from '../ergo/utils';
import { JsonBI } from '../ergo/network/parser';
import WinstonLogger from '@rosen-bridge/winston-logger';
import { DefaultLoggerFactory } from '@rosen-bridge/abstract-logger';

const logger = WinstonLogger.getInstance().getLogger(import.meta.url);
const logger = DefaultLoggerFactory.getInstance().getLogger(import.meta.url);
const eventsRouter = express.Router();

/**
Expand Down
4 changes: 2 additions & 2 deletions src/api/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { JsonBI } from '../ergo/network/parser';
import { ErgoUtils } from '../ergo/utils';
import { HealthCheckSingleton } from '../../src/utils/healthCheck';
import { Transaction } from './Transaction';
import WinstonLogger from '@rosen-bridge/winston-logger';
import { DefaultLoggerFactory } from '@rosen-bridge/abstract-logger';
import packageJson from '../../package.json' assert { type: 'json' };
import { ERGO_CHAIN_NAME, ERGO_NATIVE_ASSET } from '../config/constants';

const logger = WinstonLogger.getInstance().getLogger(import.meta.url);
const logger = DefaultLoggerFactory.getInstance().getLogger(import.meta.url);

interface GeneralInfo {
versions: {
Expand Down
4 changes: 2 additions & 2 deletions src/api/healthCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import express from 'express';
import { Request, Response } from 'express';
import { stringifyQueryParam } from '../utils/utils';
import { HealthCheckSingleton } from '../utils/healthCheck';
import WinstonLogger from '@rosen-bridge/winston-logger';
import { DefaultLoggerFactory } from '@rosen-bridge/abstract-logger';

const logger = WinstonLogger.getInstance().getLogger(import.meta.url);
const logger = DefaultLoggerFactory.getInstance().getLogger(import.meta.url);
const healthRouter = express.Router();

/**
Expand Down
4 changes: 2 additions & 2 deletions src/api/observation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { stringifyQueryParam } from '../utils/utils';
import { ErgoUtils } from '../ergo/utils';
import { JsonBI } from '../ergo/network/parser';
import { TxStatus } from '../database/entities/observationStatusEntity';
import WinstonLogger from '@rosen-bridge/winston-logger';
import { DefaultLoggerFactory } from '@rosen-bridge/abstract-logger';

const logger = WinstonLogger.getInstance().getLogger(import.meta.url);
const logger = DefaultLoggerFactory.getInstance().getLogger(import.meta.url);
const observationRouter = express.Router();

/**
Expand Down
4 changes: 2 additions & 2 deletions src/api/permit.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Request, Response, Router } from 'express';
import { ApiResponse, Transaction } from './Transaction';
import { body, validationResult } from 'express-validator';
import WinstonLogger from '@rosen-bridge/winston-logger';
import { DefaultLoggerFactory } from '@rosen-bridge/abstract-logger';
import { authenticateKey } from './authentication';
import { getConfig } from '../config/config';
import { ERGO_CHAIN_NAME } from '../config/constants';

const logger = WinstonLogger.getInstance().getLogger(import.meta.url);
const logger = DefaultLoggerFactory.getInstance().getLogger(import.meta.url);

const permitRouter = Router();

Expand Down
4 changes: 2 additions & 2 deletions src/api/revenue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { DEFAULT_API_LIMIT, MAX_API_LIMIT } from '../config/constants';
import { ErgoUtils } from '../ergo/utils';
import { JsonBI } from '../ergo/network/parser';
import { Transaction } from './Transaction';
import WinstonLogger from '@rosen-bridge/winston-logger';
import { DefaultLoggerFactory } from '@rosen-bridge/abstract-logger';

const logger = WinstonLogger.getInstance().getLogger(import.meta.url);
const logger = DefaultLoggerFactory.getInstance().getLogger(import.meta.url);
const revenueRouter = express.Router();

/**
Expand Down
4 changes: 2 additions & 2 deletions src/api/withdraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { AddressBalance, TokenData } from '../ergo/interfaces';
import { Transaction } from './Transaction';
import { ERGO_NATIVE_ASSET } from '../config/constants';
import { BoxValue } from 'ergo-lib-wasm-nodejs';
import WinstonLogger from '@rosen-bridge/winston-logger';
import { DefaultLoggerFactory } from '@rosen-bridge/abstract-logger';
import { authenticateKey } from './authentication';

const logger = WinstonLogger.getInstance().getLogger(import.meta.url);
const logger = DefaultLoggerFactory.getInstance().getLogger(import.meta.url);

const withdrawRouter = express.Router();

Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import 'reflect-metadata';
import WinstonLogger from '@rosen-bridge/winston-logger';
import { getConfig } from './config/config';
import packageJson from '../package.json' assert { type: 'json' };
import { DefaultLoggerFactory } from '@rosen-bridge/abstract-logger';

WinstonLogger.init(getConfig().logger.transports);

const logger = WinstonLogger.getInstance().getLogger(import.meta.url);
DefaultLoggerFactory.init(new WinstonLogger(getConfig().logger.transports));
const logger = DefaultLoggerFactory.getInstance().getLogger(import.meta.url);

logger.info(`Watcher version: ${packageJson.version}`);
logger.info(`Watcher contract version: ${getConfig().rosen.contractVersion}`);
Expand Down
4 changes: 2 additions & 2 deletions src/database/models/watcherModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ import { RevenueEntity } from '../entities/revenueEntity';
import { RevenueView } from '../entities/revenueView';
import { TokenEntity } from '../entities/tokenEntity';
import { TxEntity, TxType } from '../entities/txEntity';
import WinstonLogger from '@rosen-bridge/winston-logger';
import { DefaultLoggerFactory } from '@rosen-bridge/abstract-logger';
import { getConfig } from '../../config/config';

const logger = WinstonLogger.getInstance().getLogger(import.meta.url);
const logger = DefaultLoggerFactory.getInstance().getLogger(import.meta.url);

class WatcherDataBase {
private readonly dataSource: DataSource;
Expand Down
4 changes: 2 additions & 2 deletions src/ergo/boxes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import { NotEnoughFund, NoWID } from '../errors/errors';
import { getConfig } from '../config/config';
import { AddressBalance } from './interfaces';
import { JsonBI } from './network/parser';
import WinstonLogger from '@rosen-bridge/winston-logger';
import { DefaultLoggerFactory } from '@rosen-bridge/abstract-logger';
import { blake2b } from 'blakejs';
import { ERGO_CHAIN_NAME } from '../config/constants';

const logger = WinstonLogger.getInstance().getLogger(import.meta.url);
const logger = DefaultLoggerFactory.getInstance().getLogger(import.meta.url);

export class Boxes {
dataBase: WatcherDataBase;
Expand Down
Loading

0 comments on commit 05dbb91

Please sign in to comment.