Open natdm opened 5 years ago
You can replace the logger with whatever you'd like so long as it conforms to the io.Writer interface in order to make it goroutine safe: https://github.com/volatiletech/sqlboiler/blob/master/boil/global.go#L25
Not separating query and args could definitely be done but it will make it harder to see. Certainly you cannot put a newline between them in a log because some people may be using structured logging adapters that may not play nice with that sort of thing. Although maybe it'd be escaped. Open to suggestions here.
I think it might be more about the fact that they make multiple writes at the same time (and can be done safely) but then they intertwine with each-other, making the logs useless to read since you don't know what is doing what with which arguments. Maybe the solution is to do something like sarama.Logger
, which can easily be replaced with log.New()
, orzap.Logger.Sugar()
, and then can be written to with formatted lines.
@natdm Still happy to accept a PR to merge these outputs into a single call to log.
What version of SQLBoiler are you using (
sqlboiler --version
)? 3Running sql queries concurrently log the queries and arguments in random order eg:
Proposal: Safer concurrent logging and don't separate the query and the args