Allow for less verbose logging from env

This commit is contained in:
Wietse Wind
2023-10-02 01:28:22 +02:00
parent 128a413022
commit ad4b35c895
3 changed files with 20 additions and 12 deletions

View File

@@ -8,4 +8,8 @@ NETWORKID="1"
UNLURL="https://vl.altnet.rippletest.net"
UNLKEY="ED264807102805220DA0F312E71FC2C69E1552C9C5790F6C25E3729DEB573D5860"
FIELDSREQUIRED="Fee,Account,OperationLimit"
FIELDSREQUIRED="Fee,Account,OperationLimit"
# Less logging:
# NOVALIDATIONLOG="true"
# NOELIGIBLEFULLTXLOG="true"

View File

@@ -28,13 +28,15 @@ const onTransaction = async ({
lastSeenTransactions.length = 3000
const validTx = hasRequiredFields(tx)
console.log('TX', tx.hash, validTx)
if (!process.env?.NOELIGIBLEFULLTXLOG) {
console.log('TX', tx.hash, validTx)
}
if (validTx && transaction?.ledger_index) {
const relativeStorDir = 'store/' + networkId + '/' + ledgerIndexToFolders(transaction.ledger_index)
const storeDir = new URL('../' + relativeStorDir, import.meta.url).pathname
console.log('xPOP eligible', relativeStorDir, transaction)
console.log('xPOP eligible', relativeStorDir, process.env?.NOELIGIBLEFULLTXLOG ? tx.hash : tx)
if (await dirExists(storeDir)) {
writeFile(storeDir + '/tx_' + tx.hash + '.json', Buffer.from(JSON.stringify(transaction), 'utf8'), err => {

View File

@@ -48,15 +48,17 @@ const onValidation = async ({
/**
* Debug output
*/
console.log(
networkId,
validation.ledger_index,
relativeStorDir,
validation.validation_public_key,
// validation.validated_hash, // parent hash
validation.ledger_hash, // ledger_hash
connectionUrl,
)
if (!process.env?.NOVALIDATIONLOG) {
console.log(
networkId,
validation.ledger_index,
relativeStorDir,
validation.validation_public_key,
// validation.validated_hash, // parent hash
validation.ledger_hash, // ledger_hash
connectionUrl,
)
}
/**
* Create validation file