Skip to content

Commit

Permalink
feat(plugin-ledger-connector-besu): add log level to options
Browse files Browse the repository at this point in the history
This enables calling code to instantiate the besu connector
with a custom log level according to their needs.

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
  • Loading branch information
petermetz committed Dec 1, 2020
1 parent 0424924 commit 29402d0
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ import {
import Web3 from "web3";
import EEAClient, { IWeb3InstanceExtended } from "web3-eea";

import {
Logger,
LoggerProvider,
LogLevelDesc,
} from "@hyperledger/cactus-common";

export interface IPluginLedgerConnectorBesuOptions {
rpcApiHttpHost: string;
logLevel?: LogLevelDesc;
}

export interface IBesuDeployContractIn {
Expand Down Expand Up @@ -65,6 +72,7 @@ export class PluginLedgerConnectorBesu
IBesuTransactionIn,
IBesuTransactionOut
> {
private readonly log: Logger;
private readonly web3: Web3;
private readonly web3Eea: IWeb3InstanceExtended;

Expand All @@ -77,6 +85,10 @@ export class PluginLedgerConnectorBesu
);
this.web3 = new Web3(web3Provider);
this.web3Eea = EEAClient(this.web3, 2018);

const level = options.logLevel || "INFO";
const label = "plugin-ledger-connector-besu";
this.log = LoggerProvider.getOrCreate({ level, label });
}

public getPackageName(): string {
Expand Down

0 comments on commit 29402d0

Please sign in to comment.