A simple, highly configurable, and scalable structured logging library for Go applications.
Log is a structured logging library for Go that provides a simple, configurable, and scalable way to handle application logs. It solves the problem of rigid logging systems by allowing dynamic handler registration and level-based routing at runtime. The library integrates deeply with error handling, automatically enriching log entries with contextual information like file and line numbers.
Go developers building applications that require flexible, structured logging with runtime configurability and seamless error integration. It's particularly useful for teams needing to route different log levels to different destinations (e.g., console, syslog, DataDog).
Developers choose Log for its unique runtime configurability, clean separation of concerns between logging and handlers, and deep integration with error libraries. Unlike many logging libraries, it allows dynamic adjustment of handlers and log levels without app restarts and provides built-in helpers for context-aware logging.
:green_book: Simple, configurable and scalable Structured Logging for Go.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Allows specifying which log levels (e.g., Debug, Error) are sent to each registered handler, enabling fine-grained control over log output destinations, as highlighted in the README's level-based handler routing feature.
Handlers and log levels can be configured at runtime without restarting the application, a unique feature noted in the README that supports dynamic logging pipeline adjustments.
WithError automatically extracts file, line, and package information from errors, especially when integrated with go-playground/errors, improving debugging with contextual details.
Provides compatibility with Go 1.21+ slog, allowing redirection and output to slog.Handler, easing migration from standard libraries and enhancing interoperability.
Only a JSON handler is built-in; the README states that other handlers require custom development or community contributions, which can slow adoption for common logging destinations like syslog or cloud services.
Optimal error logging features are tightly coupled with go-playground/errors; using other libraries requires configuration via SetWithErrorFn, adding setup complexity and potential friction.
The separation between logger and handlers, while flexible for scalable pipelines, introduces architectural complexity that may be unnecessary for basic logging needs or lightweight CLI tools.