gorm/logger_test.go
2020-01-05 15:32:01 -06:00

25 lines
514 B
Go

package gorm_test
import (
"log"
"os"
"testing"
"time"
"github.com/jinzhu/gorm"
)
func TestNoColor(t *testing.T) {
os.Setenv("NO_COLOR", "1")
gorm.NoColor()
l := gorm.Logger{log.New(os.Stdout, "\r\n", 0)}
l.Print("info", "[info] NO_COLOR log test")
os.Setenv("NO_COLOR", "")
gorm.ResetColors()
}
func TestSQLLog(t *testing.T) {
l := gorm.Logger{log.New(os.Stdout, "\r\n", 0)}
l.Print("sql", "SQL log test", time.Duration(9990000), "sql: log format test type ", []interface{}{"cover"}, int64(0))
}