I couldn't find a logging library that worked for my library, so I made one
a day ago
- #logging
- #ActivityPub
- #library-development
- Hong Minhee faced challenges integrating logging into Fedify, an ActivityPub server framework, due to existing logging libraries being application-centric.
- Existing logging solutions like winston or Pino required imposing configurations on users or adding boilerplate, while debug lacked structured logging.
- LogTape was created as a solution, offering hierarchical categories for fine-grained logging control without default output.
- Fedify uses LogTape's hierarchical system to organize logs by subsystems (e.g., federation, HTTP, signatures), allowing users to enable logging only where needed.
- LogTape supports implicit contexts for request tracing, automatically tagging logs with requestId for easy debugging across async operations.
- Users can configure logging levels per subsystem, from silent (default) to detailed debugging, without code changes.
- Structured logging with properties like requestId and actorId enhances log analysis and correlation.
- Lessons include designing categories early, trusting users with opt-in logging, and the value of implicit contexts for debugging distributed systems.
- LogTape is designed for libraries needing unobtrusive, user-controlled logging, not as a replacement for app-centric loggers.