Show HN: LogLayer – Unified logger that routes logs to various logging libraries
loglayer.dev
I built LogLayer to address these pain points by introducing a fluid, expressive API. With methods like "withMetadata" and "withError", LogLayer separates object injection from the log message itself, making your logging code both cleaner and more maintainable.
Logs are processed through a LogLayer Transport, which acts as an adapter for your preferred logging library. This design offers several key advantages:
- Multi-Transport Support: Send logs to multiple destinations (e.g., DataDog and New Relic) simultaneously. I've personally used this feature to ship logs directly to DataDog without relying on their APM package or sidecars.
- Easy Logger Swapping: If you’ve ever used Pino with Next.js, you might have encountered issues where it doesn’t work out of the box after a production build without webpack hacks. With LogLayer, you can swap in a better-suited library without touching your logging code.
I spent a good few months on and off and used my winter break to launch version 5 of LogLayer, and also created the documentation using Vitepress.
LogLayer has been battle-tested in production at Airtop (https://airtop.ai), where it’s been an integral part of our systems for years (we were running as Switchboard for almost four years and pivoted late last year).
(Disclaimer: I work at Airtop, but LogLayer is not sponsored / affiliated with them.)