Change logger to use an interface. This allows reuse of the nice formatting

done by gorm while still sending the output to a custom logger.
This commit is contained in:
Daniel Hobe 2015-09-02 09:37:44 -07:00
parent d3fea6c535
commit fac5e822ff
1 changed files with 5 additions and 1 deletions

View File

@ -14,8 +14,12 @@ type logger interface {
Print(v ...interface{}) Print(v ...interface{})
} }
type LogWriter interface {
Println(v ...interface{})
}
type Logger struct { type Logger struct {
*log.Logger LogWriter
} }
var defaultLogger = Logger{log.New(os.Stdout, "\r\n", 0)} var defaultLogger = Logger{log.New(os.Stdout, "\r\n", 0)}