influxdb/debug.go

52 lines
1.1 KiB
Go
Raw Normal View History

2013-06-25 20:11:48 +00:00
package raft
import (
"log"
"os"
2013-06-25 20:11:48 +00:00
)
//------------------------------------------------------------------------------
//
// Variables
//
//------------------------------------------------------------------------------
// A flag stating if debug statements should be evaluated.
2013-07-03 01:24:19 +00:00
var Debug bool = false
var logger *log.Logger
func init() {
logger = log.New(os.Stdout, "", log.Lmicroseconds)
}
2013-06-25 20:11:48 +00:00
//------------------------------------------------------------------------------
//
// Functions
//
//------------------------------------------------------------------------------
// Prints to the standard logger if debug mode is enabled. Arguments
// are handled in the manner of fmt.Print.
func debug(v ...interface{}) {
if Debug {
logger.Print(v...)
2013-06-25 20:11:48 +00:00
}
}
// Prints to the standard logger if debug mode is enabled. Arguments
// are handled in the manner of fmt.Printf.
func debugf(format string, v ...interface{}) {
if Debug {
logger.Printf(format, v...)
2013-06-25 20:11:48 +00:00
}
}
// Prints to the standard logger if debug mode is enabled. Arguments
// are handled in the manner of debugln.
func debugln(v ...interface{}) {
if Debug {
logger.Println(v...)
2013-06-25 20:11:48 +00:00
}
}