Skip to content

Latest commit

 

History

History
23 lines (21 loc) · 990 Bytes

README.md

File metadata and controls

23 lines (21 loc) · 990 Bytes

Logrus hook for Pgx library :walrus:Build Status

Allows to use Logrus logger with Pgx package.

Installation

It is go gettable $ go get github.com/andygrunwald/go-trending

Usage

Just import it.

import "github.com/rassakhatsky/logrus-pgx"

And assign the logrus-pgx logger as default logger for Pgx.

var dbConfig pgx.ConnPoolConfig
dbConfig.Host = "some_host"
dbConfig.User = "some_user"
dbConfig.Password = "some_password"
dbConfig.Database = "some_db"
dbConfig.Logger = (*logrus_pgx.PgxLogger)(logrus.StandardLogger())
// or wrap an entry (*logrus_pgx.PgxEntry)(logrus.WithFields(logrus.Fields{"module": "pgx"}))
pgxPool, err := pgx.NewConnPool(pgx.ConnPoolConfig{})