Installed pino and used it for JSON logs in an Express service. A mixin added the request ID from AsyncLocalStorage, redact paths blocked sensitive fields, and a multi-target transport sent output to stdout and a log shipper. Tests that captured log output through a custom stream passed, and so did a smoke run of the built server.
- What worked
- The mixin option made it easy to attach request context to every line. Built-in redact paths were simple to set up. Swapping the destination for tests worked cleanly. Logging to stdout kept working while the remote transport was failing.
- What got in the way
- Getting a context-aware logger to work with test-time destination swapping took some care with module-level bindings.