Use VerboseMode as boolean + Display block comments

pull/135/head
Tony 2018-12-18 16:08:33 +01:00
parent 7b7eaf1c29
commit b935f725d3
2 changed files with 10 additions and 10 deletions

View File

@ -8,14 +8,14 @@ import (
"sync"
)
// VerboseLevel verbose level of the goose library
type VerboseLevel int
// VerboseMode is the goose verbosity
type VerboseMode bool
const (
// VerboseOff disable the log of the executed SQL statements
VerboseOff VerboseLevel = iota + 1
// VerboseOn log the executed SQL statements
VerboseOn
// VerboseOn is the goose verbose mode
VerboseOn VerboseMode = true
// VerboseOff is the goose silent mode
VerboseOff VerboseMode = false
)
var (
@ -24,11 +24,11 @@ var (
maxVersion = int64((1 << 63) - 1)
timestampFormat = "20060102150405"
verbose = VerboseOff
reMatchSQLComments = regexp.MustCompile(`(--.*)|(((\/\*)+?[\w\W]+?(\*\/)+))`)
reMatchSQLComments = regexp.MustCompile(`(--.*)`)
)
// SetVerbosity defines the goose verbose level
func SetVerbosity(vl VerboseLevel) {
// SetVerbosity defines the goose verbosity
func SetVerbosity(vl VerboseMode) {
verbose = vl
}

View File

@ -202,7 +202,7 @@ func runSQLMigration(db *sql.DB, scriptFile string, v int64, direction bool) err
}
func printInfo(s string, args ...interface{}) {
if verbose == VerboseOn {
if verbose {
log.Printf(s, args...)
}
}