A Go SQL database driver logger that adds structured logging without modifying existing *sql.DB usage.
SQLDB-Logger is a logging middleware for Go's standard database/sql package. It enables detailed, structured logging of SQL queries, executions, and errors while maintaining full compatibility with existing *sql.DB code, allowing developers to gain visibility into database operations without refactoring their application's database layer.
Go developers working with the standard database/sql package who need to monitor and debug database interactions in existing or new applications without changing their database layer code.
Developers choose SQLDB-Logger because it offers non-invasive integration by wrapping existing SQL drivers, provides structured logging with configurable fields and unique operation IDs for traceability, and is logger-agnostic with built-in adapters for popular backends like Zerolog, Zap, Logrus, and Onelog.
A logger for Go SQL database driver without modifying existing *sql.DB stdlib usage.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Wraps existing SQL drivers without changing *sql.DB usage, as shown in examples where db remains *sql.DB after calling sqldblogger.OpenDriver.
Outputs JSON logs with configurable fields like query, arguments, and duration, evidenced by the sample console output and options like WithSQLQueryFieldname.
Provides a simple interface and built-in adapters for popular backends like Zerolog and Zap, allowing easy integration with existing logging setups.
Assigns unique IDs to link prepared statements with executions for debugging, a key feature highlighted in the README's trackable log output.
Offers numerous options for log levels, field names, time formats, and more, detailed in the logger options section with over 15 customizable settings.
Built-in adapters do not automatically log context values, requiring developers to modify them manually to include items like request IDs, as noted in the README.
For some SQL drivers like SQL Server and Oracle, compatibility is marked as 'maybe', which could lead to integration issues or require additional testing.
Logging every SQL operation adds processing time, which might be significant in latency-sensitive applications, though it's a trade-off for visibility.
With multiple configuration options and the need to correctly wrap drivers, initial setup can be more involved than simpler, less flexible logging solutions.