Add Pino logging to governance API#776
Merged
Merged
Conversation
frankmeds
approved these changes
May 26, 2026
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
Introduces structured JSON logging across the governance-api service using
pino and pino-http, replacing all unstructured
console.log/console.infocalls. This makes incident investigation possible by capturing every
significant runtime event with enough context to diagnose failures without
reproduction.
Changes
lib/logger.ts— new shared pino logger singleton used throughoutthe service.
lib/app.ts— installspino-httpmiddleware; responses with HTTPstatus ≥ 400 are logged at
errorlevel, all others atinfo.lib/server.ts— startup is wrapped in try/catch; DB sync andsuccessful bind emit
logger.info; any startup failure emitslogger.errorand exits with code 1.lib/routes/message.ts— every validation-failure 400 path nowemits
log.errorwith anerror_codefield before responding; eachsuccessful processing step (signature verified, liquidity fetched, DB
record created) emits
log.info; finalconsole.logreplaced.lib/routes/spaces.ts— both async route handlers wrapped intry/catch; DB errors emit
logger.errorand return a 500 instead of anunhandled promise rejection.
lib/utils/pin-ipfs.ts— IPFS pin success logged atinfoforboth Pinata and local-node paths; pin failure logged at
errorbeforethrowing.
lib/zilliqa/custom-fetch.ts— Zilliqa RPC call wrapped intry/catch with
errorlog on failure; successful liquidity fetch loggedat
info; XCAD and ZilSwap parse errors uselogger.errorinstead ofconsole.log.package.json— addspinoandpino-httpas runtime deps;pino-prettyand@types/pino-httpas dev deps; TypeScript bumped to3.9.x.
Test plan
emits a structured
"Server started"log line.POST /api/messageand confirm that adequate message appear in logs.GET /api/:space/proposalsand confirm the request is logged bypino-http.