A non-blocking logger for Go HTTP applications with net/context integration and per-request log context.
xlog is a structured logger designed for Go HTTP applications that use the net/context package. It provides contextual logging per HTTP request without blocking application execution, ensuring performance even when log outputs are slow.
Go developers building HTTP applications who need structured, request-scoped logging without performance penalties from slow log outputs.
Developers choose xlog for its non-blocking design that discards messages rather than stalling the application, combined with per-request context logging and extensive customization through composable output handlers.
xlog is a logger for net/context aware HTTP applications
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses a buffered channel to prevent application stalls, discarding messages if the buffer is full, ensuring high throughput even with slow log outputs, as emphasized in the README's design philosophy.
Automatically attaches log context to HTTP requests, gathering metadata like IP, User-Agent, and Referer without manual setup, per the README's examples of handler usage.
Supports composable output handlers for routing logs to various destinations (console, syslog, Logstash) and integrates with third-party extensions like NSQ and Sentry, detailed in the README's output modules section.
Provides JSON, logfmt, and custom serialization with colorized terminal output, enhancing both human readability and machine parsing, as shown in the usage code snippet.
The README explicitly warns that zerolog is the successor, indicating reduced maintenance, potential bugs, and lack of new features for xlog, making it a legacy choice.
Its non-blocking design prioritizes performance over reliability by discarding messages when the buffer is full, which can lead to missing critical log data in high-traffic scenarios, a trade-off admitted in the README.
Setting up advanced output routing with MultiOutput and FilterOutput requires a deep understanding of the composable system, making it verbose and error-prone, as seen in the configuration examples.