19 Commits

Author SHA1 Message Date
Jack Christensen
83780b85b5 Remove pgx logging code moved to tracelog 2022-07-23 08:54:59 -05:00
Jack Christensen
f14fb3d692 Replace interface{} with any 2022-04-09 09:12:55 -05:00
Jack Christensen
8e2e8a7009 Remove external log adapters 2021-12-11 14:52:31 -06:00
Jack Christensen
72cc95e4dd Bump module version to v5 2021-12-11 13:29:03 -06:00
urso
044ba47522 Add zerologadapter.NewContextLogger
This change introduces a new zerologadapter that allows
users to pass the actual logger via context.Context. Especially HTTP
middleware might choose to use `(*zerolog.Logger).WithContext` and
`zerolog.Ctx`. Allowing users to extract the logger from the context
keeps the full enriched logger available when pgx emits logs.
2021-10-30 08:52:59 -05:00
Thomas Frössman
255276c390 Add context options to zerologadapter
WithContextFunc adds possibility to get request scoped values from the
ctx.Context before logging lines.

WithoutPGXModule disables adding module:pgx to the default logger context.
2021-09-18 10:36:03 -05:00
KeiichiHirobe
48f39340b3 switch from github.com/go-kit/kit/log to github.com/go-kit/log 2021-07-17 08:39:31 -05:00
Nicholas Wilson
aafa04c156 Use zap.Any for handling interface{} -> zap.Field conversion
zap.Any falls back to zap.Reflect, but is better for this case, because
it first checks for the types that zap handles specially.  For example,
time.Duration, or error, which zap.Reflect will just treat as untyped
int64 or struct objects, but zap.Any is able to detect these types and
print them properly.
2021-07-06 20:18:16 -05:00
Fabrice Aneche
14050e286d fix data map 2021-01-27 16:36:58 -06:00
Fabrice Aneche
9b59dd0346 added a kitlog level log adapter 2021-01-27 16:36:58 -06:00
Jack Christensen
3028821487 Add context.Context to Logger interface
This allows custom logger adapters to add additional fields to log
messages. For example, a HTTP server may with to log the request ID.

fixes #428
2019-08-03 16:16:21 -05:00
Jack Christensen
efb333df6b Fix go modules
Wow. This is fun. Sure is easy to get modules wrong when upgrading a v2+
project.
2019-04-20 17:41:08 -05:00
Justin Reagor
5819bc8fb1 Small typo 2018-03-21 00:25:14 -04:00
Justin Reagor
cb72072f8d Add zerolog logging adapter 2018-03-19 22:40:13 -04:00
André Bierlein
4dea6c902e Use logrus.FieldLogger instead of *logrus.Logger
This allows supplying a logrus logger that already has fields configured
2017-10-10 16:58:24 +02:00
Kelsey Francis
8cb78d376a Add zap log adapter 2017-09-07 11:07:55 -07:00
Damir Vandic
8afa1fd332 fix logrus updated package name (lowercase)
See https://github.com/sirupsen/logrus/issues/570#issuecomment-313933276
2017-08-18 13:46:49 +02:00
Jack Christensen
280bce7078 Added log adapter for logrus
Also changed standard logger interface to take a map instead of varargs for
extra data.
2017-04-29 21:28:38 -05:00
Jack Christensen
855b735eae Add log adapters for testing and log15
Make LogLevel a type for Stringer interface.
2017-04-29 20:33:52 -05:00