Skip to content

Commit 29402d0

Browse files
committed
feat(plugin-ledger-connector-besu): add log level to options
This enables calling code to instantiate the besu connector with a custom log level according to their needs. Signed-off-by: Peter Somogyvari <[email protected]>
1 parent 0424924 commit 29402d0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/cactus-plugin-ledger-connector-besu/src/main/typescript/plugin-ledger-connector-besu.ts

+12
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@ import {
66
import Web3 from "web3";
77
import EEAClient, { IWeb3InstanceExtended } from "web3-eea";
88

9+
import {
10+
Logger,
11+
LoggerProvider,
12+
LogLevelDesc,
13+
} from "@hyperledger/cactus-common";
14+
915
export interface IPluginLedgerConnectorBesuOptions {
1016
rpcApiHttpHost: string;
17+
logLevel?: LogLevelDesc;
1118
}
1219

1320
export interface IBesuDeployContractIn {
@@ -65,6 +72,7 @@ export class PluginLedgerConnectorBesu
6572
IBesuTransactionIn,
6673
IBesuTransactionOut
6774
> {
75+
private readonly log: Logger;
6876
private readonly web3: Web3;
6977
private readonly web3Eea: IWeb3InstanceExtended;
7078

@@ -77,6 +85,10 @@ export class PluginLedgerConnectorBesu
7785
);
7886
this.web3 = new Web3(web3Provider);
7987
this.web3Eea = EEAClient(this.web3, 2018);
88+
89+
const level = options.logLevel || "INFO";
90+
const label = "plugin-ledger-connector-besu";
91+
this.log = LoggerProvider.getOrCreate({ level, label });
8092
}
8193

8294
public getPackageName(): string {

0 commit comments

Comments
 (0)