Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ coverage:
status:
project:
default: # default is the status check's name, not default settings
target: 90%
target: 100%
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,26 @@
[![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/akm/sql-slog)](./go.mod)
[![license](https://img.shields.io/github/license/akm/sql-slog)](./LICENSE)

A logger for Go SQL database drivers without modifying existing `*sql.DB` stdlib usage.
A logger for Go SQL database drivers with [log/slog](https://pkg.go.dev/log/slog) without modifying existing `*sql.DB` stdlib usage.

## FEATURES

- [x] Keep using (or re-use existing) `*sql.DB` as is.
- [x] No logger adapters. Just use [log/slog](https://pkg.go.dev/log/slog)
- [x] No dependencies
- [x] Leveled, detailed, and configurable logging.
- [x] Duration tracking
- [x] Trackable log output
- [x] 100% test coverage

See [godoc](https://pkg.go.dev/github.com/akm/sql-slog) for more details.

## LOG EXAMPLES

- [sqlite3](./examples/logs-sqlite3/results)
- [postgres](./examples/logs-postgres/results)
- [mysql](./examples/logs-mysql/results)

## FEATURES

- Keep using (or re-use existing) `*sql.DB` as is.
- No logger adapters. Just use [log/slog](https://pkg.go.dev/log/slog)
- No dependencies except stdlib.
- Leveled, detailed and configurable logging.
- Duration
- Trackable log output

See [godoc](https://pkg.go.dev/github.com/akm/sql-slog) for more details.

## INSTALL

To install sql-slog, use the following command:
Expand All @@ -54,7 +55,7 @@ The differences are:

1. Pass `context.Context` as the first argument.
2. `*slog.Logger` is returned as the second argument.
3. `sqlslog.Open` can take a lot of [Option](https://pkg.go.dev/github.com/akm/sql-slog#Option).
3. `sqlslog.Open` can take a lot of [Option](https://pkg.go.dev/github.com/akm/sql-slog#Option) s.

See [godoc examples](https://pkg.go.dev/github.com/akm/sql-slog#example-Open) for more details.

Expand Down
Loading