Add the ability to set the default Logger

Sometimes you want to have a default logger that is used
for all of your database connections; you can now set the
default logger using `gorm.SetDefaultLogger`.
This commit is contained in:
Geoff Baskwill 2017-09-18 07:38:52 -04:00
parent b1885a643b
commit 32118f0c44

View File

@ -18,6 +18,11 @@ var (
numericPlaceHolderRegexp = regexp.MustCompile(`\$\d+`)
)
// SetDefaultLogger replaces the default Logger instance.
func SetDefaultLogger(l Logger) {
defaultLogger = l
}
func isPrintable(s string) bool {
for _, r := range s {
if !unicode.IsPrint(r) {