feat(scripts): migrate keeper/indexer/health-check/alert-failed-charges to shared logger - #1003
Merged
orunganiekan merged 4 commits intoAug 31, 2026
Conversation
…es to shared logger
- keeper.ts: replace local log(dryRun, msg) with logger.child({script,
contract, rpc}); structured context on every line; LOG_LEVEL now
respected; console.error kept only in validateEnv() fatal bootstrap
- indexer.ts: replace local log(level, msg) + hand-rolled LOG_LEVEL
with logger.child({script, contract, rpc}); all call sites use
logger.debug/info/error with structured context fields
- health-check.ts: remove stale duplicate imports (Account, Server,
Contract); remove timestamp() helper and local log() wrapper; use
logger.child({script, contract, rpc}) with logger.info/error
- alert-failed-charges.ts: fix stale console.error syntax error in
sendWebhook; correct logger.error misuse for info-level events;
logger.child({script, db}) in main()
- scripts/README.md: update Logs and metrics section with JSON log line
example; add LOG_LEVEL/LOG_FORMAT rows to keeper variables table
Closes SiLioLabs#878
…ts, add LOG_FORMAT row Update the 'Environment variable reference' table in scripts/README.md: - LOG_LEVEL 'Used by' column now lists keeper, indexer, health-check, and alert-failed-charges (was keeper, indexer only) - Add missing LOG_FORMAT row with the same four scripts in 'Used by' Closes SiLioLabs#878
|
@divinemike019 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the four core operational scripts to the shared
logger.tsstructured logger, replacing all ad-hocconsole.log/console.infopatterns with leveled JSON-capable logging that respectsLOG_LEVEL.Changes
scripts/keeper.tslog(dryRun, msg)helper withrootLogger.child({ script: 'keeper', contract: CONTRACT_ID, rpc: RPC_URL })logger.debug/info/warn/errorwith structured context fieldsLOG_LEVELenv var now respected via the shared loggerconsole.errorkept only invalidateEnv()fatal bootstrap (pre-logger-init)console.loginshowHelp()is intentional CLI help-text output to stdout (not a log line)scripts/indexer.tslog(level, msg)+ hand-rolledLOG_LEVELcheck withrootLogger.child({ script: 'indexer', contract: CONTRACT_ID, rpc: RPC_URL })logger.debug/info/errorwith structured context fieldsconsole.errorkept only in pre-initCONTRACT_IDguard andmain().catchfatal pathscripts/health-check.tstimestamp()/log()helpersrootLogger.child({ script: 'health-check', contract: CONTRACT_ID, rpc: RPC_URL })logger.info/errorwith structured contextscripts/alert-failed-charges.tsconsole.errorsyntax error insendWebhook; correct misuse oflogger.errorfor info-level eventslogger.child({ script: 'alert-failed-charges', db: dbPath })inmain()(no contract/rpc — not applicable for a DB-only script)console.errorkept only in pre-initWEBHOOK_URLguardscripts/README.mdLOG_LEVELandLOG_FORMATrows to the keeper environment variable table and the full environment matrixAcceptance Criteria
LOG_LEVELis respected viaparseLevel(process.env.LOG_LEVEL)increateLoggerscript,contract,rpcwhere applicable) appear on every log lineExample log line (keeper,
LOG_FORMAT=json){"timestamp":"2026-08-30T17:45:00.123Z","level":"INFO","message":"Keeper started in LIVE mode","script":"keeper","contract":"CAAAA...","rpc":"https://soroban-testnet.stellar.org","mode":"live"}Closes #878