hyperlane-xyz / hyperlane-monorepo

The home for Hyperlane core contracts, sdk packages, and other infrastructure
https://hyperlane.xyz
Other
307 stars 339 forks source link

Replace Pino logger with simpler alternative #3582

Open jmrossy opened 5 months ago

jmrossy commented 5 months ago

Overview

In https://github.com/hyperlane-xyz/issues/issues/918 the monorepo's logging was overhauled to replace Debug with Pino. A few alternative libs were considered but Pino was chosen. It turns out that was a bad choice. Pino is difficult to configure, lacks an easy way to format logs in production (e.g. pretty print not recommended), and has an overly complicated bundling requirements that worsens DX for SDK users. These bundling quirks also prevented us from using Pino in Docusaurus.

We should replace Pino with something simpler.

Related issues

https://github.com/hyperlane-xyz/issues/issues/918 https://github.com/hyperlane-xyz/hyperlane-monorepo/pull/3481 https://github.com/hyperlane-xyz/v3-docs/issues/80

Previous discussions

https://discord.com/channels/935678348330434570/1224477833879879840/1227672048352891031 https://discord.com/channels/935678348330434570/935678739663192184/1220454975230967808

jmrossy commented 5 months ago

Another one, from @tkporter:

$ LOG_LEVEL=DEBUG ./fork.sh mainnet3 warp inevm                               1 ↵
+ DEPLOYER=0xa7ECcdb9Be08178f896c26b7BbD8C3D4E844d9Ba
++ cast balance 0xa7ECcdb9Be08178f896c26b7BbD8C3D4E844d9Ba --rpc-url http://localhost:8545
+ BEFORE=5872881681565083840
+ yarn tsx ./scripts/deploy.ts -e mainnet3 -f inevm -m warp
TypeError: Cannot read properties of undefined (reading 'Symbol(pino.msgPrefix)')
    at LOG (/Users/trevor/abacus-monorepo/node_modules/pino/lib/tools.js:68:22)
    at logMethod (/Users/trevor/abacus-monorepo/typescript/utils/src/logging.ts:95:23)
    at hookWrappedLog (/Users/trevor/abacus-monorepo/node_modules/pino/lib/tools.js:37:10)
    at getMultiProviderForRole (/Users/trevor/abacus-monorepo/typescript/infra/scripts/agent-utils.ts:289:3)
    at Object.getMultiProvider (/Users/trevor/abacus-monorepo/typescript/infra/config/environments/mainnet3/index.ts:36:12)
    at main (/Users/trevor/abacus-monorepo/typescript/infra/scripts/deploy.ts:72:39)

It's just when I set LOG_LEVEL=DEBUG.