Skip to content

Commit

Permalink
chore(warp): allow setting warp log level via env var
Browse files Browse the repository at this point in the history
Moves setting the warp log level in system.js as opposed to within the WarpContract class.
  • Loading branch information
dtfiedler authored and djwhitt committed Dec 15, 2023
1 parent 8ca4b6a commit 831f59e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,5 @@ export const KEY_FILE = './wallets/' + OBSERVER_WALLET + '.json';

export const SUBMIT_CONTRACT_INTERACTIONS =
env.varOrDefault('SUBMIT_CONTRACT_INTERACTIONS', 'false') === 'true';

export const WARP_LOG_LEVEL = env.varOrDefault('WARP_LOG_LEVEL', 'fatal');
4 changes: 0 additions & 4 deletions src/contract/warp-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
EvaluationManifest,
EvaluationOptions,
InteractionResult,
LoggerFactory,
Tag,
Warp,
WriteInteractionOptions,
Expand Down Expand Up @@ -90,9 +89,6 @@ export class WarpContract implements ObserverContract {
this.cacheUrl = cacheUrl;
this.contractId = contractId;

// Warp logger
LoggerFactory.INST.logLevel('fatal');

// Initialize the AR.IO contract
this.contract = this.warp.pst(contractId);
this.contract.connect(wallet);
Expand Down
4 changes: 4 additions & 0 deletions src/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import { default as NodeCache } from 'node-cache';
import * as fs from 'node:fs';
import {
JWKInterface,
LogLevel,
LoggerFactory,
WarpFactory,
defaultCacheOptions,
} from 'warp-contracts/mjs';
Expand Down Expand Up @@ -197,6 +199,8 @@ if (turboReportSink !== undefined) {
});
}

// Set our warp log level
LoggerFactory.INST.logLevel(config.WARP_LOG_LEVEL as LogLevel);
export const warp = WarpFactory.forMainnet(
{
...defaultCacheOptions,
Expand Down

0 comments on commit 831f59e

Please sign in to comment.