A dead simple, super fast, zero-allocation JSON logger for Go.
Onelog is a high-performance JSON logger for Go, designed for maximum speed and minimal memory allocation. It provides fine-grained control over log levels using bitwise operations and supports modular features like custom hooks and context grouping.
Go developers building performance-critical applications where logging overhead must be minimized, such as high-throughput APIs, microservices, or real-time systems.
Developers choose Onelog for its extreme performance, achieving zero allocations for disabled logging and faster operation times than alternatives like Zap and zerolog, while offering a minimalistic API with essential structured logging flexibility.
Dead simple, super fast, zero allocation logger for Golang
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks show 0.74 ns/op and 0 allocs/op for disabled logging, making it the fastest option for high-performance applications where logging overhead must be minimized.
Uses bitwise operations to set log levels, allowing efficient runtime enabling/disabling of specific levels without performance penalties, as demonstrated in the level configuration examples.
Supports custom hooks that run for every log entry, enabling dynamic field addition like timestamps, which enhances structured logging capabilities without modifying core code.
Provides context grouping to nest log fields under specific keys, improving log organization for complex microservices, as shown in the WithContext method examples.
Changing level texts, keys, or other global settings is not thread-safe and should be done only once at runtime, posing potential race conditions in concurrent applications.
Lacks advanced functionalities like asynchronous logging, log rotation, or native integrations with monitoring systems, requiring additional dependencies or custom code for production use.
The bitwise level control and callback-based field addition (e.g., InfoWithFields) can be unnecessarily complex for simple logging needs, adding a learning curve compared to more straightforward loggers.