log.go 851 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package log
  2. import (
  3. "os"
  4. golog "github.com/coreos/etcd/third_party/github.com/coreos/go-log/log"
  5. )
  6. // The Verbose flag turns on verbose logging.
  7. var Verbose bool = false
  8. var logger *golog.Logger = golog.New("etcd", false,
  9. golog.CombinedSink(os.Stdout, "[%s] %s %-9s | %s\n", []string{"prefix", "time", "priority", "message"}))
  10. func Infof(format string, v ...interface{}) {
  11. logger.Infof(format, v...)
  12. }
  13. func Debugf(format string, v ...interface{}) {
  14. if Verbose {
  15. logger.Debugf(format, v...)
  16. }
  17. }
  18. func Debug(v ...interface{}) {
  19. if Verbose {
  20. logger.Debug(v...)
  21. }
  22. }
  23. func Warnf(format string, v ...interface{}) {
  24. logger.Warningf(format, v...)
  25. }
  26. func Warn(v ...interface{}) {
  27. logger.Warning(v...)
  28. }
  29. func Fatalf(format string, v ...interface{}) {
  30. logger.Fatalf(format, v...)
  31. }
  32. func Fatal(v ...interface{}) {
  33. logger.Fatalln(v...)
  34. }