mgutz / dat

Go Postgres Data Access Toolkit
Other
612 stars 62 forks source link

Either remove or expose logxi #36

Open sbowman opened 8 years ago

sbowman commented 8 years ago

Right now logxi is embedded inside dat and is not accessible or configurable, except through the command line. For applications that use alternate logging libraries or aren't 12-factor apps, this makes using dat problematic and often cumbersome. For example, I am apparently supposed to be able to redirect STDOUT to a log file if needs be, but nothing gets written when I do that. I fear if I can get it to work, the file will then fill with ANSI escape characters, making the log file unreadable. Furthermore, we would like to configure logging ourselves and use remote syslog, but this is impossible with dat, as logxi does not support this.

It would be far better if dat simply returned error messages, instead of performing its own logging.

mgutz commented 8 years ago

logxi, when redirected, will set the log level to ERROR and above. To see all levels

LOGXI=* go run your-app.go > log.txt

Logxi logs structured JSON without escape sequences when redirected.

itimofeev commented 7 years ago

There's even PR for setter/getter logxi https://github.com/mgutz/dat/pull/47 Any problems with it?