Commit Graph

21 Commits (30288214878185ecfa82bfea1bf315ad337aea47)

Author SHA1 Message Date
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 cc3461e65d Use golang.org/x/xerrors 2019-04-20 17:43:44 -05:00
Jack Christensen 8f4178b3d3 Use github.com/pkg/errors 2017-06-04 21:30:03 -05: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
Jack Christensen 448d748991 Merge branch 'master' into v3-experimental 2016-08-02 14:54:11 -05:00
Jack Christensen 09f1ca5b00 Fix LogLevelFromString doc formatting 2016-08-02 14:53:10 -05:00
Jack Christensen 390f75c0e1 Reduce Logger interface to Log method 2016-08-02 14:42:31 -05:00
Jack Christensen 04e9fbcc55 Fix some golint errors
- Add comments
- Rename variables
- Remove unnecessary "else"
2016-03-29 15:18:09 -05:00
Jack Christensen cffae7ff5d Add SetLogger to *Conn
Allow replacing logger after connection is established. Also
refactor internals of logging such that there is a log method that
adds the pid to all log calls instead of making a new logger object.
The reason for this is so pid will be logged regardless of whether
loggers are replaced and restored.
2016-02-12 17:49:04 -06:00
Jack Christensen 51407590eb Add LogLevelFromString func 2015-09-16 09:21:51 -05:00
Jack Christensen a1aa06c934 More efficient logging with log levels 2015-09-16 08:20:51 -05:00
Karl Seguin a8f5ce12c5 Trying to reduce memory allocation. logQueryArgs is called even when
using the default discardLogger. This allocates quite a bit of memory.
Created a default dlogger instance and avoid logging code when that's our
logger. I couldn't think of a better implementation without touching the
Logger interface.

On 100 000 inserts, this brought the allocation down to 58MB from 122MB.
It should also result in some small performance gains.
2014-11-18 07:53:33 +07:00
Jack Christensen 92cbc6566d Fix log truncation 2014-09-15 14:27:28 -05:00
Jack Christensen b21a653085 Truncate logged strings and byte slices 2014-09-15 13:53:59 -05:00
Jack Christensen f5156ac4eb discardLogger should be private 2014-09-04 16:45:35 -05:00
Jack Christensen 717ca04aa7 Remove Crit from pgx.Logger
Nothing pgx should do should generate a Crit / Fatal error (program
must terminate now). The higher level program should make those
decisions.
2014-09-04 16:40:26 -05:00
Jack Christensen ff905fe862 Finish compatible interface to inconshreveable/log15 2014-09-04 16:27:40 -05:00
Jack Christensen 98109c57bb Use interface for logging instead of log15 directly 2014-09-04 16:00:53 -05:00
Jack Christensen cbddbb423e Replace logging functionality with log15
gopkg.in/inconshreveable/log15.v2
2014-06-02 19:47:09 -05:00
Jack Christensen f76489f7d7 Add basic logging to pgx
fixes #21
2013-11-05 15:09:50 -06:00