Warn and Depcrecated in internal/log.go are initialized with their own instances of log.Logger hardwired to write to os.stderr and os.stdout. This is a problem for applications 1) wanting logs in a log file, 2) using a different logging system, or 3) formatting log entries in JSON.
It would be useful if pg/internal/log.c were moved to pg/log.c so they could be overriden. Alternatively, they could be initialized with the global log.Logger so that the mechanisms for override that would work for go-pg too. Or is there some other mechanism for configuring logging?
Expected Behavior
It should be possible to prevent go-pg from writing to stdout and stderr or at least control the formatting.
Current Behavior
The internal Warn() and Deprecate methods are hardwired via custom log.Logger instances to write plain text to stdout and stderr.
Possible Solution
Option 1: move pg/internal/log.c to pg/log.c allowing Warn and Deprecate to overridden
Option 2: initiialize them with "lib"'s global log.Logger allowing overrides there to work for go-pg
Option 3: have Warn & Deperate use gin.DefaultWriter and gin.DefaultErrorWriter insteand of their own (these can be overridden)
Context (Environment)
We want to emit JSON logs that we consume with a log aggregator. It breaks on non-JSON being emitted by Gin.
Warn and Depcrecated in internal/log.go are initialized with their own instances of log.Logger hardwired to write to os.stderr and os.stdout. This is a problem for applications 1) wanting logs in a log file, 2) using a different logging system, or 3) formatting log entries in JSON.
It would be useful if pg/internal/log.c were moved to pg/log.c so they could be overriden. Alternatively, they could be initialized with the global log.Logger so that the mechanisms for override that would work for go-pg too. Or is there some other mechanism for configuring logging?
Expected Behavior
It should be possible to prevent go-pg from writing to stdout and stderr or at least control the formatting.
Current Behavior
The internal Warn() and Deprecate methods are hardwired via custom log.Logger instances to write plain text to stdout and stderr.
Possible Solution
Context (Environment)
We want to emit JSON logs that we consume with a log aggregator. It breaks on non-JSON being emitted by Gin.
Possible Implementation
Options 1, 2 or 3 above.