Remove -debug option, superceded by --log-level

This commit is contained in:
Bryan Boreham authored and Matthias Radestock committed 2015-07-04 03:27:07 +01:00
1 parent 910b57731d
commit ff2d7451e2
20 files changed
+52 -57

No files matched your search

-5
View File
@@ -1,5 +0,0 @@
package common
func init() {
InitDefaultLogging(false)
}
+19 -13
View File
@@ -41,22 +41,28 @@ var (
Log *logrus.Logger
)
func InitLogging(level logrus.Level) {
if Log == nil {
Log = &logrus.Logger{
Out: os.Stderr,
Formatter: standardTextFormatter,
Hooks: make(logrus.LevelHooks),
Level: level,
}
func init() {
Log = &logrus.Logger{
Out: os.Stderr,
Formatter: standardTextFormatter,
Hooks: make(logrus.LevelHooks),
}
}
func SetLogLevel(levelname string) {
level, err := logrus.ParseLevel(levelname)
if err != nil {
Log.Fatal(err)
}
Log.Level = level
}
func InitDefaultLogging(debug bool) {
level := logrus.InfoLevel
if debug {
level = logrus.DebugLevel
// For backwards-compatibility with code that only has a boolean
func EnableDebugLogging(flag bool) {
switch {
case flag && Log.Level < logrus.DebugLevel:
Log.Level = logrus.DebugLevel
case !flag && Log.Level >= logrus.DebugLevel:
Log.Level = logrus.InfoLevel
}
InitLogging(level)
}
+3 -3
View File
@@ -10,7 +10,7 @@ import (
// Ensure we can add new calls while forwarding the clock
func TestSchedCallsBasic(t *testing.T) {
InitDefaultLogging(testing.Verbose())
EnableDebugLogging(testing.Verbose())
Log.Infoln("TestSchedCallsBasic starting")
const testSecs = 1000
@@ -36,7 +36,7 @@ func TestSchedCallsBasic(t *testing.T) {
// Ensure we can create a 100 seconds gap in the middle of the time travel
func TestSchedCallsGap(t *testing.T) {
InitDefaultLogging(testing.Verbose())
EnableDebugLogging(testing.Verbose())
Log.Infoln("TestSchedCallsGap starting")
const testSecs = 1000
@@ -64,7 +64,7 @@ func TestSchedCallsGap(t *testing.T) {
}
func TestSchedCallsStop(t *testing.T) {
InitDefaultLogging(testing.Verbose())
EnableDebugLogging(testing.Verbose())
Log.Infoln("TestSchedCallsStop starting")
const testSecs = 1000